Package antlr

Examples of antlr.ASTPair


  }
 
  public final void compoundStatement() throws RecognitionException, TokenStreamException {
   
    returnAST = null;
    ASTPair currentAST = new ASTPair();
    AST compoundStatement_AST = null;
   
    openBlock();
    astFactory.addASTChild(currentAST, returnAST);
    compoundStatement_AST = (AST)currentAST.root;
View Full Code Here


  public final void constructorDefinition(
    AST mods
  ) throws RecognitionException, TokenStreamException {
   
    returnAST = null;
    ASTPair currentAST = new ASTPair();
    AST constructorDefinition_AST = null;
    Token  id = null;
    AST id_AST = null;
    AST param_AST = null;
    AST tc_AST = null;
    AST cb_AST = null;
    Token first = cloneToken(LT(1));
    if (mods != null) {
    first.setLine(mods.getLine());
    first.setColumn(mods.getColumn());
    }
   
    id = LT(1);
    id_AST = astFactory.create(id);
    astFactory.addASTChild(currentAST, id_AST);
    match(IDENT);
    match(LPAREN);
    parameterDeclarationList();
    param_AST = (AST)returnAST;
    match(RPAREN);
    {
    boolean synPredMatched241 = false;
    if (((LA(1)==LITERAL_throws||LA(1)==NLS) && (_tokenSet_28.member(LA(2))))) {
      int _m241 = mark();
      synPredMatched241 = true;
      inputState.guessing++;
      try {
        {
        nls();
        match(LITERAL_throws);
        }
      }
      catch (RecognitionException pe) {
        synPredMatched241 = false;
      }
      rewind(_m241);
inputState.guessing--;
    }
    if ( synPredMatched241 ) {
      throwsClause();
      tc_AST = (AST)returnAST;
    }
    else if ((LA(1)==LCURLY||LA(1)==NLS) && (_tokenSet_65.member(LA(2)))) {
    }
    else {
      throw new NoViableAltException(LT(1), getFilename());
    }
   
    }
    nlsWarn();
    if ( inputState.guessing==0 ) {
      isConstructorIdent(id);
    }
    constructorBody();
    cb_AST = (AST)returnAST;
    if ( inputState.guessing==0 ) {
      constructorDefinition_AST = (AST)currentAST.root;
      constructorDefinition_AST =  (AST)astFactory.make( (new ASTArray(5)).add(create(CTOR_IDENT,"CTOR_IDENT",first,LT(1))).add(mods).add(param_AST).add(tc_AST).add(cb_AST));
     
      currentAST.root = constructorDefinition_AST;
      currentAST.child = constructorDefinition_AST!=null &&constructorDefinition_AST.getFirstChild()!=null ?
        constructorDefinition_AST.getFirstChild() : constructorDefinition_AST;
      currentAST.advanceChildToEnd();
    }
    constructorDefinition_AST = (AST)currentAST.root;
    returnAST = constructorDefinition_AST;
  }
View Full Code Here

  }
 
  public final void multipleAssignmentDeclarationStart() throws RecognitionException, TokenStreamException {
   
    returnAST = null;
    ASTPair currentAST = new ASTPair();
    AST multipleAssignmentDeclarationStart_AST = null;
   
    {
    _loop221:
    do {
View Full Code Here

  }
 
  public final void multipleAssignmentDeclaration() throws RecognitionException, TokenStreamException {
   
    returnAST = null;
    ASTPair currentAST = new ASTPair();
    AST multipleAssignmentDeclaration_AST = null;
    AST mods_AST = null;
    AST t_AST = null;
    Token first = cloneToken(LT(1));
   
    modifiers();
    mods_AST = (AST)returnAST;
    {
    switch ( LA(1)) {
    case IDENT:
    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:
    {
      typeSpec(false);
      t_AST = (AST)returnAST;
      break;
    }
    case LPAREN:
    {
      break;
    }
    default:
    {
      throw new NoViableAltException(LT(1), getFilename());
    }
    }
    }
    AST tmp184_AST = null;
    tmp184_AST = astFactory.create(LT(1));
    astFactory.makeASTRoot(currentAST, tmp184_AST);
    match(LPAREN);
    nls();
    typeNamePairs(mods_AST,first);
    astFactory.addASTChild(currentAST, returnAST);
    match(RPAREN);
    AST tmp186_AST = null;
    tmp186_AST = astFactory.create(LT(1));
    astFactory.makeASTRoot(currentAST, tmp186_AST);
    match(ASSIGN);
    nls();
    assignmentExpression(0);
    astFactory.addASTChild(currentAST, returnAST);
    if ( inputState.guessing==0 ) {
      multipleAssignmentDeclaration_AST = (AST)currentAST.root;
      multipleAssignmentDeclaration_AST=(AST)astFactory.make( (new ASTArray(4)).add(create(VARIABLE_DEF,"VARIABLE_DEF",first,LT(1))).add(mods_AST).add((AST)astFactory.make( (new ASTArray(2)).add(create(TYPE,"TYPE",first,LT(1))).add(t_AST))).add(multipleAssignmentDeclaration_AST));
      currentAST.root = multipleAssignmentDeclaration_AST;
      currentAST.child = multipleAssignmentDeclaration_AST!=null &&multipleAssignmentDeclaration_AST.getFirstChild()!=null ?
        multipleAssignmentDeclaration_AST.getFirstChild() : multipleAssignmentDeclaration_AST;
      currentAST.advanceChildToEnd();
    }
    multipleAssignmentDeclaration_AST = (AST)currentAST.root;
    returnAST = multipleAssignmentDeclaration_AST;
  }
View Full Code Here

  }
 
  public final void constructorBody() throws RecognitionException, TokenStreamException {
   
    returnAST = null;
    ASTPair currentAST = new ASTPair();
    AST constructorBody_AST = null;
    AST eci_AST = null;
    AST bb1_AST = null;
    AST bb2_AST = null;
    Token first = LT(1);
   
    match(LCURLY);
    nls();
    {
    boolean synPredMatched211 = false;
    if (((_tokenSet_66.member(LA(1))) && (_tokenSet_67.member(LA(2))))) {
      int _m211 = mark();
      synPredMatched211 = true;
      inputState.guessing++;
      try {
        {
        explicitConstructorInvocation();
        }
      }
      catch (RecognitionException pe) {
        synPredMatched211 = false;
      }
      rewind(_m211);
inputState.guessing--;
    }
    if ( synPredMatched211 ) {
      explicitConstructorInvocation();
      eci_AST = (AST)returnAST;
      {
      switch ( LA(1)) {
      case SEMI:
      case NLS:
      {
        sep();
        blockBody(sepToken);
        bb1_AST = (AST)returnAST;
        break;
      }
      case RCURLY:
      {
        break;
      }
      default:
      {
        throw new NoViableAltException(LT(1), getFilename());
      }
      }
      }
    }
    else if ((_tokenSet_30.member(LA(1))) && (_tokenSet_68.member(LA(2)))) {
      blockBody(EOF);
      bb2_AST = (AST)returnAST;
    }
    else {
      throw new NoViableAltException(LT(1), getFilename());
    }
   
    }
    match(RCURLY);
    if ( inputState.guessing==0 ) {
      constructorBody_AST = (AST)currentAST.root;
      if (eci_AST != null)
      constructorBody_AST = (AST)astFactory.make( (new ASTArray(3)).add(create(SLIST,"{",first,LT(1))).add(eci_AST).add(bb1_AST));
      else
      constructorBody_AST = (AST)astFactory.make( (new ASTArray(2)).add(create(SLIST,"{",first,LT(1))).add(bb2_AST));
      currentAST.root = constructorBody_AST;
      currentAST.child = constructorBody_AST!=null &&constructorBody_AST.getFirstChild()!=null ?
        constructorBody_AST.getFirstChild() : constructorBody_AST;
      currentAST.advanceChildToEnd();
    }
    constructorBody_AST = (AST)currentAST.root;
    returnAST = constructorBody_AST;
  }
View Full Code Here

 
/** Catch obvious constructor calls, but not the expr.super(...) calls */
  public final void explicitConstructorInvocation() throws RecognitionException, TokenStreamException {
   
    returnAST = null;
    ASTPair currentAST = new ASTPair();
    AST explicitConstructorInvocation_AST = null;
    Token  lp1 = null;
    AST lp1_AST = null;
    Token  lp2 = null;
    AST lp2_AST = null;
View Full Code Here

  public final void listOfVariables(
    AST mods, AST t, Token first
  ) throws RecognitionException, TokenStreamException {
   
    returnAST = null;
    ASTPair currentAST = new ASTPair();
    AST listOfVariables_AST = null;
   
    variableDeclarator(getASTFactory().dupTree(mods),
                           getASTFactory().dupTree(t),first);
    astFactory.addASTChild(currentAST, returnAST);
View Full Code Here

  public final void variableDeclarator(
    AST mods, AST t,Token first
  ) throws RecognitionException, TokenStreamException {
   
    returnAST = null;
    ASTPair currentAST = new ASTPair();
    AST variableDeclarator_AST = null;
    AST id_AST = null;
    AST v_AST = null;
   
    variableName();
    id_AST = (AST)returnAST;
    {
    switch ( LA(1)) {
    case ASSIGN:
    {
      varInitializer();
      v_AST = (AST)returnAST;
      break;
    }
    case EOF:
    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 ) {
      variableDeclarator_AST = (AST)currentAST.root;
      variableDeclarator_AST = (AST)astFactory.make( (new ASTArray(5)).add(create(VARIABLE_DEF,"VARIABLE_DEF",first,LT(1))).add(mods).add((AST)astFactory.make( (new ASTArray(2)).add(create(TYPE,"TYPE",first,LT(1))).add(t))).add(id_AST).add(v_AST));
      currentAST.root = variableDeclarator_AST;
      currentAST.child = variableDeclarator_AST!=null &&variableDeclarator_AST.getFirstChild()!=null ?
        variableDeclarator_AST.getFirstChild() : variableDeclarator_AST;
      currentAST.advanceChildToEnd();
    }
    returnAST = variableDeclarator_AST;
  }
View Full Code Here

  public final void typeNamePairs(
    AST mods, Token first
  ) throws RecognitionException, TokenStreamException {
   
    returnAST = null;
    ASTPair currentAST = new ASTPair();
    AST typeNamePairs_AST = null;
    AST t_AST = null;
    AST tn_AST = null;
   
    {
View Full Code Here

  public final void assignmentExpression(
    int lc_stmt
  ) throws RecognitionException, TokenStreamException {
   
    returnAST = null;
    ASTPair currentAST = new ASTPair();
    AST assignmentExpression_AST = null;
   
    conditionalExpression(lc_stmt);
    astFactory.addASTChild(currentAST, returnAST);
    {
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.