Exemplo n.º 1
0
 static {
   Set<IElementType> operations = new HashSet<IElementType>();
   Precedence[] values = Precedence.values();
   for (Precedence precedence : values) {
     operations.addAll(Arrays.asList(precedence.getOperations().getTypes()));
   }
   ALL_OPERATIONS = TokenSet.create(operations.toArray(new IElementType[operations.size()]));
 }
Exemplo n.º 2
0
  /*
   * element (operation element)*
   *
   * see the precedence table
   */
  private void parseBinaryExpression(Precedence precedence) {
    //        System.out.println(precedence.name() + " at " + myBuilder.getTokenText());

    PsiBuilder.Marker expression = mark();

    precedence.parseHigherPrecedence(this);

    while (!interruptedWithNewLine() && atSet(precedence.getOperations())) {
      IElementType operation = tt();

      parseOperationReference();

      JetNodeType resultType = precedence.parseRightHandSide(operation, this);
      expression.done(resultType);
      expression = expression.precede();
    }

    expression.drop();
  }