Search in sources :

Example 1 with BinaryOperatorTree

use of com.google.javascript.jscomp.parsing.parser.trees.BinaryOperatorTree in project closure-compiler by google.

the class Parser method parseRelational.

// 11.8 Relational
private ParseTree parseRelational(Expression expressionIn) {
    SourcePosition start = getTreeStartLocation();
    ParseTree left = parseShiftExpression();
    while (peekRelationalOperator(expressionIn)) {
        Token operator = nextToken();
        ParseTree right = parseShiftExpression();
        left = new BinaryOperatorTree(getTreeLocation(start), left, operator, right);
    }
    return left;
}
Also used : SourcePosition(com.google.javascript.jscomp.parsing.parser.util.SourcePosition) BinaryOperatorTree(com.google.javascript.jscomp.parsing.parser.trees.BinaryOperatorTree) ParseTree(com.google.javascript.jscomp.parsing.parser.trees.ParseTree)

Example 2 with BinaryOperatorTree

use of com.google.javascript.jscomp.parsing.parser.trees.BinaryOperatorTree in project closure-compiler by google.

the class Parser method parseBitwiseOR.

// 11.10 Bitwise OR
private ParseTree parseBitwiseOR(Expression expressionIn) {
    SourcePosition start = getTreeStartLocation();
    ParseTree left = parseBitwiseXOR(expressionIn);
    while (peek(TokenType.BAR)) {
        Token operator = eat(TokenType.BAR);
        ParseTree right = parseBitwiseXOR(expressionIn);
        left = new BinaryOperatorTree(getTreeLocation(start), left, operator, right);
    }
    return left;
}
Also used : SourcePosition(com.google.javascript.jscomp.parsing.parser.util.SourcePosition) BinaryOperatorTree(com.google.javascript.jscomp.parsing.parser.trees.BinaryOperatorTree) ParseTree(com.google.javascript.jscomp.parsing.parser.trees.ParseTree)

Example 3 with BinaryOperatorTree

use of com.google.javascript.jscomp.parsing.parser.trees.BinaryOperatorTree in project closure-compiler by google.

the class Parser method parseEquality.

// 11.9 Equality Expression
private ParseTree parseEquality(Expression expressionIn) {
    SourcePosition start = getTreeStartLocation();
    ParseTree left = parseRelational(expressionIn);
    while (peekEqualityOperator()) {
        Token operator = nextToken();
        ParseTree right = parseRelational(expressionIn);
        left = new BinaryOperatorTree(getTreeLocation(start), left, operator, right);
    }
    return left;
}
Also used : SourcePosition(com.google.javascript.jscomp.parsing.parser.util.SourcePosition) BinaryOperatorTree(com.google.javascript.jscomp.parsing.parser.trees.BinaryOperatorTree) ParseTree(com.google.javascript.jscomp.parsing.parser.trees.ParseTree)

Example 4 with BinaryOperatorTree

use of com.google.javascript.jscomp.parsing.parser.trees.BinaryOperatorTree in project closure-compiler by google.

the class Parser method parseShiftExpression.

// 11.7 Shift Expression
private ParseTree parseShiftExpression() {
    SourcePosition start = getTreeStartLocation();
    ParseTree left = parseAdditiveExpression();
    while (peekShiftOperator()) {
        Token operator = nextToken();
        ParseTree right = parseAdditiveExpression();
        left = new BinaryOperatorTree(getTreeLocation(start), left, operator, right);
    }
    return left;
}
Also used : SourcePosition(com.google.javascript.jscomp.parsing.parser.util.SourcePosition) BinaryOperatorTree(com.google.javascript.jscomp.parsing.parser.trees.BinaryOperatorTree) ParseTree(com.google.javascript.jscomp.parsing.parser.trees.ParseTree)

Example 5 with BinaryOperatorTree

use of com.google.javascript.jscomp.parsing.parser.trees.BinaryOperatorTree in project closure-compiler by google.

the class Parser method parseBitwiseAND.

// 11.10 Bitwise AND
private ParseTree parseBitwiseAND(Expression expressionIn) {
    SourcePosition start = getTreeStartLocation();
    ParseTree left = parseEquality(expressionIn);
    while (peek(TokenType.AMPERSAND)) {
        Token operator = eat(TokenType.AMPERSAND);
        ParseTree right = parseEquality(expressionIn);
        left = new BinaryOperatorTree(getTreeLocation(start), left, operator, right);
    }
    return left;
}
Also used : SourcePosition(com.google.javascript.jscomp.parsing.parser.util.SourcePosition) BinaryOperatorTree(com.google.javascript.jscomp.parsing.parser.trees.BinaryOperatorTree) ParseTree(com.google.javascript.jscomp.parsing.parser.trees.ParseTree)

Aggregations

BinaryOperatorTree (com.google.javascript.jscomp.parsing.parser.trees.BinaryOperatorTree)12 ParseTree (com.google.javascript.jscomp.parsing.parser.trees.ParseTree)12 SourcePosition (com.google.javascript.jscomp.parsing.parser.util.SourcePosition)12