Exemplo n.º 1
0
 private IElementType parseMemberDeclarationRest(boolean isEnum) {
   IElementType keywordToken = tt();
   IElementType declType = null;
   if (keywordToken == CLASS_KEYWORD) {
     if (lookahead(1) == OBJECT_KEYWORD) {
       declType = parseClassObject();
     } else {
       declType = parseClass(isEnum);
     }
   } else if (keywordToken == TRAIT_KEYWORD) {
     declType = parseClass(isEnum);
   } else if (keywordToken == FUN_KEYWORD) {
     declType = parseFunction();
   } else if (keywordToken == VAL_KEYWORD || keywordToken == VAR_KEYWORD) {
     declType = parseProperty();
   } else if (keywordToken == TYPE_KEYWORD) {
     declType = parseTypeDef();
   } else if (keywordToken == OBJECT_KEYWORD) {
     parseObject(true, true);
     declType = OBJECT_DECLARATION;
   } else if (keywordToken == LBRACE) {
     parseBlock();
     declType = ANONYMOUS_INITIALIZER;
   }
   return declType;
 }
Exemplo n.º 2
0
 /*
  * functionBody
  *   : block
  *   : "=" element
  *   ;
  */
 private void parseFunctionBody() {
   if (at(LBRACE)) {
     parseBlock();
   } else if (at(EQ)) {
     advance(); // EQ
     myExpressionParsing.parseExpression();
     consumeIf(SEMICOLON);
   } else {
     errorAndAdvance("Expecting function body");
   }
 }