public Expression factor() { EnterRule_factor(); EnterRule("factor", 32); TraceIn("factor", 32); Expression expr = default(Expression); IToken LPAREN65 = default(IToken); IToken RPAREN67 = default(IToken); IToken INT68 = default(IToken); IToken REALNUM69 = default(IToken); List<IToken> dottedIdentifier64 = default(List<IToken>); Expression expression66 = default(Expression); expr = new Expression(); try { DebugEnterRule(GrammarFileName, "factor"); DebugLocation(625, 5); try { // D:\\projects\\repository\\ifmo\\Компиляторы\\PascalCompiler\\PascalCompiler\\Grammar\\Pascal.g:630:6: ( dottedIdentifier | LPAREN expression RPAREN | INT | REALNUM ) int alt38=4; try { DebugEnterDecision(38, false); switch (input.LA(1)) { case ID: { alt38 = 1; } break; case LPAREN: { alt38 = 2; } break; case INT: { alt38 = 3; } break; case REALNUM: { alt38 = 4; } break; default: { NoViableAltException nvae = new NoViableAltException("", 38, 0, input); DebugRecognitionException(nvae); throw nvae; } } } finally { DebugExitDecision(38); } switch (alt38) { case 1: DebugEnterAlt(1); // D:\\projects\\repository\\ifmo\\Компиляторы\\PascalCompiler\\PascalCompiler\\Grammar\\Pascal.g:630:8: dottedIdentifier { DebugLocation(630, 8); PushFollow(Follow._dottedIdentifier_in_factor2398); dottedIdentifier64=dottedIdentifier(); PopFollow(); DebugLocation(631, 7); expr.Append(dottedIdentifier64); } break; case 2: DebugEnterAlt(2); // D:\\projects\\repository\\ifmo\\Компиляторы\\PascalCompiler\\PascalCompiler\\Grammar\\Pascal.g:634:8: LPAREN expression RPAREN { DebugLocation(634, 8); LPAREN65=(IToken)Match(input,LPAREN,Follow._LPAREN_in_factor2415); DebugLocation(634, 15); expr.Append(LPAREN65); DebugLocation(635, 7); PushFollow(Follow._expression_in_factor2425); expression66=expression(); PopFollow(); DebugLocation(635, 18); expr.Append(expression66); DebugLocation(636, 7); RPAREN67=(IToken)Match(input,RPAREN,Follow._RPAREN_in_factor2435); DebugLocation(636, 14); expr.Append(RPAREN67); } break; case 3: DebugEnterAlt(3); // D:\\projects\\repository\\ifmo\\Компиляторы\\PascalCompiler\\PascalCompiler\\Grammar\\Pascal.g:637:9: INT { DebugLocation(637, 9); INT68=(IToken)Match(input,INT,Follow._INT_in_factor2447); DebugLocation(637, 13); expr.Append(INT68); } break; case 4: DebugEnterAlt(4); // D:\\projects\\repository\\ifmo\\Компиляторы\\PascalCompiler\\PascalCompiler\\Grammar\\Pascal.g:638:9: REALNUM { DebugLocation(638, 9); REALNUM69=(IToken)Match(input,REALNUM,Follow._REALNUM_in_factor2459); DebugLocation(638, 17); expr.Append(REALNUM69); } break; } } catch (RecognitionException e) { throw e; } finally { TraceOut("factor", 32); LeaveRule("factor", 32); LeaveRule_factor(); } DebugLocation(639, 5); } finally { DebugExitRule(GrammarFileName, "factor"); } return expr; }
public Expression term() { EnterRule_term(); EnterRule("term", 30); TraceIn("term", 30); Expression expr = default(Expression); IToken STAR59 = default(IToken); IToken SLASH60 = default(IToken); Expression s = default(Expression); Expression f = default(Expression); expr = new Expression(); try { DebugEnterRule(GrammarFileName, "term"); DebugLocation(589, 5); try { // D:\\projects\\repository\\ifmo\\Компиляторы\\PascalCompiler\\PascalCompiler\\Grammar\\Pascal.g:594:2: (s= signedFactor ( ( STAR | SLASH ) f= signedFactor )* ) DebugEnterAlt(1); // D:\\projects\\repository\\ifmo\\Компиляторы\\PascalCompiler\\PascalCompiler\\Grammar\\Pascal.g:594:4: s= signedFactor ( ( STAR | SLASH ) f= signedFactor )* { DebugLocation(594, 6); PushFollow(Follow._signedFactor_in_term2239); s=signedFactor(); PopFollow(); DebugLocation(595, 3); expr.Append(s); DebugLocation(598, 3); // D:\\projects\\repository\\ifmo\\Компиляторы\\PascalCompiler\\PascalCompiler\\Grammar\\Pascal.g:598:3: ( ( STAR | SLASH ) f= signedFactor )* try { DebugEnterSubRule(36); while (true) { int alt36=2; try { DebugEnterDecision(36, false); int LA36_0 = input.LA(1); if ((LA36_0==SLASH||LA36_0==STAR)) { alt36 = 1; } } finally { DebugExitDecision(36); } switch ( alt36 ) { case 1: DebugEnterAlt(1); // D:\\projects\\repository\\ifmo\\Компиляторы\\PascalCompiler\\PascalCompiler\\Grammar\\Pascal.g:598:5: ( STAR | SLASH ) f= signedFactor { DebugLocation(598, 5); // D:\\projects\\repository\\ifmo\\Компиляторы\\PascalCompiler\\PascalCompiler\\Grammar\\Pascal.g:598:5: ( STAR | SLASH ) int alt35=2; try { DebugEnterSubRule(35); try { DebugEnterDecision(35, false); int LA35_0 = input.LA(1); if ((LA35_0==STAR)) { alt35 = 1; } else if ((LA35_0==SLASH)) { alt35 = 2; } else { NoViableAltException nvae = new NoViableAltException("", 35, 0, input); DebugRecognitionException(nvae); throw nvae; } } finally { DebugExitDecision(35); } switch (alt35) { case 1: DebugEnterAlt(1); // D:\\projects\\repository\\ifmo\\Компиляторы\\PascalCompiler\\PascalCompiler\\Grammar\\Pascal.g:599:3: STAR { DebugLocation(599, 3); STAR59=(IToken)Match(input,STAR,Follow._STAR_in_term2254); DebugLocation(599, 8); expr.Append(STAR59); } break; case 2: DebugEnterAlt(2); // D:\\projects\\repository\\ifmo\\Компиляторы\\PascalCompiler\\PascalCompiler\\Grammar\\Pascal.g:600:5: SLASH { DebugLocation(600, 5); SLASH60=(IToken)Match(input,SLASH,Follow._SLASH_in_term2262); DebugLocation(600, 11); expr.Append(SLASH60); } break; } } finally { DebugExitSubRule(35); } DebugLocation(602, 5); PushFollow(Follow._signedFactor_in_term2277); f=signedFactor(); PopFollow(); DebugLocation(603, 3); expr.Append(f); } break; default: goto loop36; } } loop36: ; } finally { DebugExitSubRule(36); } } } catch (RecognitionException e) { throw e; } finally { TraceOut("term", 30); LeaveRule("term", 30); LeaveRule_term(); } DebugLocation(607, 5); } finally { DebugExitRule(GrammarFileName, "term"); } return expr; }
public Expression signedFactor() { EnterRule_signedFactor(); EnterRule("signedFactor", 31); TraceIn("signedFactor", 31); Expression expr = default(Expression); IToken PLUS61 = default(IToken); IToken MINUS62 = default(IToken); Expression factor63 = default(Expression); expr = new Expression(); try { DebugEnterRule(GrammarFileName, "signedFactor"); DebugLocation(610, 5); try { // D:\\projects\\repository\\ifmo\\Компиляторы\\PascalCompiler\\PascalCompiler\\Grammar\\Pascal.g:615:6: ( ( PLUS | MINUS )? factor ) DebugEnterAlt(1); // D:\\projects\\repository\\ifmo\\Компиляторы\\PascalCompiler\\PascalCompiler\\Grammar\\Pascal.g:615:8: ( PLUS | MINUS )? factor { DebugLocation(615, 8); // D:\\projects\\repository\\ifmo\\Компиляторы\\PascalCompiler\\PascalCompiler\\Grammar\\Pascal.g:615:8: ( PLUS | MINUS )? int alt37=3; try { DebugEnterSubRule(37); try { DebugEnterDecision(37, false); int LA37_0 = input.LA(1); if ((LA37_0==PLUS)) { alt37 = 1; } else if ((LA37_0==MINUS)) { alt37 = 2; } } finally { DebugExitDecision(37); } switch (alt37) { case 1: DebugEnterAlt(1); // D:\\projects\\repository\\ifmo\\Компиляторы\\PascalCompiler\\PascalCompiler\\Grammar\\Pascal.g:615:10: PLUS { DebugLocation(615, 10); PLUS61=(IToken)Match(input,PLUS,Follow._PLUS_in_signedFactor2323); DebugLocation(615, 15); expr.Append(PLUS61); } break; case 2: DebugEnterAlt(2); // D:\\projects\\repository\\ifmo\\Компиляторы\\PascalCompiler\\PascalCompiler\\Grammar\\Pascal.g:616:9: MINUS { DebugLocation(616, 9); MINUS62=(IToken)Match(input,MINUS,Follow._MINUS_in_signedFactor2335); DebugLocation(616, 15); expr.Append(MINUS62); } break; } } finally { DebugExitSubRule(37); } DebugLocation(618, 7); PushFollow(Follow._factor_in_signedFactor2355); factor63=factor(); PopFollow(); DebugLocation(619, 7); expr.Append(factor63); } } catch (RecognitionException e) { throw e; } finally { TraceOut("signedFactor", 31); LeaveRule("signedFactor", 31); LeaveRule_signedFactor(); } DebugLocation(622, 5); } finally { DebugExitRule(GrammarFileName, "signedFactor"); } return expr; }
public Expression expression() { EnterRule_expression(); EnterRule("expression", 29); TraceIn("expression", 29); Expression expr = default(Expression); IToken PLUS57 = default(IToken); IToken MINUS58 = default(IToken); Expression s = default(Expression); Expression f = default(Expression); expr = new Expression(); try { DebugEnterRule(GrammarFileName, "expression"); DebugLocation(569, 5); try { // D:\\projects\\repository\\ifmo\\Компиляторы\\PascalCompiler\\PascalCompiler\\Grammar\\Pascal.g:574:6: (s= term ( ( PLUS | MINUS ) f= term )* ) DebugEnterAlt(1); // D:\\projects\\repository\\ifmo\\Компиляторы\\PascalCompiler\\PascalCompiler\\Grammar\\Pascal.g:574:8: s= term ( ( PLUS | MINUS ) f= term )* { DebugLocation(574, 10); PushFollow(Follow._term_in_expression2132); s=term(); PopFollow(); DebugLocation(575, 7); expr.Append(s); DebugLocation(578, 7); // D:\\projects\\repository\\ifmo\\Компиляторы\\PascalCompiler\\PascalCompiler\\Grammar\\Pascal.g:578:7: ( ( PLUS | MINUS ) f= term )* try { DebugEnterSubRule(34); while (true) { int alt34=2; try { DebugEnterDecision(34, false); int LA34_0 = input.LA(1); if ((LA34_0==MINUS||LA34_0==PLUS)) { alt34 = 1; } } finally { DebugExitDecision(34); } switch ( alt34 ) { case 1: DebugEnterAlt(1); // D:\\projects\\repository\\ifmo\\Компиляторы\\PascalCompiler\\PascalCompiler\\Grammar\\Pascal.g:578:9: ( PLUS | MINUS ) f= term { DebugLocation(578, 9); // D:\\projects\\repository\\ifmo\\Компиляторы\\PascalCompiler\\PascalCompiler\\Grammar\\Pascal.g:578:9: ( PLUS | MINUS ) int alt33=2; try { DebugEnterSubRule(33); try { DebugEnterDecision(33, false); int LA33_0 = input.LA(1); if ((LA33_0==PLUS)) { alt33 = 1; } else if ((LA33_0==MINUS)) { alt33 = 2; } else { NoViableAltException nvae = new NoViableAltException("", 33, 0, input); DebugRecognitionException(nvae); throw nvae; } } finally { DebugExitDecision(33); } switch (alt33) { case 1: DebugEnterAlt(1); // D:\\projects\\repository\\ifmo\\Компиляторы\\PascalCompiler\\PascalCompiler\\Grammar\\Pascal.g:578:11: PLUS { DebugLocation(578, 11); PLUS57=(IToken)Match(input,PLUS,Follow._PLUS_in_expression2152); DebugLocation(578, 16); expr.Append(PLUS57); } break; case 2: DebugEnterAlt(2); // D:\\projects\\repository\\ifmo\\Компиляторы\\PascalCompiler\\PascalCompiler\\Grammar\\Pascal.g:579:9: MINUS { DebugLocation(579, 9); MINUS58=(IToken)Match(input,MINUS,Follow._MINUS_in_expression2164); DebugLocation(579, 15); expr.Append(MINUS58); } break; } } finally { DebugExitSubRule(33); } DebugLocation(581, 9); PushFollow(Follow._term_in_expression2187); f=term(); PopFollow(); DebugLocation(582, 7); expr.Append(f); } break; default: goto loop34; } } loop34: ; } finally { DebugExitSubRule(34); } } } catch (RecognitionException e) { throw e; } finally { TraceOut("expression", 29); LeaveRule("expression", 29); LeaveRule_expression(); } DebugLocation(586, 5); } finally { DebugExitRule(GrammarFileName, "expression"); } return expr; }