Search in sources :

Example 11 with InfixExpression

use of org.mozilla.javascript.ast.InfixExpression in project HL4A by HL4A.

the class Parser method eqExpr.

private AstNode eqExpr() throws IOException {
    AstNode pn = relExpr();
    for (; ; ) {
        int tt = peekToken(), opPos = ts.tokenBeg;
        switch(tt) {
            case Token.EQ:
            case Token.NE:
            case Token.SHEQ:
            case Token.SHNE:
                consumeToken();
                int parseToken = tt;
                if (compilerEnv.getLanguageVersion() == Context.VERSION_1_2) {
                    // JavaScript 1.2 uses shallow equality for == and != .
                    if (tt == Token.EQ)
                        parseToken = Token.SHEQ;
                    else if (tt == Token.NE)
                        parseToken = Token.SHNE;
                }
                pn = new InfixExpression(parseToken, pn, relExpr(), opPos);
                continue;
        }
        break;
    }
    return pn;
}
Also used : InfixExpression(org.mozilla.javascript.ast.InfixExpression) AstNode(org.mozilla.javascript.ast.AstNode)

Example 12 with InfixExpression

use of org.mozilla.javascript.ast.InfixExpression in project HL4A by HL4A.

the class Parser method mulExpr.

private AstNode mulExpr() throws IOException {
    AstNode pn = unaryExpr();
    for (; ; ) {
        int tt = peekToken(), opPos = ts.tokenBeg;
        switch(tt) {
            case Token.MUL:
            case Token.DIV:
            case Token.MOD:
                consumeToken();
                pn = new InfixExpression(tt, pn, unaryExpr(), opPos);
                continue;
        }
        break;
    }
    return pn;
}
Also used : InfixExpression(org.mozilla.javascript.ast.InfixExpression) AstNode(org.mozilla.javascript.ast.AstNode)

Example 13 with InfixExpression

use of org.mozilla.javascript.ast.InfixExpression in project HL4A by HL4A.

the class Parser method orExpr.

private AstNode orExpr() throws IOException {
    AstNode pn = andExpr();
    if (matchToken(Token.OR)) {
        int opPos = ts.tokenBeg;
        pn = new InfixExpression(Token.OR, pn, orExpr(), opPos);
    }
    return pn;
}
Also used : InfixExpression(org.mozilla.javascript.ast.InfixExpression) AstNode(org.mozilla.javascript.ast.AstNode)

Example 14 with InfixExpression

use of org.mozilla.javascript.ast.InfixExpression in project HL4A by HL4A.

the class Parser method bitXorExpr.

private AstNode bitXorExpr() throws IOException {
    AstNode pn = bitAndExpr();
    while (matchToken(Token.BITXOR)) {
        int opPos = ts.tokenBeg;
        pn = new InfixExpression(Token.BITXOR, pn, bitAndExpr(), opPos);
    }
    return pn;
}
Also used : InfixExpression(org.mozilla.javascript.ast.InfixExpression) AstNode(org.mozilla.javascript.ast.AstNode)

Aggregations

InfixExpression (org.mozilla.javascript.ast.InfixExpression)14 AstNode (org.mozilla.javascript.ast.AstNode)13 Name (org.mozilla.javascript.ast.Name)2 XmlString (org.mozilla.javascript.ast.XmlString)2 ArrayLiteral (org.mozilla.javascript.ast.ArrayLiteral)1 EmptyExpression (org.mozilla.javascript.ast.EmptyExpression)1 ObjectLiteral (org.mozilla.javascript.ast.ObjectLiteral)1 PropertyGet (org.mozilla.javascript.ast.PropertyGet)1 XmlMemberGet (org.mozilla.javascript.ast.XmlMemberGet)1 XmlRef (org.mozilla.javascript.ast.XmlRef)1