private IExprNode expression() { EnterRule_expression(); EnterRule("expression", 10); TraceIn("expression", 10); IExprNode node = default(IExprNode); CommonTree type = default(CommonTree); CommonTree IDENT19 = default(CommonTree); CommonTree INTEGER20 = default(CommonTree); CommonTree IDENT21 = default(CommonTree); IExprNode left = default(IExprNode); IExprNode right = default(IExprNode); IExprNode parameter = default(IExprNode); try { DebugEnterRule(GrammarFileName, "expression"); DebugLocation(101, 0); try { // Grammar\\SimpleCTreeWalker.g:101:36: ( ( ^(type= ADD left= expression right= expression ) | ^(type= SUB left= expression right= expression ) | ^(type= MUL left= expression right= expression ) | ^(type= DIV left= expression right= expression ) | ^(type= MOD left= expression right= expression ) | ^(type= SHIFT_LEFT left= expression right= expression ) | ^(type= SHIFT_RIGHT left= expression right= expression ) | ^(type= ASSIGN left= expression right= expression ) | ^(type= GREATER left= expression right= expression ) | ^(type= GREATER_OR_EQUAL left= expression right= expression ) | ^(type= LESS left= expression right= expression ) | ^(type= LESS_OR_EQUAL left= expression right= expression ) | ^(type= EQUAL left= expression right= expression ) | ^(type= NOT_EQUAL left= expression right= expression ) | ^(type= BOOL_AND left= expression right= expression ) | ^(type= BOOL_OR left= expression right= expression ) | ^(type= BIT_AND left= expression right= expression ) | ^(type= BIT_OR left= expression right= expression ) | ^(type= BIT_XOR left= expression right= expression ) ) | IDENT | INTEGER | ^( FUNC_CALL IDENT ^( PARAM_LIST (parameter= expression )* ) ) ) int alt10=4; try { DebugEnterDecision(10, false); switch (input.LA(1)) { case ADD: case ASSIGN: case BIT_AND: case BIT_OR: case BIT_XOR: case BOOL_AND: case BOOL_OR: case DIV: case EQUAL: case GREATER: case GREATER_OR_EQUAL: case LESS: case LESS_OR_EQUAL: case MOD: case MUL: case NOT_EQUAL: case SHIFT_LEFT: case SHIFT_RIGHT: case SUB: { alt10 = 1; } break; case IDENT: { alt10 = 2; } break; case INTEGER: { alt10 = 3; } break; case FUNC_CALL: { alt10 = 4; } break; default: { NoViableAltException nvae = new NoViableAltException("", 10, 0, input); DebugRecognitionException(nvae); throw nvae; } } } finally { DebugExitDecision(10); } switch (alt10) { case 1: DebugEnterAlt(1); // Grammar\\SimpleCTreeWalker.g:103:2: ( ^(type= ADD left= expression right= expression ) | ^(type= SUB left= expression right= expression ) | ^(type= MUL left= expression right= expression ) | ^(type= DIV left= expression right= expression ) | ^(type= MOD left= expression right= expression ) | ^(type= SHIFT_LEFT left= expression right= expression ) | ^(type= SHIFT_RIGHT left= expression right= expression ) | ^(type= ASSIGN left= expression right= expression ) | ^(type= GREATER left= expression right= expression ) | ^(type= GREATER_OR_EQUAL left= expression right= expression ) | ^(type= LESS left= expression right= expression ) | ^(type= LESS_OR_EQUAL left= expression right= expression ) | ^(type= EQUAL left= expression right= expression ) | ^(type= NOT_EQUAL left= expression right= expression ) | ^(type= BOOL_AND left= expression right= expression ) | ^(type= BOOL_OR left= expression right= expression ) | ^(type= BIT_AND left= expression right= expression ) | ^(type= BIT_OR left= expression right= expression ) | ^(type= BIT_XOR left= expression right= expression ) ) { DebugLocation(103, 2); // Grammar\\SimpleCTreeWalker.g:103:2: ( ^(type= ADD left= expression right= expression ) | ^(type= SUB left= expression right= expression ) | ^(type= MUL left= expression right= expression ) | ^(type= DIV left= expression right= expression ) | ^(type= MOD left= expression right= expression ) | ^(type= SHIFT_LEFT left= expression right= expression ) | ^(type= SHIFT_RIGHT left= expression right= expression ) | ^(type= ASSIGN left= expression right= expression ) | ^(type= GREATER left= expression right= expression ) | ^(type= GREATER_OR_EQUAL left= expression right= expression ) | ^(type= LESS left= expression right= expression ) | ^(type= LESS_OR_EQUAL left= expression right= expression ) | ^(type= EQUAL left= expression right= expression ) | ^(type= NOT_EQUAL left= expression right= expression ) | ^(type= BOOL_AND left= expression right= expression ) | ^(type= BOOL_OR left= expression right= expression ) | ^(type= BIT_AND left= expression right= expression ) | ^(type= BIT_OR left= expression right= expression ) | ^(type= BIT_XOR left= expression right= expression ) ) int alt8=19; try { DebugEnterSubRule(8); try { DebugEnterDecision(8, false); switch (input.LA(1)) { case ADD: { alt8 = 1; } break; case SUB: { alt8 = 2; } break; case MUL: { alt8 = 3; } break; case DIV: { alt8 = 4; } break; case MOD: { alt8 = 5; } break; case SHIFT_LEFT: { alt8 = 6; } break; case SHIFT_RIGHT: { alt8 = 7; } break; case ASSIGN: { alt8 = 8; } break; case GREATER: { alt8 = 9; } break; case GREATER_OR_EQUAL: { alt8 = 10; } break; case LESS: { alt8 = 11; } break; case LESS_OR_EQUAL: { alt8 = 12; } break; case EQUAL: { alt8 = 13; } break; case NOT_EQUAL: { alt8 = 14; } break; case BOOL_AND: { alt8 = 15; } break; case BOOL_OR: { alt8 = 16; } break; case BIT_AND: { alt8 = 17; } break; case BIT_OR: { alt8 = 18; } break; case BIT_XOR: { alt8 = 19; } break; default: { NoViableAltException nvae = new NoViableAltException("", 8, 0, input); DebugRecognitionException(nvae); throw nvae; } } } finally { DebugExitDecision(8); } switch (alt8) { case 1: DebugEnterAlt(1); // Grammar\\SimpleCTreeWalker.g:104:3: ^(type= ADD left= expression right= expression ) { DebugLocation(104, 3); DebugLocation(104, 9); type=(CommonTree)Match(input,ADD,Follow._ADD_in_expression382); Match(input, TokenTypes.Down, null); DebugLocation(104, 18); PushFollow(Follow._expression_in_expression386); left=expression(); PopFollow(); DebugLocation(104, 35); PushFollow(Follow._expression_in_expression390); right=expression(); PopFollow(); Match(input, TokenTypes.Up, null); } break; case 2: DebugEnterAlt(2); // Grammar\\SimpleCTreeWalker.g:105:5: ^(type= SUB left= expression right= expression ) { DebugLocation(105, 5); DebugLocation(105, 11); type=(CommonTree)Match(input,SUB,Follow._SUB_in_expression400); Match(input, TokenTypes.Down, null); DebugLocation(105, 20); PushFollow(Follow._expression_in_expression404); left=expression(); PopFollow(); DebugLocation(105, 37); PushFollow(Follow._expression_in_expression408); right=expression(); PopFollow(); Match(input, TokenTypes.Up, null); } break; case 3: DebugEnterAlt(3); // Grammar\\SimpleCTreeWalker.g:106:5: ^(type= MUL left= expression right= expression ) { DebugLocation(106, 5); DebugLocation(106, 11); type=(CommonTree)Match(input,MUL,Follow._MUL_in_expression418); Match(input, TokenTypes.Down, null); DebugLocation(106, 20); PushFollow(Follow._expression_in_expression422); left=expression(); PopFollow(); DebugLocation(106, 37); PushFollow(Follow._expression_in_expression426); right=expression(); PopFollow(); Match(input, TokenTypes.Up, null); } break; case 4: DebugEnterAlt(4); // Grammar\\SimpleCTreeWalker.g:107:5: ^(type= DIV left= expression right= expression ) { DebugLocation(107, 5); DebugLocation(107, 11); type=(CommonTree)Match(input,DIV,Follow._DIV_in_expression436); Match(input, TokenTypes.Down, null); DebugLocation(107, 20); PushFollow(Follow._expression_in_expression440); left=expression(); PopFollow(); DebugLocation(107, 37); PushFollow(Follow._expression_in_expression444); right=expression(); PopFollow(); Match(input, TokenTypes.Up, null); } break; case 5: DebugEnterAlt(5); // Grammar\\SimpleCTreeWalker.g:108:5: ^(type= MOD left= expression right= expression ) { DebugLocation(108, 5); DebugLocation(108, 11); type=(CommonTree)Match(input,MOD,Follow._MOD_in_expression454); Match(input, TokenTypes.Down, null); DebugLocation(108, 20); PushFollow(Follow._expression_in_expression458); left=expression(); PopFollow(); DebugLocation(108, 37); PushFollow(Follow._expression_in_expression462); right=expression(); PopFollow(); Match(input, TokenTypes.Up, null); } break; case 6: DebugEnterAlt(6); // Grammar\\SimpleCTreeWalker.g:109:5: ^(type= SHIFT_LEFT left= expression right= expression ) { DebugLocation(109, 5); DebugLocation(109, 11); type=(CommonTree)Match(input,SHIFT_LEFT,Follow._SHIFT_LEFT_in_expression472); Match(input, TokenTypes.Down, null); DebugLocation(109, 27); PushFollow(Follow._expression_in_expression476); left=expression(); PopFollow(); DebugLocation(109, 44); PushFollow(Follow._expression_in_expression480); right=expression(); PopFollow(); Match(input, TokenTypes.Up, null); } break; case 7: DebugEnterAlt(7); // Grammar\\SimpleCTreeWalker.g:110:5: ^(type= SHIFT_RIGHT left= expression right= expression ) { DebugLocation(110, 5); DebugLocation(110, 11); type=(CommonTree)Match(input,SHIFT_RIGHT,Follow._SHIFT_RIGHT_in_expression490); Match(input, TokenTypes.Down, null); DebugLocation(110, 28); PushFollow(Follow._expression_in_expression494); left=expression(); PopFollow(); DebugLocation(110, 45); PushFollow(Follow._expression_in_expression498); right=expression(); PopFollow(); Match(input, TokenTypes.Up, null); } break; case 8: DebugEnterAlt(8); // Grammar\\SimpleCTreeWalker.g:111:5: ^(type= ASSIGN left= expression right= expression ) { DebugLocation(111, 5); DebugLocation(111, 11); type=(CommonTree)Match(input,ASSIGN,Follow._ASSIGN_in_expression508); Match(input, TokenTypes.Down, null); DebugLocation(111, 23); PushFollow(Follow._expression_in_expression512); left=expression(); PopFollow(); DebugLocation(111, 40); PushFollow(Follow._expression_in_expression516); right=expression(); PopFollow(); Match(input, TokenTypes.Up, null); } break; case 9: DebugEnterAlt(9); // Grammar\\SimpleCTreeWalker.g:112:5: ^(type= GREATER left= expression right= expression ) { DebugLocation(112, 5); DebugLocation(112, 11); type=(CommonTree)Match(input,GREATER,Follow._GREATER_in_expression526); Match(input, TokenTypes.Down, null); DebugLocation(112, 24); PushFollow(Follow._expression_in_expression530); left=expression(); PopFollow(); DebugLocation(112, 41); PushFollow(Follow._expression_in_expression534); right=expression(); PopFollow(); Match(input, TokenTypes.Up, null); } break; case 10: DebugEnterAlt(10); // Grammar\\SimpleCTreeWalker.g:113:5: ^(type= GREATER_OR_EQUAL left= expression right= expression ) { DebugLocation(113, 5); DebugLocation(113, 11); type=(CommonTree)Match(input,GREATER_OR_EQUAL,Follow._GREATER_OR_EQUAL_in_expression544); Match(input, TokenTypes.Down, null); DebugLocation(113, 33); PushFollow(Follow._expression_in_expression548); left=expression(); PopFollow(); DebugLocation(113, 50); PushFollow(Follow._expression_in_expression552); right=expression(); PopFollow(); Match(input, TokenTypes.Up, null); } break; case 11: DebugEnterAlt(11); // Grammar\\SimpleCTreeWalker.g:114:5: ^(type= LESS left= expression right= expression ) { DebugLocation(114, 5); DebugLocation(114, 11); type=(CommonTree)Match(input,LESS,Follow._LESS_in_expression562); Match(input, TokenTypes.Down, null); DebugLocation(114, 21); PushFollow(Follow._expression_in_expression566); left=expression(); PopFollow(); DebugLocation(114, 38); PushFollow(Follow._expression_in_expression570); right=expression(); PopFollow(); Match(input, TokenTypes.Up, null); } break; case 12: DebugEnterAlt(12); // Grammar\\SimpleCTreeWalker.g:115:5: ^(type= LESS_OR_EQUAL left= expression right= expression ) { DebugLocation(115, 5); DebugLocation(115, 11); type=(CommonTree)Match(input,LESS_OR_EQUAL,Follow._LESS_OR_EQUAL_in_expression580); Match(input, TokenTypes.Down, null); DebugLocation(115, 30); PushFollow(Follow._expression_in_expression584); left=expression(); PopFollow(); DebugLocation(115, 47); PushFollow(Follow._expression_in_expression588); right=expression(); PopFollow(); Match(input, TokenTypes.Up, null); } break; case 13: DebugEnterAlt(13); // Grammar\\SimpleCTreeWalker.g:116:5: ^(type= EQUAL left= expression right= expression ) { DebugLocation(116, 5); DebugLocation(116, 11); type=(CommonTree)Match(input,EQUAL,Follow._EQUAL_in_expression598); Match(input, TokenTypes.Down, null); DebugLocation(116, 22); PushFollow(Follow._expression_in_expression602); left=expression(); PopFollow(); DebugLocation(116, 39); PushFollow(Follow._expression_in_expression606); right=expression(); PopFollow(); Match(input, TokenTypes.Up, null); } break; case 14: DebugEnterAlt(14); // Grammar\\SimpleCTreeWalker.g:117:5: ^(type= NOT_EQUAL left= expression right= expression ) { DebugLocation(117, 5); DebugLocation(117, 11); type=(CommonTree)Match(input,NOT_EQUAL,Follow._NOT_EQUAL_in_expression616); Match(input, TokenTypes.Down, null); DebugLocation(117, 26); PushFollow(Follow._expression_in_expression620); left=expression(); PopFollow(); DebugLocation(117, 43); PushFollow(Follow._expression_in_expression624); right=expression(); PopFollow(); Match(input, TokenTypes.Up, null); } break; case 15: DebugEnterAlt(15); // Grammar\\SimpleCTreeWalker.g:118:5: ^(type= BOOL_AND left= expression right= expression ) { DebugLocation(118, 5); DebugLocation(118, 11); type=(CommonTree)Match(input,BOOL_AND,Follow._BOOL_AND_in_expression634); Match(input, TokenTypes.Down, null); DebugLocation(118, 25); PushFollow(Follow._expression_in_expression638); left=expression(); PopFollow(); DebugLocation(118, 42); PushFollow(Follow._expression_in_expression642); right=expression(); PopFollow(); Match(input, TokenTypes.Up, null); } break; case 16: DebugEnterAlt(16); // Grammar\\SimpleCTreeWalker.g:119:5: ^(type= BOOL_OR left= expression right= expression ) { DebugLocation(119, 5); DebugLocation(119, 11); type=(CommonTree)Match(input,BOOL_OR,Follow._BOOL_OR_in_expression652); Match(input, TokenTypes.Down, null); DebugLocation(119, 24); PushFollow(Follow._expression_in_expression656); left=expression(); PopFollow(); DebugLocation(119, 41); PushFollow(Follow._expression_in_expression660); right=expression(); PopFollow(); Match(input, TokenTypes.Up, null); } break; case 17: DebugEnterAlt(17); // Grammar\\SimpleCTreeWalker.g:120:5: ^(type= BIT_AND left= expression right= expression ) { DebugLocation(120, 5); DebugLocation(120, 11); type=(CommonTree)Match(input,BIT_AND,Follow._BIT_AND_in_expression670); Match(input, TokenTypes.Down, null); DebugLocation(120, 24); PushFollow(Follow._expression_in_expression674); left=expression(); PopFollow(); DebugLocation(120, 41); PushFollow(Follow._expression_in_expression678); right=expression(); PopFollow(); Match(input, TokenTypes.Up, null); } break; case 18: DebugEnterAlt(18); // Grammar\\SimpleCTreeWalker.g:121:5: ^(type= BIT_OR left= expression right= expression ) { DebugLocation(121, 5); DebugLocation(121, 11); type=(CommonTree)Match(input,BIT_OR,Follow._BIT_OR_in_expression688); Match(input, TokenTypes.Down, null); DebugLocation(121, 23); PushFollow(Follow._expression_in_expression692); left=expression(); PopFollow(); DebugLocation(121, 40); PushFollow(Follow._expression_in_expression696); right=expression(); PopFollow(); Match(input, TokenTypes.Up, null); } break; case 19: DebugEnterAlt(19); // Grammar\\SimpleCTreeWalker.g:122:5: ^(type= BIT_XOR left= expression right= expression ) { DebugLocation(122, 5); DebugLocation(122, 11); type=(CommonTree)Match(input,BIT_XOR,Follow._BIT_XOR_in_expression706); Match(input, TokenTypes.Down, null); DebugLocation(122, 24); PushFollow(Follow._expression_in_expression710); left=expression(); PopFollow(); DebugLocation(122, 41); PushFollow(Follow._expression_in_expression714); right=expression(); PopFollow(); Match(input, TokenTypes.Up, null); } break; } } finally { DebugExitSubRule(8); } DebugLocation(123, 4); node = new BinaryExprNode(type.Type, left, right); } break; case 2: DebugEnterAlt(2); // Grammar\\SimpleCTreeWalker.g:148:4: IDENT { DebugLocation(148, 4); IDENT19=(CommonTree)Match(input,IDENT,Follow._IDENT_in_expression728); DebugLocation(148, 10); node = new IdentNode(); (node as IdentNode).Name = IDENT19.Text; } break; case 3: DebugEnterAlt(3); // Grammar\\SimpleCTreeWalker.g:152:4: INTEGER { DebugLocation(152, 4); INTEGER20=(CommonTree)Match(input,INTEGER,Follow._INTEGER_in_expression735); DebugLocation(152, 12); node = new IntegerNode(INTEGER20.Text); } break; case 4: DebugEnterAlt(4); // Grammar\\SimpleCTreeWalker.g:155:4: ^( FUNC_CALL IDENT ^( PARAM_LIST (parameter= expression )* ) ) { DebugLocation(155, 4); DebugLocation(155, 6); Match(input,FUNC_CALL,Follow._FUNC_CALL_in_expression743); DebugLocation(155, 16); List<IExprNode> parameters = new List<IExprNode>(); Match(input, TokenTypes.Down, null); DebugLocation(158, 4); IDENT21=(CommonTree)Match(input,IDENT,Follow._IDENT_in_expression751); DebugLocation(158, 10); if (!FuncDeclsContainer.Contains(new FuncDeclEquatable(IDENT21.Text))) DebugLocation(161, 4); DebugLocation(161, 6); Match(input,PARAM_LIST,Follow._PARAM_LIST_in_expression760); if (input.LA(1) == TokenTypes.Down) { Match(input, TokenTypes.Down, null); DebugLocation(161, 17); // Grammar\\SimpleCTreeWalker.g:161:17: (parameter= expression )* try { DebugEnterSubRule(9); while (true) { int alt9=2; try { DebugEnterDecision(9, false); int LA9_0 = input.LA(1); if (((LA9_0>=ADD && LA9_0<=BIT_AND)||(LA9_0>=BIT_OR && LA9_0<=BOOL_AND)||LA9_0==BOOL_OR||(LA9_0>=DIV && LA9_0<=EQUAL)||LA9_0==FUNC_CALL||(LA9_0>=GREATER && LA9_0<=IDENT)||LA9_0==INTEGER||(LA9_0>=LESS && LA9_0<=NOT_EQUAL)||(LA9_0>=SHIFT_LEFT && LA9_0<=SHIFT_RIGHT)||LA9_0==SUB)) { alt9 = 1; } } finally { DebugExitDecision(9); } switch ( alt9 ) { case 1: DebugEnterAlt(1); // Grammar\\SimpleCTreeWalker.g:161:18: parameter= expression { DebugLocation(161, 27); PushFollow(Follow._expression_in_expression765); parameter=expression(); PopFollow(); DebugLocation(161, 39); parameters.Add(parameter); } break; default: goto loop9; } } loop9: ; } finally { DebugExitSubRule(9); } Match(input, TokenTypes.Up, null); } Match(input, TokenTypes.Up, null); DebugLocation(161, 80); FuncCallNode funcCallNode = new FuncCallNode(); node = funcCallNode; funcCallNode.Function = FuncDeclsContainer.Get(new FuncDeclEquatable(IDENT21.Text)); // Check parameters switch(FuncCallNode.ParameterListMatches(funcCallNode.Function.Parameters, parameters)) { case FuncCallNode.ParameterMatching.ParameterCountMismatch: break; case FuncCallNode.ParameterMatching.ParameterTypeMismatch: break; default: // There is no error so do nothing break; } funcCallNode.Parameters = parameters; } break; } } catch (RecognitionException re) { ReportError(re); Recover(input,re); } finally { TraceOut("expression", 10); LeaveRule("expression", 10); LeaveRule_expression(); } DebugLocation(181, 0); } finally { DebugExitRule(GrammarFileName, "expression"); } return node; }
private IExprNode expression() { EnterRule_expression(); EnterRule("expression", 11); TraceIn("expression", 11); IExprNode node = default(IExprNode); CommonTree type = default(CommonTree); CommonTree IDENT22 = default(CommonTree); CommonTree INTEGER23 = default(CommonTree); CommonTree STRING24 = default(CommonTree); CommonTree IDENT25 = default(CommonTree); IExprNode left = default(IExprNode); IExprNode right = default(IExprNode); IExprNode parameter = default(IExprNode); try { DebugEnterRule(GrammarFileName, "expression"); DebugLocation(118, 0); try { // Grammar\\SimpleCTreeWalker.g:118:36: ( ( ^(type= ADD left= expression right= expression ) | ^(type= SUB left= expression right= expression ) | ^(type= MUL left= expression right= expression ) | ^(type= DIV left= expression right= expression ) | ^(type= MOD left= expression right= expression ) | ^(type= SHIFT_LEFT left= expression right= expression ) | ^(type= SHIFT_RIGHT left= expression right= expression ) | ^(type= ASSIGN left= expression right= expression ) | ^(type= GREATER left= expression right= expression ) | ^(type= GREATER_OR_EQUAL left= expression right= expression ) | ^(type= LESS left= expression right= expression ) | ^(type= LESS_OR_EQUAL left= expression right= expression ) | ^(type= EQUAL left= expression right= expression ) | ^(type= NOT_EQUAL left= expression right= expression ) | ^(type= BOOL_AND left= expression right= expression ) | ^(type= BOOL_OR left= expression right= expression ) | ^(type= BIT_AND left= expression right= expression ) | ^(type= BIT_OR left= expression right= expression ) | ^(type= BIT_XOR left= expression right= expression ) ) | IDENT | INTEGER | STRING | ^( FUNC_CALL IDENT ^( PARAM_LIST (parameter= expression )* ) ) ) int alt11=5; try { DebugEnterDecision(11, false); switch (input.LA(1)) { case ADD: case ASSIGN: case BIT_AND: case BIT_OR: case BIT_XOR: case BOOL_AND: case BOOL_OR: case DIV: case EQUAL: case GREATER: case GREATER_OR_EQUAL: case LESS: case LESS_OR_EQUAL: case MOD: case MUL: case NOT_EQUAL: case SHIFT_LEFT: case SHIFT_RIGHT: case SUB: { alt11 = 1; } break; case IDENT: { alt11 = 2; } break; case INTEGER: { alt11 = 3; } break; case STRING: { alt11 = 4; } break; case FUNC_CALL: { alt11 = 5; } break; default: { NoViableAltException nvae = new NoViableAltException("", 11, 0, input); DebugRecognitionException(nvae); throw nvae; } } } finally { DebugExitDecision(11); } switch (alt11) { case 1: DebugEnterAlt(1); // Grammar\\SimpleCTreeWalker.g:120:2: ( ^(type= ADD left= expression right= expression ) | ^(type= SUB left= expression right= expression ) | ^(type= MUL left= expression right= expression ) | ^(type= DIV left= expression right= expression ) | ^(type= MOD left= expression right= expression ) | ^(type= SHIFT_LEFT left= expression right= expression ) | ^(type= SHIFT_RIGHT left= expression right= expression ) | ^(type= ASSIGN left= expression right= expression ) | ^(type= GREATER left= expression right= expression ) | ^(type= GREATER_OR_EQUAL left= expression right= expression ) | ^(type= LESS left= expression right= expression ) | ^(type= LESS_OR_EQUAL left= expression right= expression ) | ^(type= EQUAL left= expression right= expression ) | ^(type= NOT_EQUAL left= expression right= expression ) | ^(type= BOOL_AND left= expression right= expression ) | ^(type= BOOL_OR left= expression right= expression ) | ^(type= BIT_AND left= expression right= expression ) | ^(type= BIT_OR left= expression right= expression ) | ^(type= BIT_XOR left= expression right= expression ) ) { DebugLocation(120, 2); // Grammar\\SimpleCTreeWalker.g:120:2: ( ^(type= ADD left= expression right= expression ) | ^(type= SUB left= expression right= expression ) | ^(type= MUL left= expression right= expression ) | ^(type= DIV left= expression right= expression ) | ^(type= MOD left= expression right= expression ) | ^(type= SHIFT_LEFT left= expression right= expression ) | ^(type= SHIFT_RIGHT left= expression right= expression ) | ^(type= ASSIGN left= expression right= expression ) | ^(type= GREATER left= expression right= expression ) | ^(type= GREATER_OR_EQUAL left= expression right= expression ) | ^(type= LESS left= expression right= expression ) | ^(type= LESS_OR_EQUAL left= expression right= expression ) | ^(type= EQUAL left= expression right= expression ) | ^(type= NOT_EQUAL left= expression right= expression ) | ^(type= BOOL_AND left= expression right= expression ) | ^(type= BOOL_OR left= expression right= expression ) | ^(type= BIT_AND left= expression right= expression ) | ^(type= BIT_OR left= expression right= expression ) | ^(type= BIT_XOR left= expression right= expression ) ) int alt9=19; try { DebugEnterSubRule(9); try { DebugEnterDecision(9, false); switch (input.LA(1)) { case ADD: { alt9 = 1; } break; case SUB: { alt9 = 2; } break; case MUL: { alt9 = 3; } break; case DIV: { alt9 = 4; } break; case MOD: { alt9 = 5; } break; case SHIFT_LEFT: { alt9 = 6; } break; case SHIFT_RIGHT: { alt9 = 7; } break; case ASSIGN: { alt9 = 8; } break; case GREATER: { alt9 = 9; } break; case GREATER_OR_EQUAL: { alt9 = 10; } break; case LESS: { alt9 = 11; } break; case LESS_OR_EQUAL: { alt9 = 12; } break; case EQUAL: { alt9 = 13; } break; case NOT_EQUAL: { alt9 = 14; } break; case BOOL_AND: { alt9 = 15; } break; case BOOL_OR: { alt9 = 16; } break; case BIT_AND: { alt9 = 17; } break; case BIT_OR: { alt9 = 18; } break; case BIT_XOR: { alt9 = 19; } break; default: { NoViableAltException nvae = new NoViableAltException("", 9, 0, input); DebugRecognitionException(nvae); throw nvae; } } } finally { DebugExitDecision(9); } switch (alt9) { case 1: DebugEnterAlt(1); // Grammar\\SimpleCTreeWalker.g:121:3: ^(type= ADD left= expression right= expression ) { DebugLocation(121, 3); DebugLocation(121, 9); type=(CommonTree)Match(input,ADD,Follow._ADD_in_expression435); Match(input, TokenTypes.Down, null); DebugLocation(121, 18); PushFollow(Follow._expression_in_expression439); left=expression(); PopFollow(); DebugLocation(121, 35); PushFollow(Follow._expression_in_expression443); right=expression(); PopFollow(); Match(input, TokenTypes.Up, null); } break; case 2: DebugEnterAlt(2); // Grammar\\SimpleCTreeWalker.g:122:5: ^(type= SUB left= expression right= expression ) { DebugLocation(122, 5); DebugLocation(122, 11); type=(CommonTree)Match(input,SUB,Follow._SUB_in_expression453); Match(input, TokenTypes.Down, null); DebugLocation(122, 20); PushFollow(Follow._expression_in_expression457); left=expression(); PopFollow(); DebugLocation(122, 37); PushFollow(Follow._expression_in_expression461); right=expression(); PopFollow(); Match(input, TokenTypes.Up, null); } break; case 3: DebugEnterAlt(3); // Grammar\\SimpleCTreeWalker.g:123:5: ^(type= MUL left= expression right= expression ) { DebugLocation(123, 5); DebugLocation(123, 11); type=(CommonTree)Match(input,MUL,Follow._MUL_in_expression471); Match(input, TokenTypes.Down, null); DebugLocation(123, 20); PushFollow(Follow._expression_in_expression475); left=expression(); PopFollow(); DebugLocation(123, 37); PushFollow(Follow._expression_in_expression479); right=expression(); PopFollow(); Match(input, TokenTypes.Up, null); } break; case 4: DebugEnterAlt(4); // Grammar\\SimpleCTreeWalker.g:124:5: ^(type= DIV left= expression right= expression ) { DebugLocation(124, 5); DebugLocation(124, 11); type=(CommonTree)Match(input,DIV,Follow._DIV_in_expression489); Match(input, TokenTypes.Down, null); DebugLocation(124, 20); PushFollow(Follow._expression_in_expression493); left=expression(); PopFollow(); DebugLocation(124, 37); PushFollow(Follow._expression_in_expression497); right=expression(); PopFollow(); Match(input, TokenTypes.Up, null); } break; case 5: DebugEnterAlt(5); // Grammar\\SimpleCTreeWalker.g:125:5: ^(type= MOD left= expression right= expression ) { DebugLocation(125, 5); DebugLocation(125, 11); type=(CommonTree)Match(input,MOD,Follow._MOD_in_expression507); Match(input, TokenTypes.Down, null); DebugLocation(125, 20); PushFollow(Follow._expression_in_expression511); left=expression(); PopFollow(); DebugLocation(125, 37); PushFollow(Follow._expression_in_expression515); right=expression(); PopFollow(); Match(input, TokenTypes.Up, null); } break; case 6: DebugEnterAlt(6); // Grammar\\SimpleCTreeWalker.g:126:5: ^(type= SHIFT_LEFT left= expression right= expression ) { DebugLocation(126, 5); DebugLocation(126, 11); type=(CommonTree)Match(input,SHIFT_LEFT,Follow._SHIFT_LEFT_in_expression525); Match(input, TokenTypes.Down, null); DebugLocation(126, 27); PushFollow(Follow._expression_in_expression529); left=expression(); PopFollow(); DebugLocation(126, 44); PushFollow(Follow._expression_in_expression533); right=expression(); PopFollow(); Match(input, TokenTypes.Up, null); } break; case 7: DebugEnterAlt(7); // Grammar\\SimpleCTreeWalker.g:127:5: ^(type= SHIFT_RIGHT left= expression right= expression ) { DebugLocation(127, 5); DebugLocation(127, 11); type=(CommonTree)Match(input,SHIFT_RIGHT,Follow._SHIFT_RIGHT_in_expression543); Match(input, TokenTypes.Down, null); DebugLocation(127, 28); PushFollow(Follow._expression_in_expression547); left=expression(); PopFollow(); DebugLocation(127, 45); PushFollow(Follow._expression_in_expression551); right=expression(); PopFollow(); Match(input, TokenTypes.Up, null); } break; case 8: DebugEnterAlt(8); // Grammar\\SimpleCTreeWalker.g:128:5: ^(type= ASSIGN left= expression right= expression ) { DebugLocation(128, 5); DebugLocation(128, 11); type=(CommonTree)Match(input,ASSIGN,Follow._ASSIGN_in_expression561); Match(input, TokenTypes.Down, null); DebugLocation(128, 23); PushFollow(Follow._expression_in_expression565); left=expression(); PopFollow(); DebugLocation(128, 40); PushFollow(Follow._expression_in_expression569); right=expression(); PopFollow(); Match(input, TokenTypes.Up, null); } break; case 9: DebugEnterAlt(9); // Grammar\\SimpleCTreeWalker.g:129:5: ^(type= GREATER left= expression right= expression ) { DebugLocation(129, 5); DebugLocation(129, 11); type=(CommonTree)Match(input,GREATER,Follow._GREATER_in_expression579); Match(input, TokenTypes.Down, null); DebugLocation(129, 24); PushFollow(Follow._expression_in_expression583); left=expression(); PopFollow(); DebugLocation(129, 41); PushFollow(Follow._expression_in_expression587); right=expression(); PopFollow(); Match(input, TokenTypes.Up, null); } break; case 10: DebugEnterAlt(10); // Grammar\\SimpleCTreeWalker.g:130:5: ^(type= GREATER_OR_EQUAL left= expression right= expression ) { DebugLocation(130, 5); DebugLocation(130, 11); type=(CommonTree)Match(input,GREATER_OR_EQUAL,Follow._GREATER_OR_EQUAL_in_expression597); Match(input, TokenTypes.Down, null); DebugLocation(130, 33); PushFollow(Follow._expression_in_expression601); left=expression(); PopFollow(); DebugLocation(130, 50); PushFollow(Follow._expression_in_expression605); right=expression(); PopFollow(); Match(input, TokenTypes.Up, null); } break; case 11: DebugEnterAlt(11); // Grammar\\SimpleCTreeWalker.g:131:5: ^(type= LESS left= expression right= expression ) { DebugLocation(131, 5); DebugLocation(131, 11); type=(CommonTree)Match(input,LESS,Follow._LESS_in_expression615); Match(input, TokenTypes.Down, null); DebugLocation(131, 21); PushFollow(Follow._expression_in_expression619); left=expression(); PopFollow(); DebugLocation(131, 38); PushFollow(Follow._expression_in_expression623); right=expression(); PopFollow(); Match(input, TokenTypes.Up, null); } break; case 12: DebugEnterAlt(12); // Grammar\\SimpleCTreeWalker.g:132:5: ^(type= LESS_OR_EQUAL left= expression right= expression ) { DebugLocation(132, 5); DebugLocation(132, 11); type=(CommonTree)Match(input,LESS_OR_EQUAL,Follow._LESS_OR_EQUAL_in_expression633); Match(input, TokenTypes.Down, null); DebugLocation(132, 30); PushFollow(Follow._expression_in_expression637); left=expression(); PopFollow(); DebugLocation(132, 47); PushFollow(Follow._expression_in_expression641); right=expression(); PopFollow(); Match(input, TokenTypes.Up, null); } break; case 13: DebugEnterAlt(13); // Grammar\\SimpleCTreeWalker.g:133:5: ^(type= EQUAL left= expression right= expression ) { DebugLocation(133, 5); DebugLocation(133, 11); type=(CommonTree)Match(input,EQUAL,Follow._EQUAL_in_expression651); Match(input, TokenTypes.Down, null); DebugLocation(133, 22); PushFollow(Follow._expression_in_expression655); left=expression(); PopFollow(); DebugLocation(133, 39); PushFollow(Follow._expression_in_expression659); right=expression(); PopFollow(); Match(input, TokenTypes.Up, null); } break; case 14: DebugEnterAlt(14); // Grammar\\SimpleCTreeWalker.g:134:5: ^(type= NOT_EQUAL left= expression right= expression ) { DebugLocation(134, 5); DebugLocation(134, 11); type=(CommonTree)Match(input,NOT_EQUAL,Follow._NOT_EQUAL_in_expression669); Match(input, TokenTypes.Down, null); DebugLocation(134, 26); PushFollow(Follow._expression_in_expression673); left=expression(); PopFollow(); DebugLocation(134, 43); PushFollow(Follow._expression_in_expression677); right=expression(); PopFollow(); Match(input, TokenTypes.Up, null); } break; case 15: DebugEnterAlt(15); // Grammar\\SimpleCTreeWalker.g:135:5: ^(type= BOOL_AND left= expression right= expression ) { DebugLocation(135, 5); DebugLocation(135, 11); type=(CommonTree)Match(input,BOOL_AND,Follow._BOOL_AND_in_expression687); Match(input, TokenTypes.Down, null); DebugLocation(135, 25); PushFollow(Follow._expression_in_expression691); left=expression(); PopFollow(); DebugLocation(135, 42); PushFollow(Follow._expression_in_expression695); right=expression(); PopFollow(); Match(input, TokenTypes.Up, null); } break; case 16: DebugEnterAlt(16); // Grammar\\SimpleCTreeWalker.g:136:5: ^(type= BOOL_OR left= expression right= expression ) { DebugLocation(136, 5); DebugLocation(136, 11); type=(CommonTree)Match(input,BOOL_OR,Follow._BOOL_OR_in_expression705); Match(input, TokenTypes.Down, null); DebugLocation(136, 24); PushFollow(Follow._expression_in_expression709); left=expression(); PopFollow(); DebugLocation(136, 41); PushFollow(Follow._expression_in_expression713); right=expression(); PopFollow(); Match(input, TokenTypes.Up, null); } break; case 17: DebugEnterAlt(17); // Grammar\\SimpleCTreeWalker.g:137:5: ^(type= BIT_AND left= expression right= expression ) { DebugLocation(137, 5); DebugLocation(137, 11); type=(CommonTree)Match(input,BIT_AND,Follow._BIT_AND_in_expression723); Match(input, TokenTypes.Down, null); DebugLocation(137, 24); PushFollow(Follow._expression_in_expression727); left=expression(); PopFollow(); DebugLocation(137, 41); PushFollow(Follow._expression_in_expression731); right=expression(); PopFollow(); Match(input, TokenTypes.Up, null); } break; case 18: DebugEnterAlt(18); // Grammar\\SimpleCTreeWalker.g:138:5: ^(type= BIT_OR left= expression right= expression ) { DebugLocation(138, 5); DebugLocation(138, 11); type=(CommonTree)Match(input,BIT_OR,Follow._BIT_OR_in_expression741); Match(input, TokenTypes.Down, null); DebugLocation(138, 23); PushFollow(Follow._expression_in_expression745); left=expression(); PopFollow(); DebugLocation(138, 40); PushFollow(Follow._expression_in_expression749); right=expression(); PopFollow(); Match(input, TokenTypes.Up, null); } break; case 19: DebugEnterAlt(19); // Grammar\\SimpleCTreeWalker.g:139:5: ^(type= BIT_XOR left= expression right= expression ) { DebugLocation(139, 5); DebugLocation(139, 11); type=(CommonTree)Match(input,BIT_XOR,Follow._BIT_XOR_in_expression759); Match(input, TokenTypes.Down, null); DebugLocation(139, 24); PushFollow(Follow._expression_in_expression763); left=expression(); PopFollow(); DebugLocation(139, 41); PushFollow(Follow._expression_in_expression767); right=expression(); PopFollow(); Match(input, TokenTypes.Up, null); } break; } } finally { DebugExitSubRule(9); } DebugLocation(140, 4); node = new BinaryExprNode(type.Type, left, right); } break; case 2: DebugEnterAlt(2); // Grammar\\SimpleCTreeWalker.g:165:4: IDENT { DebugLocation(165, 4); IDENT22=(CommonTree)Match(input,IDENT,Follow._IDENT_in_expression781); DebugLocation(165, 10); node = new IdentNode(); (node as IdentNode).Name = IDENT22.Text; } break; case 3: DebugEnterAlt(3); // Grammar\\SimpleCTreeWalker.g:169:4: INTEGER { DebugLocation(169, 4); INTEGER23=(CommonTree)Match(input,INTEGER,Follow._INTEGER_in_expression788); DebugLocation(169, 12); node = new IntegerNode(INTEGER23.Text); } break; case 4: DebugEnterAlt(4); // Grammar\\SimpleCTreeWalker.g:172:4: STRING { DebugLocation(172, 4); STRING24=(CommonTree)Match(input,STRING,Follow._STRING_in_expression795); DebugLocation(172, 11); node = new StringNode(STRING24.Text); } break; case 5: DebugEnterAlt(5); // Grammar\\SimpleCTreeWalker.g:175:4: ^( FUNC_CALL IDENT ^( PARAM_LIST (parameter= expression )* ) ) { DebugLocation(175, 4); DebugLocation(175, 6); Match(input,FUNC_CALL,Follow._FUNC_CALL_in_expression803); DebugLocation(175, 16); List<IExprNode> parameters = new List<IExprNode>(); Match(input, TokenTypes.Down, null); DebugLocation(178, 4); IDENT25=(CommonTree)Match(input,IDENT,Follow._IDENT_in_expression811); DebugLocation(178, 10); if (!FuncDeclsContainer.Contains(new FuncDeclEquatable(IDENT25.Text))) DebugLocation(181, 4); DebugLocation(181, 6); Match(input,PARAM_LIST,Follow._PARAM_LIST_in_expression820); if (input.LA(1) == TokenTypes.Down) { Match(input, TokenTypes.Down, null); DebugLocation(181, 17); // Grammar\\SimpleCTreeWalker.g:181:17: (parameter= expression )* try { DebugEnterSubRule(10); while (true) { int alt10=2; try { DebugEnterDecision(10, false); int LA10_0 = input.LA(1); if (((LA10_0>=ADD && LA10_0<=BIT_AND)||(LA10_0>=BIT_OR && LA10_0<=BOOL_AND)||LA10_0==BOOL_OR||LA10_0==DIV||LA10_0==EQUAL||LA10_0==FUNC_CALL||(LA10_0>=GREATER && LA10_0<=IDENT)||LA10_0==INTEGER||(LA10_0>=LESS && LA10_0<=LESS_OR_EQUAL)||(LA10_0>=MOD && LA10_0<=NOT_EQUAL)||(LA10_0>=SHIFT_LEFT && LA10_0<=SHIFT_RIGHT)||LA10_0==STRING||LA10_0==SUB)) { alt10 = 1; } } finally { DebugExitDecision(10); } switch ( alt10 ) { case 1: DebugEnterAlt(1); // Grammar\\SimpleCTreeWalker.g:181:18: parameter= expression { DebugLocation(181, 27); PushFollow(Follow._expression_in_expression825); parameter=expression(); PopFollow(); DebugLocation(181, 39); parameters.Add(parameter); } break; default: goto loop10; } } loop10: ; } finally { DebugExitSubRule(10); } Match(input, TokenTypes.Up, null); } Match(input, TokenTypes.Up, null); DebugLocation(181, 80); FuncCallNode funcCallNode = new FuncCallNode(); node = funcCallNode; funcCallNode.Function = FuncDeclsContainer.Get(new FuncDeclEquatable(IDENT25.Text)); // Check parameters switch(FuncCallNode.ParameterListMatches(funcCallNode.Function.Parameters, parameters)) { case FuncCallNode.ParameterMatching.ParameterCountMismatch: break; case FuncCallNode.ParameterMatching.ParameterTypeMismatch: break; default: // There is no error so do nothing break; } funcCallNode.Parameters = parameters; } break; } } catch (RecognitionException re) { ReportError(re); Recover(input,re); } finally { TraceOut("expression", 11); LeaveRule("expression", 11); LeaveRule_expression(); } DebugLocation(201, 0); } finally { DebugExitRule(GrammarFileName, "expression"); } return node; }