Package antlr.collections

Examples of antlr.collections.AST


    boolean caseSensitive, boolean regex
  ) throws RecognitionException, TokenStreamException {
   
    returnAST = null;
    ASTPair currentAST = new ASTPair();
    AST simpleRegularExpression_AST = null;
    Token  var_s = null;
    AST var_s_AST = null;
   
    var_s = LT(1);
    var_s_AST = astFactory.create(var_s);
    astFactory.addASTChild(currentAST, var_s_AST);
    match(FIELDTYPE);
View Full Code Here


 
  public final void searchExpression() throws RecognitionException, TokenStreamException {
   
    returnAST = null;
    ASTPair currentAST = new ASTPair();
    AST searchExpression_AST = null;
   
    condition();
    astFactory.addASTChild(currentAST, returnAST);
    AST tmp1_AST = null;
    tmp1_AST = astFactory.create(LT(1));
    astFactory.addASTChild(currentAST, tmp1_AST);
    match(Token.EOF_TYPE);
    searchExpression_AST = currentAST.root;
    returnAST = searchExpression_AST;
View Full Code Here

 
  public final void condition() throws RecognitionException, TokenStreamException {
   
    returnAST = null;
    ASTPair currentAST = new ASTPair();
    AST condition_AST = null;
   
    boolean synPredMatched80 = false;
    if (((_tokenSet_0.member(LA(1))) && (_tokenSet_1.member(LA(2))) && (_tokenSet_1.member(LA(3))))) {
      int _m80 = mark();
      synPredMatched80 = true;
      inputState.guessing++;
      try {
        {
        expression();
        match(LITERAL_and);
        condition();
        }
      }
      catch (RecognitionException pe) {
        synPredMatched80 = false;
      }
      rewind(_m80);
inputState.guessing--;
    }
    if ( synPredMatched80 ) {
      expression();
      astFactory.addASTChild(currentAST, returnAST);
      match(LITERAL_and);
      condition();
      astFactory.addASTChild(currentAST, returnAST);
      if ( inputState.guessing==0 ) {
        condition_AST = currentAST.root;
        condition_AST = astFactory.make( (new ASTArray(2)).add(astFactory.create(And)).add(condition_AST));
        currentAST.root = condition_AST;
        currentAST.child = condition_AST!=null &&condition_AST.getFirstChild()!=null ?
          condition_AST.getFirstChild() : condition_AST;
        currentAST.advanceChildToEnd();
      }
      condition_AST = currentAST.root;
    }
    else {
      boolean synPredMatched82 = false;
      if (((_tokenSet_0.member(LA(1))) && (_tokenSet_1.member(LA(2))) && (_tokenSet_1.member(LA(3))))) {
        int _m82 = mark();
        synPredMatched82 = true;
        inputState.guessing++;
        try {
          {
          expression();
          match(LITERAL_or);
          condition();
          }
        }
        catch (RecognitionException pe) {
          synPredMatched82 = false;
        }
        rewind(_m82);
inputState.guessing--;
      }
      if ( synPredMatched82 ) {
        expression();
        astFactory.addASTChild(currentAST, returnAST);
        match(LITERAL_or);
        condition();
        astFactory.addASTChild(currentAST, returnAST);
        if ( inputState.guessing==0 ) {
          condition_AST = currentAST.root;
          condition_AST = astFactory.make( (new ASTArray(2)).add(astFactory.create(Or)).add(condition_AST));
          currentAST.root = condition_AST;
          currentAST.child = condition_AST!=null &&condition_AST.getFirstChild()!=null ?
            condition_AST.getFirstChild() : condition_AST;
          currentAST.advanceChildToEnd();
        }
        condition_AST = currentAST.root;
      }
      else if ((_tokenSet_0.member(LA(1))) && (_tokenSet_1.member(LA(2))) && (_tokenSet_1.member(LA(3)))) {
View Full Code Here

   
  public final void expression() throws RecognitionException, TokenStreamException {
   
    returnAST = null;
    ASTPair currentAST = new ASTPair();
    AST expression_AST = null;
   
    switch ( LA(1)) {
    case STRING:
    case FIELDTYPE:
    {
      expressionSearch();
      astFactory.addASTChild(currentAST, returnAST);
      expression_AST = currentAST.root;
      break;
    }
    case LPAREN:
    {
      match(LPAREN);
      condition();
      astFactory.addASTChild(currentAST, returnAST);
      match(RPAREN);
      expression_AST = currentAST.root;
      break;
    }
    default:
      if ((LA(1)==LITERAL_not) && (LA(2)==STRING||LA(2)==FIELDTYPE)) {
        match(LITERAL_not);
        expressionSearch();
        astFactory.addASTChild(currentAST, returnAST);
        if ( inputState.guessing==0 ) {
          expression_AST = currentAST.root;
          expression_AST = astFactory.make( (new ASTArray(2)).add(astFactory.create(Not)).add(expression_AST));
          currentAST.root = expression_AST;
          currentAST.child = expression_AST!=null &&expression_AST.getFirstChild()!=null ?
            expression_AST.getFirstChild() : expression_AST;
          currentAST.advanceChildToEnd();
        }
        expression_AST = currentAST.root;
      }
      else if ((LA(1)==LITERAL_not) && (LA(2)==LPAREN)) {
        match(LITERAL_not);
        match(LPAREN);
        condition();
        astFactory.addASTChild(currentAST, returnAST);
        match(RPAREN);
        if ( inputState.guessing==0 ) {
          expression_AST = currentAST.root;
          expression_AST = astFactory.make( (new ASTArray(2)).add(astFactory.create(Not)).add(expression_AST));
          currentAST.root = expression_AST;
          currentAST.child = expression_AST!=null &&expression_AST.getFirstChild()!=null ?
            expression_AST.getFirstChild() : expression_AST;
          currentAST.advanceChildToEnd();
        }
        expression_AST = currentAST.root;
      }
    else {
View Full Code Here

 
  public final void expressionSearch() throws RecognitionException, TokenStreamException {
   
    returnAST = null;
    ASTPair currentAST = new ASTPair();
    AST expressionSearch_AST = null;
   
    if ((LA(1)==STRING) && (_tokenSet_2.member(LA(2))) && (LA(3)==STRING)) {
      quotedRegularExpression(false,true);
      astFactory.addASTChild(currentAST, returnAST);
      compareType();
      astFactory.addASTChild(currentAST, returnAST);
      quotedRegularExpression(caseSensitive,regex);
      astFactory.addASTChild(currentAST, returnAST);
      if ( inputState.guessing==0 ) {
        expressionSearch_AST = currentAST.root;
        expressionSearch_AST = astFactory.make( (new ASTArray(2)).add(astFactory.create(ExpressionSearch)).add(expressionSearch_AST));
        currentAST.root = expressionSearch_AST;
        currentAST.child = expressionSearch_AST!=null &&expressionSearch_AST.getFirstChild()!=null ?
          expressionSearch_AST.getFirstChild() : expressionSearch_AST;
        currentAST.advanceChildToEnd();
      }
      expressionSearch_AST = currentAST.root;
    }
    else if ((LA(1)==FIELDTYPE) && (_tokenSet_2.member(LA(2))) && (LA(3)==STRING)) {
      simpleRegularExpression(false,true);
      astFactory.addASTChild(currentAST, returnAST);
      compareType();
      astFactory.addASTChild(currentAST, returnAST);
      quotedRegularExpression(caseSensitive,regex);
      astFactory.addASTChild(currentAST, returnAST);
      if ( inputState.guessing==0 ) {
        expressionSearch_AST = currentAST.root;
        expressionSearch_AST = astFactory.make( (new ASTArray(2)).add(astFactory.create(ExpressionSearch)).add(expressionSearch_AST));
        currentAST.root = expressionSearch_AST;
        currentAST.child = expressionSearch_AST!=null &&expressionSearch_AST.getFirstChild()!=null ?
          expressionSearch_AST.getFirstChild() : expressionSearch_AST;
        currentAST.advanceChildToEnd();
      }
      expressionSearch_AST = currentAST.root;
    }
    else if ((LA(1)==FIELDTYPE) && (_tokenSet_2.member(LA(2))) && (LA(3)==FIELDTYPE)) {
      simpleRegularExpression(false,true);
      astFactory.addASTChild(currentAST, returnAST);
      compareType();
      astFactory.addASTChild(currentAST, returnAST);
      simpleRegularExpression(caseSensitive,regex);
      astFactory.addASTChild(currentAST, returnAST);
      if ( inputState.guessing==0 ) {
        expressionSearch_AST = currentAST.root;
        expressionSearch_AST = astFactory.make( (new ASTArray(2)).add(astFactory.create(ExpressionSearch)).add(expressionSearch_AST));
        currentAST.root = expressionSearch_AST;
        currentAST.child = expressionSearch_AST!=null &&expressionSearch_AST.getFirstChild()!=null ?
          expressionSearch_AST.getFirstChild() : expressionSearch_AST;
        currentAST.advanceChildToEnd();
      }
      expressionSearch_AST = currentAST.root;
    }
    else if ((LA(1)==STRING) && (_tokenSet_2.member(LA(2))) && (LA(3)==FIELDTYPE)) {
      quotedRegularExpression(false,true);
      astFactory.addASTChild(currentAST, returnAST);
      compareType();
      astFactory.addASTChild(currentAST, returnAST);
      simpleRegularExpression(caseSensitive,regex);
      astFactory.addASTChild(currentAST, returnAST);
      if ( inputState.guessing==0 ) {
        expressionSearch_AST = currentAST.root;
        expressionSearch_AST = astFactory.make( (new ASTArray(2)).add(astFactory.create(ExpressionSearch)).add(expressionSearch_AST));
        currentAST.root = expressionSearch_AST;
        currentAST.child = expressionSearch_AST!=null &&expressionSearch_AST.getFirstChild()!=null ?
          expressionSearch_AST.getFirstChild() : expressionSearch_AST;
        currentAST.advanceChildToEnd();
      }
      expressionSearch_AST = currentAST.root;
    }
    else {
View Full Code Here

 
  public final void compareType() throws RecognitionException, TokenStreamException {
   
    returnAST = null;
    ASTPair currentAST = new ASTPair();
    AST compareType_AST = null;
   
    switch ( LA(1)) {
    case LITERAL_contains:
    {
      AST tmp10_AST = null;
      tmp10_AST = astFactory.create(LT(1));
      astFactory.addASTChild(currentAST, tmp10_AST);
      match(LITERAL_contains);
      compareType_AST = currentAST.root;
      break;
    }
    case LITERAL_matches:
    {
      AST tmp11_AST = null;
      tmp11_AST = astFactory.create(LT(1));
      astFactory.addASTChild(currentAST, tmp11_AST);
      match(LITERAL_matches);
      compareType_AST = currentAST.root;
      break;
    }
    case EQUAL:
    {
      AST tmp12_AST = null;
      tmp12_AST = astFactory.create(LT(1));
      astFactory.addASTChild(currentAST, tmp12_AST);
      match(EQUAL);
      compareType_AST = currentAST.root;
      break;
    }
    case EEQUAL:
    {
      AST tmp13_AST = null;
      tmp13_AST = astFactory.create(LT(1));
      astFactory.addASTChild(currentAST, tmp13_AST);
      match(EEQUAL);
      compareType_AST = currentAST.root;
      break;
    }
    case NEQUAL:
    {
      AST tmp14_AST = null;
      tmp14_AST = astFactory.create(LT(1));
      astFactory.addASTChild(currentAST, tmp14_AST);
      match(NEQUAL);
      compareType_AST = currentAST.root;
      break;
View Full Code Here

    m_searchExpression = searchExpression;
    m_caseSensitive = caseSensitive;
    m_regExp = regExp;

    // create AST
    AST ast = null;
    try {
      SearchExpressionParser parser = new SearchExpressionParser(
          new SearchExpressionLexer(new StringReader(
              m_searchExpression)));
      parser.caseSensitive = m_caseSensitive;
View Full Code Here

}

  public final boolean  tSearchExpression(AST _t) throws RecognitionException, PatternSyntaxException {
    boolean ret = false;

        AST tSearchExpression_AST_in = (_t == ASTNULL) ? null : (AST)_t;
   
      boolean a = false, b = false;
   
   
    try {      // for error handling
      if (_t==null) _t=ASTNULL;
      switch ( _t.getType()) {
      case And:
      {
        AST __t87 = _t;
        AST tmp1_AST_in = _t;
        match(_t,And);
        _t = _t.getFirstChild();
        a=tSearchExpression(_t);
        _t = _retTree;
        {
        if (_t==null) _t=ASTNULL;
        if ((((_t.getType() >= And && _t.getType() <= ExpressionSearch)))&&(a)) {
          b=tSearchExpression(_t);
          _t = _retTree;
        }
        else if (((_t.getType() >= LITERAL_and && _t.getType() <= ExpressionSearch))) {
          AST tmp2_AST_in = _t;
          if ( _t==null ) throw new MismatchedTokenException();
          _t = _t.getNextSibling();
        }
        else {
          throw new NoViableAltException(_t);
        }
       
        }
        _t = __t87;
        _t = _t.getNextSibling();
        ret = a && b;
        break;
      }
      case Or:
      {
        AST __t89 = _t;
        AST tmp3_AST_in = _t;
        match(_t,Or);
        _t = _t.getFirstChild();
        a=tSearchExpression(_t);
        _t = _retTree;
        {
        if (_t==null) _t=ASTNULL;
        if ((((_t.getType() >= And && _t.getType() <= ExpressionSearch)))&&(!a)) {
          b=tSearchExpression(_t);
          _t = _retTree;
        }
        else if (((_t.getType() >= LITERAL_and && _t.getType() <= ExpressionSearch))) {
          AST tmp4_AST_in = _t;
          if ( _t==null ) throw new MismatchedTokenException();
          _t = _t.getNextSibling();
        }
        else {
          throw new NoViableAltException(_t);
        }
       
        }
        _t = __t89;
        _t = _t.getNextSibling();
        ret = a || b;
        break;
      }
      case Not:
      {
        AST __t91 = _t;
        AST tmp5_AST_in = _t;
        match(_t,Not);
        _t = _t.getFirstChild();
        a=tSearchExpression(_t);
        _t = _retTree;
        _t = __t91;
View Full Code Here

  }
 
  public final boolean  tExpressionSearch(AST _t) throws RecognitionException, PatternSyntaxException {
     boolean ret = false;

    AST var_f = null;
    AST var_v = null;
   
      int matchType = 0;
   
   
    try {      // for error handling
      AST __t94 = _t;
      AST tmp6_AST_in = _t;
      match(_t,ExpressionSearch);
      _t = _t.getFirstChild();
      var_f = _t;
      match(_t,RegularExpression);
      _t = _t.getNextSibling();
View Full Code Here

  }
 
  public final int  tSearchType(AST _t) throws RecognitionException {
     int matchType = 0;

        AST tSearchType_AST_in = (_t == ASTNULL) ? null : (AST)_t;
   
    try {      // for error handling
      if (_t==null) _t=ASTNULL;
      switch ( _t.getType()) {
      case LITERAL_contains:
      {
        AST tmp7_AST_in = _t;
        match(_t,LITERAL_contains);
        _t = _t.getNextSibling();
        matchType = MATCH_CONTAINS;
        break;
      }
      case LITERAL_matches:
      {
        AST tmp8_AST_in = _t;
        match(_t,LITERAL_matches);
        _t = _t.getNextSibling();
        matchType = MATCH_EXACT;
        break;
      }
      case EQUAL:
      {
        AST tmp9_AST_in = _t;
        match(_t,EQUAL);
        _t = _t.getNextSibling();
        matchType = MATCH_CONTAINS;
        break;
      }
      case EEQUAL:
      {
        AST tmp10_AST_in = _t;
        match(_t,EEQUAL);
        _t = _t.getNextSibling();
        matchType = MATCH_EXACT;
        break;
      }
      case NEQUAL:
      {
        AST tmp11_AST_in = _t;
        match(_t,NEQUAL);
        _t = _t.getNextSibling();
        matchType = MATCH_DOES_NOT_CONTAIN;
        break;
      }
View Full Code Here

TOP

Related Classes of antlr.collections.AST

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.