// $ANTLR 2.7.4: "Tests.g" -> "TestsParser.java"$ package cz.muni.fi.bronchus.antlrparsers; import antlr.TokenBuffer; import antlr.TokenStreamException; import antlr.TokenStreamIOException; import antlr.ANTLRException; import antlr.LLkParser; import antlr.Token; import antlr.TokenStream; import antlr.RecognitionException; import antlr.NoViableAltException; import antlr.MismatchedTokenException; import antlr.SemanticException; import antlr.ParserSharedInputState; import antlr.collections.impl.BitSet; import antlr.collections.AST; import java.util.Hashtable; import antlr.ASTFactory; import antlr.ASTPair; import antlr.collections.impl.ASTArray; public class TestsParser extends antlr.LLkParser implements TestsParserTokenTypes { protected TestsParser(TokenBuffer tokenBuf, int k) { super(tokenBuf,k); tokenNames = _tokenNames; buildTokenTypeASTClassMap(); astFactory = new ASTFactory(getTokenTypeToASTClassMap()); } public TestsParser(TokenBuffer tokenBuf) { this(tokenBuf,2); } protected TestsParser(TokenStream lexer, int k) { super(lexer,k); tokenNames = _tokenNames; buildTokenTypeASTClassMap(); astFactory = new ASTFactory(getTokenTypeToASTClassMap()); } public TestsParser(TokenStream lexer) { this(lexer,2); } public TestsParser(ParserSharedInputState state) { super(state,2); tokenNames = _tokenNames; buildTokenTypeASTClassMap(); astFactory = new ASTFactory(getTokenTypeToASTClassMap()); } public final void expr() throws RecognitionException, TokenStreamException { returnAST = null; ASTPair currentAST = new ASTPair(); AST expr_AST = null; expression2(); astFactory.addASTChild(currentAST, returnAST); AST tmp1_AST = null; tmp1_AST = astFactory.create(LT(1)); astFactory.makeASTRoot(currentAST, tmp1_AST); match(SEMI); expr_AST = (AST)currentAST.root; returnAST = expr_AST; } public final void expression2() throws RecognitionException, TokenStreamException { returnAST = null; ASTPair currentAST = new ASTPair(); AST expression2_AST = null; or_expression(); astFactory.addASTChild(currentAST, returnAST); expression2_AST = (AST)currentAST.root; returnAST = expression2_AST; } public final void or_expression() throws RecognitionException, TokenStreamException { returnAST = null; ASTPair currentAST = new ASTPair(); AST or_expression_AST = null; and_expression(); astFactory.addASTChild(currentAST, returnAST); { _loop5: do { if ((LA(1)==OR)) { AST tmp2_AST = null; tmp2_AST = astFactory.create(LT(1)); astFactory.makeASTRoot(currentAST, tmp2_AST); match(OR); and_expression(); astFactory.addASTChild(currentAST, returnAST); } else { break _loop5; } } while (true); } or_expression_AST = (AST)currentAST.root; returnAST = or_expression_AST; } public final void and_expression() throws RecognitionException, TokenStreamException { returnAST = null; ASTPair currentAST = new ASTPair(); AST and_expression_AST = null; relational_expression(); astFactory.addASTChild(currentAST, returnAST); { _loop8: do { if ((LA(1)==AND)) { AST tmp3_AST = null; tmp3_AST = astFactory.create(LT(1)); astFactory.makeASTRoot(currentAST, tmp3_AST); match(AND); relational_expression(); astFactory.addASTChild(currentAST, returnAST); } else { break _loop8; } } while (true); } and_expression_AST = (AST)currentAST.root; returnAST = and_expression_AST; } public final void relational_expression() throws RecognitionException, TokenStreamException { returnAST = null; ASTPair currentAST = new ASTPair(); AST relational_expression_AST = null; switch ( LA(1)) { case LETTER: { AST tmp4_AST = null; tmp4_AST = astFactory.create(LT(1)); astFactory.addASTChild(currentAST, tmp4_AST); match(LETTER); { switch ( LA(1)) { case EQUAL: { AST tmp5_AST = null; tmp5_AST = astFactory.create(LT(1)); astFactory.makeASTRoot(currentAST, tmp5_AST); match(EQUAL); break; } case NOTEQUAL: { AST tmp6_AST = null; tmp6_AST = astFactory.create(LT(1)); astFactory.makeASTRoot(currentAST, tmp6_AST); match(NOTEQUAL); break; } case LT: { AST tmp7_AST = null; tmp7_AST = astFactory.create(LT(1)); astFactory.makeASTRoot(currentAST, tmp7_AST); match(LT); break; } case GT: { AST tmp8_AST = null; tmp8_AST = astFactory.create(LT(1)); astFactory.makeASTRoot(currentAST, tmp8_AST); match(GT); break; } case LE: { AST tmp9_AST = null; tmp9_AST = astFactory.create(LT(1)); astFactory.makeASTRoot(currentAST, tmp9_AST); match(LE); break; } case GE: { AST tmp10_AST = null; tmp10_AST = astFactory.create(LT(1)); astFactory.makeASTRoot(currentAST, tmp10_AST); match(GE); break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } } constant(); astFactory.addASTChild(currentAST, returnAST); relational_expression_AST = (AST)currentAST.root; break; } case NOT: case LPAREN: { not_expression(); astFactory.addASTChild(currentAST, returnAST); relational_expression_AST = (AST)currentAST.root; break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } returnAST = relational_expression_AST; } public final void constant() throws RecognitionException, TokenStreamException { returnAST = null; ASTPair currentAST = new ASTPair(); AST constant_AST = null; switch ( LA(1)) { case PLUS: case MINUS: case INT_CONST: case FLT_CONST: case BINARY_INTEGER: case OCTAL_INTEGER: case HEXADECIMAL_INTEGER: { numeric_plusminus_constant(); astFactory.addASTChild(currentAST, returnAST); constant_AST = (AST)currentAST.root; break; } case TRUE_LIT: case FALSE_LIT: { boolean_constant(); astFactory.addASTChild(currentAST, returnAST); constant_AST = (AST)currentAST.root; break; } case STR_CONST: { string_constant(); astFactory.addASTChild(currentAST, returnAST); constant_AST = (AST)currentAST.root; break; } case ORDER_INT_CONST: { order_numeric_constant(); astFactory.addASTChild(currentAST, returnAST); constant_AST = (AST)currentAST.root; break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } returnAST = constant_AST; } public final void not_expression() throws RecognitionException, TokenStreamException { returnAST = null; ASTPair currentAST = new ASTPair(); AST not_expression_AST = null; { switch ( LA(1)) { case NOT: { AST tmp11_AST = null; tmp11_AST = astFactory.create(LT(1)); astFactory.makeASTRoot(currentAST, tmp11_AST); match(NOT); break; } case LPAREN: { break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } } match(LPAREN); expression2(); astFactory.addASTChild(currentAST, returnAST); match(RPAREN); not_expression_AST = (AST)currentAST.root; returnAST = not_expression_AST; } public final void numeric_plusminus_constant() throws RecognitionException, TokenStreamException { returnAST = null; ASTPair currentAST = new ASTPair(); AST numeric_plusminus_constant_AST = null; { switch ( LA(1)) { case PLUS: { AST tmp14_AST = null; tmp14_AST = astFactory.create(LT(1)); astFactory.makeASTRoot(currentAST, tmp14_AST); match(PLUS); break; } case MINUS: { AST tmp15_AST = null; tmp15_AST = astFactory.create(LT(1)); astFactory.makeASTRoot(currentAST, tmp15_AST); match(MINUS); break; } case INT_CONST: case FLT_CONST: case BINARY_INTEGER: case OCTAL_INTEGER: case HEXADECIMAL_INTEGER: { break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } } numeric_constant(); astFactory.addASTChild(currentAST, returnAST); numeric_plusminus_constant_AST = (AST)currentAST.root; returnAST = numeric_plusminus_constant_AST; } public final void boolean_constant() throws RecognitionException, TokenStreamException { returnAST = null; ASTPair currentAST = new ASTPair(); AST boolean_constant_AST = null; switch ( LA(1)) { case TRUE_LIT: { AST tmp16_AST = null; tmp16_AST = astFactory.create(LT(1)); astFactory.addASTChild(currentAST, tmp16_AST); match(TRUE_LIT); boolean_constant_AST = (AST)currentAST.root; break; } case FALSE_LIT: { AST tmp17_AST = null; tmp17_AST = astFactory.create(LT(1)); astFactory.addASTChild(currentAST, tmp17_AST); match(FALSE_LIT); boolean_constant_AST = (AST)currentAST.root; break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } returnAST = boolean_constant_AST; } public final void string_constant() throws RecognitionException, TokenStreamException { returnAST = null; ASTPair currentAST = new ASTPair(); AST string_constant_AST = null; AST tmp18_AST = null; tmp18_AST = astFactory.create(LT(1)); astFactory.addASTChild(currentAST, tmp18_AST); match(STR_CONST); string_constant_AST = (AST)currentAST.root; returnAST = string_constant_AST; } public final void order_numeric_constant() throws RecognitionException, TokenStreamException { returnAST = null; ASTPair currentAST = new ASTPair(); AST order_numeric_constant_AST = null; AST tmp19_AST = null; tmp19_AST = astFactory.create(LT(1)); astFactory.addASTChild(currentAST, tmp19_AST); match(ORDER_INT_CONST); order_numeric_constant_AST = (AST)currentAST.root; returnAST = order_numeric_constant_AST; } public final void numeric_constant() throws RecognitionException, TokenStreamException { returnAST = null; ASTPair currentAST = new ASTPair(); AST numeric_constant_AST = null; switch ( LA(1)) { case INT_CONST: { AST tmp20_AST = null; tmp20_AST = astFactory.create(LT(1)); astFactory.addASTChild(currentAST, tmp20_AST); match(INT_CONST); numeric_constant_AST = (AST)currentAST.root; break; } case FLT_CONST: { AST tmp21_AST = null; tmp21_AST = astFactory.create(LT(1)); astFactory.addASTChild(currentAST, tmp21_AST); match(FLT_CONST); numeric_constant_AST = (AST)currentAST.root; break; } case BINARY_INTEGER: { AST tmp22_AST = null; tmp22_AST = astFactory.create(LT(1)); astFactory.addASTChild(currentAST, tmp22_AST); match(BINARY_INTEGER); numeric_constant_AST = (AST)currentAST.root; break; } case OCTAL_INTEGER: { AST tmp23_AST = null; tmp23_AST = astFactory.create(LT(1)); astFactory.addASTChild(currentAST, tmp23_AST); match(OCTAL_INTEGER); numeric_constant_AST = (AST)currentAST.root; break; } case HEXADECIMAL_INTEGER: { AST tmp24_AST = null; tmp24_AST = astFactory.create(LT(1)); astFactory.addASTChild(currentAST, tmp24_AST); match(HEXADECIMAL_INTEGER); numeric_constant_AST = (AST)currentAST.root; break; } default: { throw new NoViableAltException(LT(1), getFilename()); } } returnAST = numeric_constant_AST; } public static final String[] _tokenNames = { "<0>", "EOF", "<2>", "NULL_TREE_LOOKAHEAD", "SEMI", "OR", "AND", "LETTER", "EQUAL", "NOTEQUAL", "LT", "GT", "LE", "GE", "NOT", "LPAREN", "RPAREN", "PLUS", "MINUS", "ORDER_INT_CONST", "INT_CONST", "FLT_CONST", "BINARY_INTEGER", "OCTAL_INTEGER", "HEXADECIMAL_INTEGER", "TRUE_LIT", "FALSE_LIT", "STR_CONST", "EXPONENT", "WS", "PORADI_INT_CONST" }; protected void buildTokenTypeASTClassMap() { tokenTypeToASTClassMap=null; }; }