Package antlr

Examples of antlr.ASTPair


*  If an optional expression is missing, its value is void (this coerces to null when a value is required).
*/
  public final void branchStatement() throws RecognitionException, TokenStreamException {
   
    returnAST = null;
    ASTPair currentAST = new ASTPair();
    AST branchStatement_AST = null;
    AST returnE_AST = null;
    Token  breakI = null;
    AST breakI_AST = null;
    Token  contI = null;
    AST contI_AST = null;
    AST throwE_AST = null;
    AST assertAle_AST = null;
    AST assertE_AST = null;
    Token first = LT(1);
   
    switch ( LA(1)) {
    case LITERAL_return:
    {
      match(LITERAL_return);
      {
      switch ( LA(1)) {
      case LBRACK:
      case IDENT:
      case STRING_LITERAL:
      case LPAREN:
      case LITERAL_super:
      case LITERAL_void:
      case LITERAL_boolean:
      case LITERAL_byte:
      case LITERAL_char:
      case LITERAL_short:
      case LITERAL_int:
      case LITERAL_float:
      case LITERAL_long:
      case LITERAL_double:
      case LCURLY:
      case LITERAL_this:
      case PLUS:
      case MINUS:
      case LITERAL_false:
      case LITERAL_new:
      case LITERAL_null:
      case LITERAL_true:
      case INC:
      case DEC:
      case BNOT:
      case LNOT:
      case STRING_CTOR_START:
      case NUM_INT:
      case NUM_FLOAT:
      case NUM_LONG:
      case NUM_DOUBLE:
      case NUM_BIG_INT:
      case NUM_BIG_DECIMAL:
      {
        expression(0);
        returnE_AST = (AST)returnAST;
        break;
      }
      case EOF:
      case RBRACK:
      case COMMA:
      case RPAREN:
      case RCURLY:
      case SEMI:
      case LITERAL_default:
      case LITERAL_else:
      case LITERAL_case:
      case NLS:
      {
        break;
      }
      default:
      {
        throw new NoViableAltException(LT(1), getFilename());
      }
      }
      }
      if ( inputState.guessing==0 ) {
        branchStatement_AST = (AST)currentAST.root;
        branchStatement_AST = (AST)astFactory.make( (new ASTArray(2)).add(create(LITERAL_return,"return",first,LT(1))).add(returnE_AST));
        currentAST.root = branchStatement_AST;
        currentAST.child = branchStatement_AST!=null &&branchStatement_AST.getFirstChild()!=null ?
          branchStatement_AST.getFirstChild() : branchStatement_AST;
        currentAST.advanceChildToEnd();
      }
      branchStatement_AST = (AST)currentAST.root;
      break;
    }
    case LITERAL_break:
    {
      match(LITERAL_break);
      {
      switch ( LA(1)) {
      case IDENT:
      {
        breakI = LT(1);
        breakI_AST = astFactory.create(breakI);
        match(IDENT);
        break;
      }
      case EOF:
      case RBRACK:
      case COMMA:
      case RPAREN:
      case RCURLY:
      case SEMI:
      case LITERAL_default:
      case LITERAL_else:
      case LITERAL_case:
      case NLS:
      {
        break;
      }
      default:
      {
        throw new NoViableAltException(LT(1), getFilename());
      }
      }
      }
      if ( inputState.guessing==0 ) {
        branchStatement_AST = (AST)currentAST.root;
        branchStatement_AST = (AST)astFactory.make( (new ASTArray(2)).add(create(LITERAL_break,"break",first,LT(1))).add(breakI_AST));
        currentAST.root = branchStatement_AST;
        currentAST.child = branchStatement_AST!=null &&branchStatement_AST.getFirstChild()!=null ?
          branchStatement_AST.getFirstChild() : branchStatement_AST;
        currentAST.advanceChildToEnd();
      }
      branchStatement_AST = (AST)currentAST.root;
      break;
    }
    case LITERAL_continue:
    {
      match(LITERAL_continue);
      {
      switch ( LA(1)) {
      case IDENT:
      {
        contI = LT(1);
        contI_AST = astFactory.create(contI);
        match(IDENT);
        break;
      }
      case EOF:
      case RBRACK:
      case COMMA:
      case RPAREN:
      case RCURLY:
      case SEMI:
      case LITERAL_default:
      case LITERAL_else:
      case LITERAL_case:
      case NLS:
      {
        break;
      }
      default:
      {
        throw new NoViableAltException(LT(1), getFilename());
      }
      }
      }
      if ( inputState.guessing==0 ) {
        branchStatement_AST = (AST)currentAST.root;
        branchStatement_AST = (AST)astFactory.make( (new ASTArray(2)).add(create(LITERAL_continue,"continue",first,LT(1))).add(contI_AST));
        currentAST.root = branchStatement_AST;
        currentAST.child = branchStatement_AST!=null &&branchStatement_AST.getFirstChild()!=null ?
          branchStatement_AST.getFirstChild() : branchStatement_AST;
        currentAST.advanceChildToEnd();
      }
      branchStatement_AST = (AST)currentAST.root;
      break;
    }
    case LITERAL_throw:
    {
      match(LITERAL_throw);
      expression(0);
      throwE_AST = (AST)returnAST;
      if ( inputState.guessing==0 ) {
        branchStatement_AST = (AST)currentAST.root;
        branchStatement_AST = (AST)astFactory.make( (new ASTArray(2)).add(create(LITERAL_throw,"throw",first,LT(1))).add(throwE_AST));
        currentAST.root = branchStatement_AST;
        currentAST.child = branchStatement_AST!=null &&branchStatement_AST.getFirstChild()!=null ?
          branchStatement_AST.getFirstChild() : branchStatement_AST;
        currentAST.advanceChildToEnd();
      }
      branchStatement_AST = (AST)currentAST.root;
      break;
    }
    case LITERAL_assert:
    {
      match(LITERAL_assert);
      assignmentLessExpression();
      assertAle_AST = (AST)returnAST;
      {
      if ((LA(1)==COMMA||LA(1)==COLON) && (_tokenSet_81.member(LA(2)))) {
        {
        switch ( LA(1)) {
        case COMMA:
        {
          match(COMMA);
          nls();
          break;
        }
        case COLON:
        {
          match(COLON);
          nls();
          break;
        }
        default:
        {
          throw new NoViableAltException(LT(1), getFilename());
        }
        }
        }
        expression(0);
        assertE_AST = (AST)returnAST;
      }
      else if ((_tokenSet_82.member(LA(1))) && (_tokenSet_11.member(LA(2)))) {
      }
      else {
        throw new NoViableAltException(LT(1), getFilename());
      }
     
      }
      if ( inputState.guessing==0 ) {
        branchStatement_AST = (AST)currentAST.root;
        branchStatement_AST = (AST)astFactory.make( (new ASTArray(3)).add(create(LITERAL_assert,"assert",first,LT(1))).add(assertAle_AST).add(assertE_AST));
        currentAST.root = branchStatement_AST;
        currentAST.child = branchStatement_AST!=null &&branchStatement_AST.getFirstChild()!=null ?
          branchStatement_AST.getFirstChild() : branchStatement_AST;
        currentAST.advanceChildToEnd();
      }
      branchStatement_AST = (AST)currentAST.root;
      break;
    }
    default:
View Full Code Here


  }
 
  public final void closureList() throws RecognitionException, TokenStreamException {
   
    returnAST = null;
    ASTPair currentAST = new ASTPair();
    AST closureList_AST = null;
    Token first = LT(1); boolean sce=false;
   
    {
    switch ( LA(1)) {
    case FINAL:
    case ABSTRACT:
    case STRICTFP:
    case LITERAL_static:
    case LITERAL_def:
    case LBRACK:
    case IDENT:
    case STRING_LITERAL:
    case LPAREN:
    case AT:
    case LITERAL_super:
    case LITERAL_void:
    case LITERAL_boolean:
    case LITERAL_byte:
    case LITERAL_char:
    case LITERAL_short:
    case LITERAL_int:
    case LITERAL_float:
    case LITERAL_long:
    case LITERAL_double:
    case LITERAL_private:
    case LITERAL_public:
    case LITERAL_protected:
    case LITERAL_transient:
    case LITERAL_native:
    case LITERAL_threadsafe:
    case LITERAL_synchronized:
    case LITERAL_volatile:
    case LCURLY:
    case LITERAL_this:
    case LITERAL_return:
    case LITERAL_break:
    case LITERAL_continue:
    case LITERAL_throw:
    case LITERAL_assert:
    case PLUS:
    case MINUS:
    case LITERAL_false:
    case LITERAL_new:
    case LITERAL_null:
    case LITERAL_true:
    case INC:
    case DEC:
    case BNOT:
    case LNOT:
    case STRING_CTOR_START:
    case NUM_INT:
    case NUM_FLOAT:
    case NUM_LONG:
    case NUM_DOUBLE:
    case NUM_BIG_INT:
    case NUM_BIG_DECIMAL:
    {
      sce=strictContextExpression(true);
      astFactory.addASTChild(currentAST, returnAST);
      break;
    }
    case SEMI:
    {
      if ( inputState.guessing==0 ) {
        astFactory.addASTChild(currentAST,astFactory.create(EMPTY_STAT, "EMPTY_STAT"));
      }
      break;
    }
    default:
    {
      throw new NoViableAltException(LT(1), getFilename());
    }
    }
    }
    {
    int _cnt310=0;
    _loop310:
    do {
      if ((LA(1)==SEMI) && (_tokenSet_83.member(LA(2)))) {
        match(SEMI);
        sce=strictContextExpression(true);
        astFactory.addASTChild(currentAST, returnAST);
      }
      else if ((LA(1)==SEMI) && (LA(2)==RPAREN||LA(2)==SEMI)) {
        match(SEMI);
        if ( inputState.guessing==0 ) {
          astFactory.addASTChild(currentAST,astFactory.create(EMPTY_STAT, "EMPTY_STAT"));
        }
      }
      else {
        if ( _cnt310>=1 ) { break _loop310; } else {throw new NoViableAltException(LT(1), getFilename());}
      }
     
      _cnt310++;
    } while (true);
    }
    if ( inputState.guessing==0 ) {
      closureList_AST = (AST)currentAST.root;
      closureList_AST = (AST)astFactory.make( (new ASTArray(2)).add(create(CLOSURE_LIST,"CLOSURE_LIST",first,LT(1))).add(closureList_AST));
      currentAST.root = closureList_AST;
      currentAST.child = closureList_AST!=null &&closureList_AST.getFirstChild()!=null ?
        closureList_AST.getFirstChild() : closureList_AST;
      currentAST.advanceChildToEnd();
    }
    closureList_AST = (AST)currentAST.root;
    returnAST = closureList_AST;
  }
View Full Code Here

  }
 
  public final void forInClause() throws RecognitionException, TokenStreamException {
   
    returnAST = null;
    ASTPair currentAST = new ASTPair();
    AST forInClause_AST = null;
    AST decl_AST = null;
    Token  i = null;
    AST i_AST = null;
    Token  c = null;
View Full Code Here

  public final void shiftExpression(
    int lc_stmt
  ) throws RecognitionException, TokenStreamException {
   
    returnAST = null;
    ASTPair currentAST = new ASTPair();
    AST shiftExpression_AST = null;
   
    additiveExpression(lc_stmt);
    astFactory.addASTChild(currentAST, returnAST);
    {
View Full Code Here

  public final void expression(
    int lc_stmt
  ) throws RecognitionException, TokenStreamException {
   
    returnAST = null;
    ASTPair currentAST = new ASTPair();
    AST expression_AST = null;
    Token  lp = null;
    AST lp_AST = null;
    AST m_AST = null;
   
    boolean synPredMatched385 = false;
    if (((LA(1)==LPAREN) && (_tokenSet_24.member(LA(2))))) {
      int _m385 = mark();
      synPredMatched385 = true;
      inputState.guessing++;
      try {
        {
        match(LPAREN);
        typeSpec(true);
        match(RPAREN);
        expression(lc_stmt);
        }
      }
      catch (RecognitionException pe) {
        synPredMatched385 = false;
      }
      rewind(_m385);
inputState.guessing--;
    }
    if ( synPredMatched385 ) {
      lp = LT(1);
      lp_AST = astFactory.create(lp);
      astFactory.makeASTRoot(currentAST, lp_AST);
      match(LPAREN);
      if ( inputState.guessing==0 ) {
        lp_AST.setType(TYPECAST);
      }
      typeSpec(true);
      astFactory.addASTChild(currentAST, returnAST);
      match(RPAREN);
      expression(lc_stmt);
      astFactory.addASTChild(currentAST, returnAST);
      expression_AST = (AST)currentAST.root;
    }
    else {
      boolean synPredMatched389 = false;
      if (((LA(1)==LPAREN) && (LA(2)==IDENT||LA(2)==NLS))) {
        int _m389 = mark();
        synPredMatched389 = true;
        inputState.guessing++;
        try {
          {
          match(LPAREN);
          nls();
          match(IDENT);
          {
          _loop388:
          do {
            if ((LA(1)==COMMA)) {
              match(COMMA);
              nls();
              match(IDENT);
            }
            else {
              break _loop388;
            }
           
          } while (true);
          }
          match(RPAREN);
          match(ASSIGN);
          }
        }
        catch (RecognitionException pe) {
          synPredMatched389 = false;
        }
        rewind(_m389);
inputState.guessing--;
      }
      if ( synPredMatched389 ) {
        multipleAssignment(lc_stmt);
        m_AST = (AST)returnAST;
        astFactory.addASTChild(currentAST, returnAST);
        if ( inputState.guessing==0 ) {
          expression_AST = (AST)currentAST.root;
          expression_AST=m_AST;
          currentAST.root = expression_AST;
          currentAST.child = expression_AST!=null &&expression_AST.getFirstChild()!=null ?
            expression_AST.getFirstChild() : expression_AST;
          currentAST.advanceChildToEnd();
        }
        expression_AST = (AST)currentAST.root;
      }
      else if ((_tokenSet_19.member(LA(1))) && (_tokenSet_37.member(LA(2)))) {
        assignmentExpression(lc_stmt);
View Full Code Here

   
/** Lookahead for suspicious statement warnings and errors. */
  public final void suspiciousExpressionStatementStart() throws RecognitionException, TokenStreamException {
   
    returnAST = null;
    ASTPair currentAST = new ASTPair();
    AST suspiciousExpressionStatementStart_AST = null;
   
    {
    switch ( LA(1)) {
    case PLUS:
View Full Code Here

  public final void checkSuspiciousExpressionStatement(
    int prevToken
  ) throws RecognitionException, TokenStreamException {
   
    returnAST = null;
    ASTPair currentAST = new ASTPair();
    AST checkSuspiciousExpressionStatement_AST = null;
   
    boolean synPredMatched334 = false;
    if (((_tokenSet_19.member(LA(1))) && (_tokenSet_1.member(LA(2))))) {
      int _m334 = mark();
View Full Code Here

  public final void commandArgumentsGreedy(
    AST head
  ) throws RecognitionException, TokenStreamException {
   
    returnAST = null;
    ASTPair currentAST = new ASTPair();
    AST commandArgumentsGreedy_AST = null;
    AST first_AST = null;
    AST pre_AST = null;
    AST pc_AST = null;
    AST ca_AST = null;
   
      AST prev = null;
   
   
    if ( inputState.guessing==0 ) {
      prev = head;
    }
    {
    boolean synPredMatched369 = false;
    if (((_tokenSet_86.member(LA(1))) && (_tokenSet_37.member(LA(2))))) {
      int _m369 = mark();
      synPredMatched369 = true;
      inputState.guessing++;
      try {
        {
        if (!(prev.getType()!=METHOD_CALL))
          throw new SemanticException("prev.getType()!=METHOD_CALL");
        commandArgument();
        }
      }
      catch (RecognitionException pe) {
        synPredMatched369 = false;
      }
      rewind(_m369);
inputState.guessing--;
    }
    if ( synPredMatched369 ) {
      {
      commandArguments(head);
      first_AST = (AST)returnAST;
      if ( inputState.guessing==0 ) {
        prev = first_AST;
      }
      }
    }
    else if ((_tokenSet_70.member(LA(1))) && (_tokenSet_71.member(LA(2)))) {
    }
    else {
      throw new NoViableAltException(LT(1), getFilename());
    }
   
    }
    {
    {
    _loop378:
    do {
      if ((_tokenSet_87.member(LA(1))) && (_tokenSet_88.member(LA(2)))) {
        primaryExpression();
        pre_AST = (AST)returnAST;
        if ( inputState.guessing==0 ) {
          prev = (AST)astFactory.make( (new ASTArray(3)).add(create(DOT,".",prev)).add(prev).add(pre_AST));
        }
        {
        boolean synPredMatched375 = false;
        if (((_tokenSet_89.member(LA(1))) && (_tokenSet_90.member(LA(2))))) {
          int _m375 = mark();
          synPredMatched375 = true;
          inputState.guessing++;
          try {
            {
            pathElementStart();
            }
          }
          catch (RecognitionException pe) {
            synPredMatched375 = false;
          }
          rewind(_m375);
inputState.guessing--;
        }
        if ( synPredMatched375 ) {
          {
          pathChain(LC_STMT,prev);
          pc_AST = (AST)returnAST;
          if ( inputState.guessing==0 ) {
            prev = pc_AST;
          }
          }
        }
        else if ((_tokenSet_86.member(LA(1))) && (_tokenSet_37.member(LA(2)))) {
          {
          commandArguments(prev);
          ca_AST = (AST)returnAST;
          if ( inputState.guessing==0 ) {
            prev = ca_AST;
          }
          }
        }
        else if ((_tokenSet_70.member(LA(1))) && (_tokenSet_71.member(LA(2)))) {
        }
        else {
          throw new NoViableAltException(LT(1), getFilename());
        }
       
        }
      }
      else {
        break _loop378;
      }
     
    } while (true);
    }
    }
    if ( inputState.guessing==0 ) {
      commandArgumentsGreedy_AST = (AST)currentAST.root;
      commandArgumentsGreedy_AST = prev;
      currentAST.root = commandArgumentsGreedy_AST;
      currentAST.child = commandArgumentsGreedy_AST!=null &&commandArgumentsGreedy_AST.getFirstChild()!=null ?
        commandArgumentsGreedy_AST.getFirstChild() : commandArgumentsGreedy_AST;
      currentAST.advanceChildToEnd();
    }
    commandArgumentsGreedy_AST = (AST)currentAST.root;
    returnAST = commandArgumentsGreedy_AST;
  }
View Full Code Here

  }
 
  public final void aCase() throws RecognitionException, TokenStreamException {
   
    returnAST = null;
    ASTPair currentAST = new ASTPair();
    AST aCase_AST = null;
   
    {
    switch ( LA(1)) {
    case LITERAL_case:
View Full Code Here

  }
 
  public final void caseSList() throws RecognitionException, TokenStreamException {
   
    returnAST = null;
    ASTPair currentAST = new ASTPair();
    AST caseSList_AST = null;
    Token first = LT(1);
   
    statement(COLON);
    astFactory.addASTChild(currentAST, returnAST);
    {
    _loop348:
    do {
      if ((LA(1)==SEMI||LA(1)==NLS)) {
        sep();
        {
        switch ( LA(1)) {
        case FINAL:
        case ABSTRACT:
        case STRICTFP:
        case LITERAL_import:
        case LITERAL_static:
        case LITERAL_def:
        case LBRACK:
        case IDENT:
        case STRING_LITERAL:
        case LPAREN:
        case LITERAL_class:
        case LITERAL_interface:
        case LITERAL_enum:
        case AT:
        case LITERAL_super:
        case LITERAL_void:
        case LITERAL_boolean:
        case LITERAL_byte:
        case LITERAL_char:
        case LITERAL_short:
        case LITERAL_int:
        case LITERAL_float:
        case LITERAL_long:
        case LITERAL_double:
        case LITERAL_private:
        case LITERAL_public:
        case LITERAL_protected:
        case LITERAL_transient:
        case LITERAL_native:
        case LITERAL_threadsafe:
        case LITERAL_synchronized:
        case LITERAL_volatile:
        case LCURLY:
        case LITERAL_this:
        case LITERAL_if:
        case LITERAL_while:
        case LITERAL_switch:
        case LITERAL_for:
        case LITERAL_return:
        case LITERAL_break:
        case LITERAL_continue:
        case LITERAL_throw:
        case LITERAL_assert:
        case PLUS:
        case MINUS:
        case LITERAL_try:
        case LITERAL_false:
        case LITERAL_new:
        case LITERAL_null:
        case LITERAL_true:
        case INC:
        case DEC:
        case BNOT:
        case LNOT:
        case STRING_CTOR_START:
        case NUM_INT:
        case NUM_FLOAT:
        case NUM_LONG:
        case NUM_DOUBLE:
        case NUM_BIG_INT:
        case NUM_BIG_DECIMAL:
        {
          statement(sepToken);
          astFactory.addASTChild(currentAST, returnAST);
          break;
        }
        case RCURLY:
        case SEMI:
        case LITERAL_default:
        case LITERAL_case:
        case NLS:
        {
          break;
        }
        default:
        {
          throw new NoViableAltException(LT(1), getFilename());
        }
        }
        }
      }
      else {
        break _loop348;
      }
     
    } while (true);
    }
    if ( inputState.guessing==0 ) {
      caseSList_AST = (AST)currentAST.root;
      caseSList_AST = (AST)astFactory.make( (new ASTArray(2)).add(create(SLIST,"SLIST",first,LT(1))).add(caseSList_AST));
      currentAST.root = caseSList_AST;
      currentAST.child = caseSList_AST!=null &&caseSList_AST.getFirstChild()!=null ?
        caseSList_AST.getFirstChild() : caseSList_AST;
      currentAST.advanceChildToEnd();
    }
    caseSList_AST = (AST)currentAST.root;
    returnAST = caseSList_AST;
  }
View Full Code Here

TOP

Related Classes of antlr.ASTPair

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.