Package antlr

Examples of antlr.ASTPair


*  but a warning message is left for the user, if there was a newline.
*/
  public final void nlsWarn() throws RecognitionException, TokenStreamException {
   
    returnAST = null;
    ASTPair currentAST = new ASTPair();
    AST nlsWarn_AST = null;
   
    {
    boolean synPredMatched576 = false;
    if (((_tokenSet_69.member(LA(1))) && (_tokenSet_1.member(LA(2))))) {
View Full Code Here


 
/** An open block is not allowed to have closure arguments. */
  public final void openBlock() throws RecognitionException, TokenStreamException {
   
    returnAST = null;
    ASTPair currentAST = new ASTPair();
    AST openBlock_AST = null;
    AST bb_AST = null;
    Token first = LT(1);
   
    match(LCURLY);
    nls();
    blockBody(EOF);
    bb_AST = (AST)returnAST;
    match(RCURLY);
    if ( inputState.guessing==0 ) {
      openBlock_AST = (AST)currentAST.root;
      openBlock_AST = (AST)astFactory.make( (new ASTArray(2)).add(create(SLIST,"{",first,LT(1))).add(bb_AST));
      currentAST.root = openBlock_AST;
      currentAST.child = openBlock_AST!=null &&openBlock_AST.getFirstChild()!=null ?
        openBlock_AST.getFirstChild() : openBlock_AST;
      currentAST.advanceChildToEnd();
    }
    openBlock_AST = (AST)currentAST.root;
    returnAST = openBlock_AST;
  }
View Full Code Here

  }
 
  public final void variableName() throws RecognitionException, TokenStreamException {
   
    returnAST = null;
    ASTPair currentAST = new ASTPair();
    AST variableName_AST = null;
   
    AST tmp210_AST = null;
    tmp210_AST = astFactory.create(LT(1));
    astFactory.addASTChild(currentAST, tmp210_AST);
View Full Code Here

  }
 
  public final void expressionStatementNoCheck() throws RecognitionException, TokenStreamException {
   
    returnAST = null;
    ASTPair currentAST = new ASTPair();
    AST expressionStatementNoCheck_AST = null;
    AST head_AST = null;
    AST cmd_AST = null;
    boolean isPathExpr = false;
   
    expression(LC_STMT);
    head_AST = (AST)returnAST;
    astFactory.addASTChild(currentAST, returnAST);
    if ( inputState.guessing==0 ) {
      isPathExpr = (head_AST == lastPathExpression);
    }
    {
    if (((_tokenSet_70.member(LA(1))) && (_tokenSet_71.member(LA(2))))&&(LA(1)!=LITERAL_else && isPathExpr /*&& #head.getType()==METHOD_CALL*/)) {
      commandArgumentsGreedy(head_AST);
      cmd_AST = (AST)returnAST;
      if ( inputState.guessing==0 ) {
        expressionStatementNoCheck_AST = (AST)currentAST.root;
       
        expressionStatementNoCheck_AST = cmd_AST;
       
        currentAST.root = expressionStatementNoCheck_AST;
        currentAST.child = expressionStatementNoCheck_AST!=null &&expressionStatementNoCheck_AST.getFirstChild()!=null ?
          expressionStatementNoCheck_AST.getFirstChild() : expressionStatementNoCheck_AST;
        currentAST.advanceChildToEnd();
      }
    }
    else if ((_tokenSet_70.member(LA(1))) && (_tokenSet_71.member(LA(2)))) {
    }
    else {
View Full Code Here

 
/** A formal parameter for a method or closure. */
  public final void parameterDeclaration() throws RecognitionException, TokenStreamException {
   
    returnAST = null;
    ASTPair currentAST = new ASTPair();
    AST parameterDeclaration_AST = null;
    AST pm_AST = null;
    AST t_AST = null;
    Token  id = null;
    AST id_AST = null;
    AST exp_AST = null;
    Token first = LT(1);boolean spreadParam = false;
   
    parameterModifiersOpt();
    pm_AST = (AST)returnAST;
    {
    if ((_tokenSet_24.member(LA(1))) && (_tokenSet_72.member(LA(2)))) {
      typeSpec(false);
      t_AST = (AST)returnAST;
    }
    else if ((LA(1)==IDENT||LA(1)==TRIPLE_DOT) && (_tokenSet_73.member(LA(2)))) {
    }
    else {
      throw new NoViableAltException(LT(1), getFilename());
    }
   
    }
    {
    switch ( LA(1)) {
    case TRIPLE_DOT:
    {
      match(TRIPLE_DOT);
      if ( inputState.guessing==0 ) {
        spreadParam = true;
      }
      break;
    }
    case IDENT:
    {
      break;
    }
    default:
    {
      throw new NoViableAltException(LT(1), getFilename());
    }
    }
    }
    id = LT(1);
    id_AST = astFactory.create(id);
    match(IDENT);
    {
    switch ( LA(1)) {
    case ASSIGN:
    {
      varInitializer();
      exp_AST = (AST)returnAST;
      break;
    }
    case COMMA:
    case RPAREN:
    case CLOSABLE_BLOCK_OP:
    case NLS:
    {
      break;
    }
    default:
    {
      throw new NoViableAltException(LT(1), getFilename());
    }
    }
    }
    if ( inputState.guessing==0 ) {
      parameterDeclaration_AST = (AST)currentAST.root;
     
      if (spreadParam) {
      parameterDeclaration_AST = (AST)astFactory.make( (new ASTArray(5)).add(create(VARIABLE_PARAMETER_DEF,"VARIABLE_PARAMETER_DEF",first,LT(1))).add(pm_AST).add((AST)astFactory.make( (new ASTArray(2)).add(create(TYPE,"TYPE",first,LT(1))).add(t_AST))).add(id_AST).add(exp_AST));
      } else {
      parameterDeclaration_AST = (AST)astFactory.make( (new ASTArray(5)).add(create(PARAMETER_DEF,"PARAMETER_DEF",first,LT(1))).add(pm_AST).add((AST)astFactory.make( (new ASTArray(2)).add(create(TYPE,"TYPE",first,LT(1))).add(t_AST))).add(id_AST).add(exp_AST));
      }
     
      currentAST.root = parameterDeclaration_AST;
      currentAST.child = parameterDeclaration_AST!=null &&parameterDeclaration_AST.getFirstChild()!=null ?
        parameterDeclaration_AST.getFirstChild() : parameterDeclaration_AST;
      currentAST.advanceChildToEnd();
    }
    returnAST = parameterDeclaration_AST;
  }
View Full Code Here

  }
 
  public final void parameterModifiersOpt() throws RecognitionException, TokenStreamException {
   
    returnAST = null;
    ASTPair currentAST = new ASTPair();
    AST parameterModifiersOpt_AST = null;
    Token first = LT(1);int seenDef = 0;
   
    {
    _loop263:
    do {
      switch ( LA(1)) {
      case FINAL:
      {
        AST tmp212_AST = null;
        tmp212_AST = astFactory.create(LT(1));
        astFactory.addASTChild(currentAST, tmp212_AST);
        match(FINAL);
        nls();
        break;
      }
      case AT:
      {
        annotation();
        astFactory.addASTChild(currentAST, returnAST);
        nls();
        break;
      }
      default:
        if (((LA(1)==LITERAL_def))&&(seenDef++ == 0)) {
          match(LITERAL_def);
          nls();
        }
      else {
        break _loop263;
      }
      }
    } while (true);
    }
    if ( inputState.guessing==0 ) {
      parameterModifiersOpt_AST = (AST)currentAST.root;
      parameterModifiersOpt_AST = (AST)astFactory.make( (new ASTArray(2)).add(create(MODIFIERS,"MODIFIERS",first,LT(1))).add(parameterModifiersOpt_AST));
      currentAST.root = parameterModifiersOpt_AST;
      currentAST.child = parameterModifiersOpt_AST!=null &&parameterModifiersOpt_AST.getFirstChild()!=null ?
        parameterModifiersOpt_AST.getFirstChild() : parameterModifiersOpt_AST;
      currentAST.advanceChildToEnd();
    }
    parameterModifiersOpt_AST = (AST)currentAST.root;
    returnAST = parameterModifiersOpt_AST;
  }
View Full Code Here

  public final void closableBlockParamsOpt(
    boolean addImplicit
  ) throws RecognitionException, TokenStreamException {
   
    returnAST = null;
    ASTPair currentAST = new ASTPair();
    AST closableBlockParamsOpt_AST = null;
   
    boolean synPredMatched266 = false;
    if (((_tokenSet_74.member(LA(1))) && (_tokenSet_75.member(LA(2))))) {
      int _m266 = mark();
View Full Code Here

*  or if the parameter list should be empty.
*/
  public final void implicitParameters() throws RecognitionException, TokenStreamException {
   
    returnAST = null;
    ASTPair currentAST = new ASTPair();
    AST implicitParameters_AST = null;
    Token first = LT(1);
   
    if ( inputState.guessing==0 ) {
      implicitParameters_AST = (AST)currentAST.root;
      implicitParameters_AST = (AST)astFactory.make( (new ASTArray(1)).add(create(IMPLICIT_PARAMETERS,"IMPLICIT_PARAMETERS",first,LT(1))));
      currentAST.root = implicitParameters_AST;
      currentAST.child = implicitParameters_AST!=null &&implicitParameters_AST.getFirstChild()!=null ?
        implicitParameters_AST.getFirstChild() : implicitParameters_AST;
      currentAST.advanceChildToEnd();
    }
    implicitParameters_AST = (AST)currentAST.root;
    returnAST = implicitParameters_AST;
  }
View Full Code Here

 
/** Lookahead to check whether a block begins with explicit closure arguments. */
  public final void closableBlockParamsStart() throws RecognitionException, TokenStreamException {
   
    returnAST = null;
    ASTPair currentAST = new ASTPair();
    AST closableBlockParamsStart_AST = null;
   
    nls();
    parameterDeclarationList();
    nls();
View Full Code Here

 
/** Simple names, as in {x|...}, are completely equivalent to {(def x)|...}.  Build the right AST. */
  public final void closableBlockParam() throws RecognitionException, TokenStreamException {
   
    returnAST = null;
    ASTPair currentAST = new ASTPair();
    AST closableBlockParam_AST = null;
    Token  id = null;
    AST id_AST = null;
    Token first = LT(1);
   
    id = LT(1);
    id_AST = astFactory.create(id);
    match(IDENT);
    if ( inputState.guessing==0 ) {
      closableBlockParam_AST = (AST)currentAST.root;
      closableBlockParam_AST = (AST)astFactory.make( (new ASTArray(4)).add(create(PARAMETER_DEF,"PARAMETER_DEF",first,LT(1))).add((AST)astFactory.make( (new ASTArray(1)).add(create(MODIFIERS,"MODIFIERS",first,LT(1))))).add((AST)astFactory.make( (new ASTArray(1)).add(create(TYPE,"TYPE",first,LT(1))))).add(id_AST));
      currentAST.root = closableBlockParam_AST;
      currentAST.child = closableBlockParam_AST!=null &&closableBlockParam_AST.getFirstChild()!=null ?
        closableBlockParam_AST.getFirstChild() : closableBlockParam_AST;
      currentAST.advanceChildToEnd();
    }
    returnAST = closableBlockParam_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.