示例#1
0
 static {
   Precedence[] values = Precedence.values();
   for (Precedence precedence : values) {
     int ordinal = precedence.ordinal();
     precedence.higher = ordinal > 0 ? values[ordinal - 1] : null;
   }
 }
示例#2
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()]));
 }
示例#3
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();
  }