public virtual string GetErrorMessage(RecognitionException e, string[] tokenNames) { string str1 = e.Message; if (e is UnwantedTokenException) { UnwantedTokenException unwantedTokenException = (UnwantedTokenException)e; string str2 = unwantedTokenException.Expecting != -1 ? tokenNames[unwantedTokenException.Expecting] : "EndOfFile"; str1 = "extraneous input " + this.GetTokenErrorDisplay(unwantedTokenException.UnexpectedToken) + " expecting " + str2; } else if (e is MissingTokenException) { MissingTokenException missingTokenException = (MissingTokenException)e; str1 = "missing " + (missingTokenException.Expecting != -1 ? tokenNames[missingTokenException.Expecting] : "EndOfFile") + " at " + this.GetTokenErrorDisplay(e.Token); } else if (e is MismatchedTokenException) { MismatchedTokenException mismatchedTokenException = (MismatchedTokenException)e; string str2 = mismatchedTokenException.Expecting != -1 ? tokenNames[mismatchedTokenException.Expecting] : "EndOfFile"; str1 = "mismatched input " + this.GetTokenErrorDisplay(e.Token) + " expecting " + str2; } else if (e is MismatchedTreeNodeException) { MismatchedTreeNodeException treeNodeException = (MismatchedTreeNodeException)e; string str2 = treeNodeException.Expecting != -1 ? tokenNames[treeNodeException.Expecting] : "EndOfFile"; str1 = "mismatched tree node: " + (treeNodeException.Node != null ? treeNodeException.Node.ToString() ?? string.Empty : string.Empty) + " expecting " + str2; } else if (e is NoViableAltException) { str1 = "no viable alternative at input " + this.GetTokenErrorDisplay(e.Token); } else if (e is EarlyExitException) { str1 = "required (...)+ loop did not match anything at input " + this.GetTokenErrorDisplay(e.Token); } else if (e is MismatchedSetException) { MismatchedSetException mismatchedSetException = (MismatchedSetException)e; str1 = "mismatched input " + this.GetTokenErrorDisplay(e.Token) + " expecting set " + (object)mismatchedSetException.Expecting; } else if (e is MismatchedNotSetException) { MismatchedNotSetException mismatchedNotSetException = (MismatchedNotSetException)e; str1 = "mismatched input " + this.GetTokenErrorDisplay(e.Token) + " expecting set " + (object)mismatchedNotSetException.Expecting; } else if (e is FailedPredicateException) { FailedPredicateException predicateException = (FailedPredicateException)e; str1 = "rule " + predicateException.RuleName + " failed predicate: {" + predicateException.PredicateText + "}?"; } return(str1); }
public override string GetErrorMessage(RecognitionException e, string[] tokenNames) { string msg = null; if (e is MismatchedTokenException) { MismatchedTokenException mte = (MismatchedTokenException)e; msg = "mismatched character " + GetCharErrorDisplay(e.Character) + " expecting " + GetCharErrorDisplay(mte.Expecting); } else if (e is NoViableAltException) { NoViableAltException nvae = (NoViableAltException)e; // for development, can add "decision=<<"+nvae.grammarDecisionDescription+">>" // and "(decision="+nvae.decisionNumber+") and // "state "+nvae.stateNumber msg = "no viable alternative at character " + GetCharErrorDisplay(e.Character); } else if (e is EarlyExitException) { EarlyExitException eee = (EarlyExitException)e; // for development, can add "(decision="+eee.decisionNumber+")" msg = "required (...)+ loop did not match anything at character " + GetCharErrorDisplay(e.Character); } else if (e is MismatchedNotSetException) { MismatchedNotSetException mse = (MismatchedNotSetException)e; msg = "mismatched character " + GetCharErrorDisplay(e.Character) + " expecting set " + mse.Expecting; } else if (e is MismatchedSetException) { MismatchedSetException mse = (MismatchedSetException)e; msg = "mismatched character " + GetCharErrorDisplay(e.Character) + " expecting set " + mse.Expecting; } else if (e is MismatchedRangeException) { MismatchedRangeException mre = (MismatchedRangeException)e; msg = "mismatched character " + GetCharErrorDisplay(e.Character) + " expecting set " + GetCharErrorDisplay(mre.A) + ".." + GetCharErrorDisplay(mre.B); } else { msg = base.GetErrorMessage(e, tokenNames); } return(msg); }
public override string GetErrorMessage(RecognitionException e, string[] tokenNames) { string str; if (e is MismatchedTokenException) { MismatchedTokenException mismatchedTokenException = (MismatchedTokenException)e; str = "mismatched character " + this.GetCharErrorDisplay(e.Character) + " expecting " + this.GetCharErrorDisplay(mismatchedTokenException.Expecting); } else if (e is NoViableAltException) { str = "no viable alternative at character " + this.GetCharErrorDisplay(e.Character); } else if (e is EarlyExitException) { str = "required (...)+ loop did not match anything at character " + this.GetCharErrorDisplay(e.Character); } else if (e is MismatchedNotSetException) { MismatchedNotSetException mismatchedNotSetException = (MismatchedNotSetException)e; str = "mismatched character " + this.GetCharErrorDisplay(e.Character) + " expecting set " + (object)mismatchedNotSetException.Expecting; } else if (e is MismatchedSetException) { MismatchedSetException mismatchedSetException = (MismatchedSetException)e; str = "mismatched character " + this.GetCharErrorDisplay(e.Character) + " expecting set " + (object)mismatchedSetException.Expecting; } else if (e is MismatchedRangeException) { MismatchedRangeException mismatchedRangeException = (MismatchedRangeException)e; str = "mismatched character " + this.GetCharErrorDisplay(e.Character) + " expecting set " + this.GetCharErrorDisplay(mismatchedRangeException.A) + ".." + this.GetCharErrorDisplay(mismatchedRangeException.B); } else { str = base.GetErrorMessage(e, tokenNames); } return(str); }
// $ANTLR end "TSTOP" // $ANTLR start "WS" public void mWS() // throws RecognitionException [2] { try { int _type = WS; int _channel = DEFAULT_TOKEN_CHANNEL; // C:\\Development\\TT.Net\\TT\\Template.g:23:4: ( ( '\\r' | '\\n' | '\\t' | ' ' )+ ) // C:\\Development\\TT.Net\\TT\\Template.g:23:6: ( '\\r' | '\\n' | '\\t' | ' ' )+ { // C:\\Development\\TT.Net\\TT\\Template.g:23:6: ( '\\r' | '\\n' | '\\t' | ' ' )+ int cnt3 = 0; do { int alt3 = 2; int LA3_0 = input.LA(1); if ( ((LA3_0 >= '\t' && LA3_0 <= '\n') || LA3_0 == '\r' || LA3_0 == ' ') ) { alt3 = 1; } switch (alt3) { case 1 : // C:\\Development\\TT.Net\\TT\\Template.g: { if ( (input.LA(1) >= '\t' && input.LA(1) <= '\n') || input.LA(1) == '\r' || input.LA(1) == ' ' ) { input.Consume(); } else { MismatchedSetException mse = new MismatchedSetException(null,input); Recover(mse); throw mse;} } break; default: if ( cnt3 >= 1 ) goto loop3; EarlyExitException eee3 = new EarlyExitException(3, input); throw eee3; } cnt3++; } while (true); loop3: ; // Stops C# compiler whining that label 'loop3' has no statements _channel=HIDDEN; } state.type = _type; state.channel = _channel; } finally { } }
// $ANTLR start "number" // C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:265:1: number : ( INT | FLOAT ); public number_return number() // throws RecognitionException [1] { var retval = new number_return(); retval.Start = input.LT( 1 ); CommonTree root_0 = null; IToken set93 = null; CommonTree set93_tree = null; try { // C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:266:2: ( INT | FLOAT ) // C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g: { root_0 = (CommonTree)adaptor.GetNilNode(); set93 = input.LT( 1 ); if ( ( input.LA( 1 ) >= INT && input.LA( 1 ) <= FLOAT ) ) { input.Consume(); adaptor.AddChild( root_0, adaptor.Create( set93 ) ); state.errorRecovery = false; } else { var mse = new MismatchedSetException( null, input ); throw mse; } } retval.Stop = input.LT( -1 ); retval.Tree = adaptor.RulePostProcessing( root_0 ); adaptor.SetTokenBoundaries( retval.Tree, (IToken)retval.Start, (IToken)retval.Stop ); } catch ( RecognitionException re ) { ReportError( re ); Recover( input, re ); // Conversion of the second argument necessary, but harmless retval.Tree = adaptor.ErrorNode( input, (IToken)retval.Start, input.LT( -1 ), re ); } finally {} return retval; }
private void mID() { EnterRule_ID(); EnterRule("ID", 6); TraceIn("ID", 6); try { int _type = ID; int _channel = DefaultTokenChannel; // FuncProtoToShim.g:38:4: ( ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* ) DebugEnterAlt(1); // FuncProtoToShim.g:38:6: ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* { DebugLocation(38, 6); if ((input.LA(1)>='A' && input.LA(1)<='Z')||input.LA(1)=='_'||(input.LA(1)>='a' && input.LA(1)<='z')) { input.Consume(); } else { MismatchedSetException mse = new MismatchedSetException(null,input); DebugRecognitionException(mse); Recover(mse); throw mse;} DebugLocation(38, 30); // FuncProtoToShim.g:38:30: ( 'a' .. 'z' | 'A' .. 'Z' | '_' | '0' .. '9' )* try { DebugEnterSubRule(3); while (true) { int alt3=2; try { DebugEnterDecision(3, false); int LA3_0 = input.LA(1); if (((LA3_0>='0' && LA3_0<='9')||(LA3_0>='A' && LA3_0<='Z')||LA3_0=='_'||(LA3_0>='a' && LA3_0<='z'))) { alt3 = 1; } } finally { DebugExitDecision(3); } switch ( alt3 ) { case 1: DebugEnterAlt(1); // FuncProtoToShim.g: { DebugLocation(38, 30); input.Consume(); } break; default: goto loop3; } } loop3: ; } finally { DebugExitSubRule(3); } } state.type = _type; state.channel = _channel; } finally { TraceOut("ID", 6); LeaveRule("ID", 6); LeaveRule_ID(); } }
private AstParserRuleReturnScope<CommonTree, IToken> number() { EnterRule_number(); EnterRule("number", 129); TraceIn("number", 129); AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>(); retval.Start = (IToken)input.LT(1); CommonTree root_0 = default(CommonTree); IToken set427 = default(IToken); CommonTree set427_tree = default(CommonTree); try { DebugEnterRule(GrammarFileName, "number"); DebugLocation(983, 1); try { // AS3.g:983:8: ( HEX_LITERAL | DECIMAL_LITERAL | OCTAL_LITERAL | FLOAT_LITERAL ) DebugEnterAlt(1); // AS3.g: { root_0 = (CommonTree)adaptor.Nil(); DebugLocation(983, 8); set427=(IToken)input.LT(1); if (input.LA(1)==DECIMAL_LITERAL||input.LA(1)==FLOAT_LITERAL||input.LA(1)==HEX_LITERAL||input.LA(1)==OCTAL_LITERAL) { input.Consume(); if (state.backtracking == 0) adaptor.AddChild(root_0, (CommonTree)adaptor.Create(set427)); state.errorRecovery=false;state.failed=false; } else { if (state.backtracking>0) {state.failed=true; return retval;} MismatchedSetException mse = new MismatchedSetException(null,input); DebugRecognitionException(mse); throw mse; } } retval.Stop = (IToken)input.LT(-1); if (state.backtracking == 0) { retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0); adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop); } } catch (RecognitionException re) { ReportError(re); Recover(input,re); retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re); } finally { TraceOut("number", 129); LeaveRule("number", 129); LeaveRule_number(); } DebugLocation(987, 1); } finally { DebugExitRule(GrammarFileName, "number"); } return retval; }
private AstParserRuleReturnScope<CommonTree, IToken> relationalOperator() { EnterRule_relationalOperator(); EnterRule("relationalOperator", 110); TraceIn("relationalOperator", 110); AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>(); retval.Start = (IToken)input.LT(1); CommonTree root_0 = default(CommonTree); IToken set350 = default(IToken); CommonTree set350_tree = default(CommonTree); try { DebugEnterRule(GrammarFileName, "relationalOperator"); DebugLocation(828, 1); try { // AS3.g:829:2: ( LT | GT | LE | GE | IS | AS | 'instanceof' ) DebugEnterAlt(1); // AS3.g: { root_0 = (CommonTree)adaptor.Nil(); DebugLocation(829, 2); set350=(IToken)input.LT(1); if (input.LA(1)==AS||input.LA(1)==GE||input.LA(1)==GT||input.LA(1)==IS||input.LA(1)==LE||input.LA(1)==LT||input.LA(1)==249) { input.Consume(); if (state.backtracking == 0) adaptor.AddChild(root_0, (CommonTree)adaptor.Create(set350)); state.errorRecovery=false;state.failed=false; } else { if (state.backtracking>0) {state.failed=true; return retval;} MismatchedSetException mse = new MismatchedSetException(null,input); DebugRecognitionException(mse); throw mse; } } retval.Stop = (IToken)input.LT(-1); if (state.backtracking == 0) { retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0); adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop); } } catch (RecognitionException re) { ReportError(re); Recover(input,re); retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re); } finally { TraceOut("relationalOperator", 110); LeaveRule("relationalOperator", 110); LeaveRule_relationalOperator(); } DebugLocation(830, 1); } finally { DebugExitRule(GrammarFileName, "relationalOperator"); } return retval; }
private AstParserRuleReturnScope<CommonTree, IToken> assignmentOperator() { EnterRule_assignmentOperator(); EnterRule("assignmentOperator", 97); TraceIn("assignmentOperator", 97); AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>(); retval.Start = (IToken)input.LT(1); CommonTree root_0 = default(CommonTree); IToken set319 = default(IToken); CommonTree set319_tree = default(CommonTree); try { DebugEnterRule(GrammarFileName, "assignmentOperator"); DebugLocation(743, 1); try { // AS3.g:744:2: ( ASSIGN | STAR_ASSIGN | DIV_ASSIGN | MOD_ASSIGN | PLUS_ASSIGN | MINUS_ASSIGN | SL_ASSIGN | SR_ASSIGN | BSR_ASSIGN | BAND_ASSIGN | BXOR_ASSIGN | BOR_ASSIGN | LAND_ASSIGN | LOR_ASSIGN ) DebugEnterAlt(1); // AS3.g: { root_0 = (CommonTree)adaptor.Nil(); DebugLocation(744, 2); set319=(IToken)input.LT(1); if (input.LA(1)==ASSIGN||input.LA(1)==BAND_ASSIGN||input.LA(1)==BOR_ASSIGN||input.LA(1)==BSR_ASSIGN||input.LA(1)==BXOR_ASSIGN||input.LA(1)==DIV_ASSIGN||input.LA(1)==LAND_ASSIGN||input.LA(1)==LOR_ASSIGN||input.LA(1)==MINUS_ASSIGN||input.LA(1)==MOD_ASSIGN||input.LA(1)==PLUS_ASSIGN||input.LA(1)==SL_ASSIGN||input.LA(1)==SR_ASSIGN||input.LA(1)==STAR_ASSIGN) { input.Consume(); if (state.backtracking == 0) adaptor.AddChild(root_0, (CommonTree)adaptor.Create(set319)); state.errorRecovery=false;state.failed=false; } else { if (state.backtracking>0) {state.failed=true; return retval;} MismatchedSetException mse = new MismatchedSetException(null,input); DebugRecognitionException(mse); throw mse; } } retval.Stop = (IToken)input.LT(-1); if (state.backtracking == 0) { retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0); adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop); } } catch (RecognitionException re) { ReportError(re); Recover(input,re); retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re); } finally { TraceOut("assignmentOperator", 97); LeaveRule("assignmentOperator", 97); LeaveRule_assignmentOperator(); } DebugLocation(758, 1); } finally { DebugExitRule(GrammarFileName, "assignmentOperator"); } return retval; }
private AstParserRuleReturnScope<object, IToken> explicitConstructorInvocation() { EnterRule_explicitConstructorInvocation(); EnterRule("explicitConstructorInvocation", 43); TraceIn("explicitConstructorInvocation", 43); AstParserRuleReturnScope<object, IToken> retval = new AstParserRuleReturnScope<object, IToken>(); retval.Start = (IToken)input.LT(1); int explicitConstructorInvocation_StartIndex = input.Index; object root_0 = default(object); IToken set215 = default(IToken); IToken char_literal217 = default(IToken); IToken char_literal219 = default(IToken); IToken string_literal221 = default(IToken); IToken char_literal223 = default(IToken); AstParserRuleReturnScope<object, IToken> nonWildcardTypeArguments214 = default(AstParserRuleReturnScope<object, IToken>); AstParserRuleReturnScope<object, IToken> arguments216 = default(AstParserRuleReturnScope<object, IToken>); AstParserRuleReturnScope<object, IToken> primary218 = default(AstParserRuleReturnScope<object, IToken>); AstParserRuleReturnScope<object, IToken> nonWildcardTypeArguments220 = default(AstParserRuleReturnScope<object, IToken>); AstParserRuleReturnScope<object, IToken> arguments222 = default(AstParserRuleReturnScope<object, IToken>); object set215_tree = default(object); object char_literal217_tree = default(object); object char_literal219_tree = default(object); object string_literal221_tree = default(object); object char_literal223_tree = default(object); try { DebugEnterRule(GrammarFileName, "explicitConstructorInvocation"); DebugLocation(701, 4); try { if (state.backtracking > 0 && AlreadyParsedRule(input, 43)) { return retval; } // Java.g:702:5: ( ( nonWildcardTypeArguments )? ( 'this' | 'super' ) arguments ';' | primary '.' ( nonWildcardTypeArguments )? 'super' arguments ';' ) int alt79=2; try { DebugEnterDecision(79, false); switch (input.LA(1)) { case LT: { alt79 = 1; } break; case THIS: { int LA79_2 = input.LA(2); if ((EvaluatePredicate(synpred106_Java_fragment))) { alt79 = 1; } else if ((true)) { alt79 = 2; } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 79, 2, input, 2); DebugRecognitionException(nvae); throw nvae; } } break; case BOOLEAN: case BYTE: case BooleanLiteral: case CHAR: case CharacterLiteral: case DOUBLE: case FLOAT: case FloatingPointLiteral: case IDENTIFIER: case INT: case IntegerLiteral: case LONG: case LPAREN: case NEW: case NullLiteral: case SHORT: case StringLiteral: case VOID: { alt79 = 2; } break; case SUPER: { int LA79_2 = input.LA(2); if ((EvaluatePredicate(synpred106_Java_fragment))) { alt79 = 1; } else if ((true)) { alt79 = 2; } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 79, 4, input, 2); DebugRecognitionException(nvae); throw nvae; } } break; default: { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 79, 0, input, 1); DebugRecognitionException(nvae); throw nvae; } } } finally { DebugExitDecision(79); } switch (alt79) { case 1: DebugEnterAlt(1); // Java.g:702:9: ( nonWildcardTypeArguments )? ( 'this' | 'super' ) arguments ';' { root_0 = (object)adaptor.Nil(); DebugLocation(702, 9); // Java.g:702:9: ( nonWildcardTypeArguments )? int alt77=2; try { DebugEnterSubRule(77); try { DebugEnterDecision(77, false); int LA77_1 = input.LA(1); if ((LA77_1==LT)) { alt77 = 1; } } finally { DebugExitDecision(77); } switch (alt77) { case 1: DebugEnterAlt(1); // Java.g:702:10: nonWildcardTypeArguments { DebugLocation(702, 10); PushFollow(Follow._nonWildcardTypeArguments_in_explicitConstructorInvocation3371); nonWildcardTypeArguments214=nonWildcardTypeArguments(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) adaptor.AddChild(root_0, nonWildcardTypeArguments214.Tree); } break; } } finally { DebugExitSubRule(77); } DebugLocation(704, 9); set215=(IToken)input.LT(1); if (input.LA(1)==SUPER||input.LA(1)==THIS) { input.Consume(); if (state.backtracking == 0) adaptor.AddChild(root_0, (object)adaptor.Create(set215)); state.errorRecovery=false;state.failed=false; } else { if (state.backtracking>0) {state.failed=true; return retval;} MismatchedSetException mse = new MismatchedSetException(null,input); DebugRecognitionException(mse); throw mse; } DebugLocation(707, 9); PushFollow(Follow._arguments_in_explicitConstructorInvocation3429); arguments216=arguments(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) adaptor.AddChild(root_0, arguments216.Tree); DebugLocation(707, 19); char_literal217=(IToken)Match(input,SEMI,Follow._SEMI_in_explicitConstructorInvocation3431); if (state.failed) return retval; if (state.backtracking == 0) { char_literal217_tree = (object)adaptor.Create(char_literal217); adaptor.AddChild(root_0, char_literal217_tree); } } break; case 2: DebugEnterAlt(2); // Java.g:709:9: primary '.' ( nonWildcardTypeArguments )? 'super' arguments ';' { root_0 = (object)adaptor.Nil(); DebugLocation(709, 9); PushFollow(Follow._primary_in_explicitConstructorInvocation3442); primary218=primary(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) adaptor.AddChild(root_0, primary218.Tree); DebugLocation(710, 9); char_literal219=(IToken)Match(input,DOT,Follow._DOT_in_explicitConstructorInvocation3452); if (state.failed) return retval; if (state.backtracking == 0) { char_literal219_tree = (object)adaptor.Create(char_literal219); adaptor.AddChild(root_0, char_literal219_tree); } DebugLocation(711, 9); // Java.g:711:9: ( nonWildcardTypeArguments )? int alt78=2; try { DebugEnterSubRule(78); try { DebugEnterDecision(78, false); int LA78_1 = input.LA(1); if ((LA78_1==LT)) { alt78 = 1; } } finally { DebugExitDecision(78); } switch (alt78) { case 1: DebugEnterAlt(1); // Java.g:711:10: nonWildcardTypeArguments { DebugLocation(711, 10); PushFollow(Follow._nonWildcardTypeArguments_in_explicitConstructorInvocation3463); nonWildcardTypeArguments220=nonWildcardTypeArguments(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) adaptor.AddChild(root_0, nonWildcardTypeArguments220.Tree); } break; } } finally { DebugExitSubRule(78); } DebugLocation(713, 9); string_literal221=(IToken)Match(input,SUPER,Follow._SUPER_in_explicitConstructorInvocation3484); if (state.failed) return retval; if (state.backtracking == 0) { string_literal221_tree = (object)adaptor.Create(string_literal221); adaptor.AddChild(root_0, string_literal221_tree); } DebugLocation(714, 9); PushFollow(Follow._arguments_in_explicitConstructorInvocation3494); arguments222=arguments(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) adaptor.AddChild(root_0, arguments222.Tree); DebugLocation(714, 19); char_literal223=(IToken)Match(input,SEMI,Follow._SEMI_in_explicitConstructorInvocation3496); if (state.failed) return retval; if (state.backtracking == 0) { char_literal223_tree = (object)adaptor.Create(char_literal223); adaptor.AddChild(root_0, char_literal223_tree); } } break; } retval.Stop = (IToken)input.LT(-1); if (state.backtracking == 0) { retval.Tree = (object)adaptor.RulePostProcessing(root_0); adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop); } } catch (RecognitionException re) { ReportError(re); Recover(input,re); retval.Tree = (object)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re); } finally { TraceOut("explicitConstructorInvocation", 43); LeaveRule("explicitConstructorInvocation", 43); LeaveRule_explicitConstructorInvocation(); if (state.backtracking > 0) { Memoize(input, 43, explicitConstructorInvocation_StartIndex); } } DebugLocation(715, 4); } finally { DebugExitRule(GrammarFileName, "explicitConstructorInvocation"); } return retval; }
private AstParserRuleReturnScope<object, IToken> typeArgument() { EnterRule_typeArgument(); EnterRule("typeArgument", 37); TraceIn("typeArgument", 37); AstParserRuleReturnScope<object, IToken> retval = new AstParserRuleReturnScope<object, IToken>(); retval.Start = (IToken)input.LT(1); int typeArgument_StartIndex = input.Index; object root_0 = default(object); IToken char_literal189 = default(IToken); IToken set190 = default(IToken); AstParserRuleReturnScope<object, IToken> type188 = default(AstParserRuleReturnScope<object, IToken>); AstParserRuleReturnScope<object, IToken> type191 = default(AstParserRuleReturnScope<object, IToken>); object char_literal189_tree = default(object); object set190_tree = default(object); try { DebugEnterRule(GrammarFileName, "typeArgument"); DebugLocation(653, 4); try { if (state.backtracking > 0 && AlreadyParsedRule(input, 37)) { return retval; } // Java.g:654:5: ( type | '?' ( ( 'extends' | 'super' ) type )? ) int alt70=2; try { DebugEnterDecision(70, false); int LA70_1 = input.LA(1); if ((LA70_1==BOOLEAN||LA70_1==BYTE||LA70_1==CHAR||LA70_1==DOUBLE||LA70_1==FLOAT||LA70_1==IDENTIFIER||LA70_1==INT||LA70_1==LONG||LA70_1==SHORT)) { alt70 = 1; } else if ((LA70_1==QUES)) { alt70 = 2; } else { if (state.backtracking>0) {state.failed=true; return retval;} NoViableAltException nvae = new NoViableAltException("", 70, 0, input, 1); DebugRecognitionException(nvae); throw nvae; } } finally { DebugExitDecision(70); } switch (alt70) { case 1: DebugEnterAlt(1); // Java.g:654:9: type { root_0 = (object)adaptor.Nil(); DebugLocation(654, 9); PushFollow(Follow._type_in_typeArgument2975); type188=type(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) adaptor.AddChild(root_0, type188.Tree); } break; case 2: DebugEnterAlt(2); // Java.g:655:9: '?' ( ( 'extends' | 'super' ) type )? { root_0 = (object)adaptor.Nil(); DebugLocation(655, 9); char_literal189=(IToken)Match(input,QUES,Follow._QUES_in_typeArgument2985); if (state.failed) return retval; if (state.backtracking == 0) { char_literal189_tree = (object)adaptor.Create(char_literal189); adaptor.AddChild(root_0, char_literal189_tree); } DebugLocation(656, 9); // Java.g:656:9: ( ( 'extends' | 'super' ) type )? int alt69=2; try { DebugEnterSubRule(69); try { DebugEnterDecision(69, false); int LA69_1 = input.LA(1); if ((LA69_1==EXTENDS||LA69_1==SUPER)) { alt69 = 1; } } finally { DebugExitDecision(69); } switch (alt69) { case 1: DebugEnterAlt(1); // Java.g:657:13: ( 'extends' | 'super' ) type { DebugLocation(657, 13); set190=(IToken)input.LT(1); if (input.LA(1)==EXTENDS||input.LA(1)==SUPER) { input.Consume(); if (state.backtracking == 0) adaptor.AddChild(root_0, (object)adaptor.Create(set190)); state.errorRecovery=false;state.failed=false; } else { if (state.backtracking>0) {state.failed=true; return retval;} MismatchedSetException mse = new MismatchedSetException(null,input); DebugRecognitionException(mse); throw mse; } DebugLocation(660, 13); PushFollow(Follow._type_in_typeArgument3053); type191=type(); PopFollow(); if (state.failed) return retval; if (state.backtracking == 0) adaptor.AddChild(root_0, type191.Tree); } break; } } finally { DebugExitSubRule(69); } } break; } retval.Stop = (IToken)input.LT(-1); if (state.backtracking == 0) { retval.Tree = (object)adaptor.RulePostProcessing(root_0); adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop); } } catch (RecognitionException re) { ReportError(re); Recover(input,re); retval.Tree = (object)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re); } finally { TraceOut("typeArgument", 37); LeaveRule("typeArgument", 37); LeaveRule_typeArgument(); if (state.backtracking > 0) { Memoize(input, 37, typeArgument_StartIndex); } } DebugLocation(662, 4); } finally { DebugExitRule(GrammarFileName, "typeArgument"); } return retval; }
private AstParserRuleReturnScope<object, IToken> primitiveType() { EnterRule_primitiveType(); EnterRule("primitiveType", 35); TraceIn("primitiveType", 35); AstParserRuleReturnScope<object, IToken> retval = new AstParserRuleReturnScope<object, IToken>(); retval.Start = (IToken)input.LT(1); int primitiveType_StartIndex = input.Index; object root_0 = default(object); IToken set182 = default(IToken); object set182_tree = default(object); try { DebugEnterRule(GrammarFileName, "primitiveType"); DebugLocation(638, 4); try { if (state.backtracking > 0 && AlreadyParsedRule(input, 35)) { return retval; } // Java.g:639:5: ( 'boolean' | 'char' | 'byte' | 'short' | 'int' | 'long' | 'float' | 'double' ) DebugEnterAlt(1); // Java.g: { root_0 = (object)adaptor.Nil(); DebugLocation(639, 5); set182=(IToken)input.LT(1); if (input.LA(1)==BOOLEAN||input.LA(1)==BYTE||input.LA(1)==CHAR||input.LA(1)==DOUBLE||input.LA(1)==FLOAT||input.LA(1)==INT||input.LA(1)==LONG||input.LA(1)==SHORT) { input.Consume(); if (state.backtracking == 0) adaptor.AddChild(root_0, (object)adaptor.Create(set182)); state.errorRecovery=false;state.failed=false; } else { if (state.backtracking>0) {state.failed=true; return retval;} MismatchedSetException mse = new MismatchedSetException(null,input); DebugRecognitionException(mse); throw mse; } } retval.Stop = (IToken)input.LT(-1); if (state.backtracking == 0) { retval.Tree = (object)adaptor.RulePostProcessing(root_0); adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop); } } catch (RecognitionException re) { ReportError(re); Recover(input,re); retval.Tree = (object)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re); } finally { TraceOut("primitiveType", 35); LeaveRule("primitiveType", 35); LeaveRule_primitiveType(); if (state.backtracking > 0) { Memoize(input, 35, primitiveType_StartIndex); } } DebugLocation(647, 4); } finally { DebugExitRule(GrammarFileName, "primitiveType"); } return retval; }
/** <summary>What error message should be generated for the various exception types?</summary> * * <remarks> * Not very object-oriented code, but I like having all error message * generation within one method rather than spread among all of the * exception classes. This also makes it much easier for the exception * handling because the exception classes do not have to have pointers back * to this object to access utility routines and so on. Also, changing * the message for an exception type would be difficult because you * would have to subclassing exception, but then somehow get ANTLR * to make those kinds of exception objects instead of the default. * This looks weird, but trust me--it makes the most sense in terms * of flexibility. * * For grammar debugging, you will want to override this to add * more information such as the stack frame with * getRuleInvocationStack(e, this.getClass().getName()) and, * for no viable alts, the decision description and state etc... * * Override this to change the message generated for one or more * exception types. * </remarks> */ public virtual string GetErrorMessage(RecognitionException e, string[] tokenNames) { string msg = e.Message; if (e is UnwantedTokenException) { UnwantedTokenException ute = (UnwantedTokenException)e; string tokenName = "<unknown>"; if (ute.Expecting == TokenTypes.EndOfFile) { tokenName = "EndOfFile"; } else { tokenName = tokenNames[ute.Expecting]; } msg = "extraneous input " + GetTokenErrorDisplay(ute.UnexpectedToken) + " expecting " + tokenName; } else if (e is MissingTokenException) { MissingTokenException mte = (MissingTokenException)e; string tokenName = "<unknown>"; if (mte.Expecting == TokenTypes.EndOfFile) { tokenName = "EndOfFile"; } else { tokenName = tokenNames[mte.Expecting]; } msg = "missing " + tokenName + " at " + GetTokenErrorDisplay(e.Token); } else if (e is MismatchedTokenException) { MismatchedTokenException mte = (MismatchedTokenException)e; string tokenName = "<unknown>"; if (mte.Expecting == TokenTypes.EndOfFile) { tokenName = "EndOfFile"; } else { tokenName = tokenNames[mte.Expecting]; } msg = "mismatched input " + GetTokenErrorDisplay(e.Token) + " expecting " + tokenName; } else if (e is MismatchedTreeNodeException) { MismatchedTreeNodeException mtne = (MismatchedTreeNodeException)e; string tokenName = "<unknown>"; if (mtne.Expecting == TokenTypes.EndOfFile) { tokenName = "EndOfFile"; } else { tokenName = tokenNames[mtne.Expecting]; } // workaround for a .NET framework bug (NullReferenceException) string nodeText = (mtne.Node != null) ? mtne.Node.ToString() ?? string.Empty : string.Empty; msg = "mismatched tree node: " + nodeText + " expecting " + tokenName; } else if (e is NoViableAltException) { //NoViableAltException nvae = (NoViableAltException)e; // for development, can add "decision=<<"+nvae.grammarDecisionDescription+">>" // and "(decision="+nvae.decisionNumber+") and // "state "+nvae.stateNumber msg = "no viable alternative at input " + GetTokenErrorDisplay(e.Token); } else if (e is EarlyExitException) { //EarlyExitException eee = (EarlyExitException)e; // for development, can add "(decision="+eee.decisionNumber+")" msg = "required (...)+ loop did not match anything at input " + GetTokenErrorDisplay(e.Token); } else if (e is MismatchedSetException) { MismatchedSetException mse = (MismatchedSetException)e; msg = "mismatched input " + GetTokenErrorDisplay(e.Token) + " expecting set " + mse.Expecting; } else if (e is MismatchedNotSetException) { MismatchedNotSetException mse = (MismatchedNotSetException)e; msg = "mismatched input " + GetTokenErrorDisplay(e.Token) + " expecting set " + mse.Expecting; } else if (e is FailedPredicateException) { FailedPredicateException fpe = (FailedPredicateException)e; msg = "rule " + fpe.RuleName + " failed predicate: {" + fpe.PredicateText + "}?"; } return(msg); }
/// <summary> /// What error message should be generated for the various exception types? /// /// Not very object-oriented code, but I like having all error message generation /// within one method rather than spread among all of the exception classes. This /// also makes it much easier for the exception handling because the exception /// classes do not have to have pointers back to this object to access utility /// routines and so on. Also, changing the message for an exception type would be /// difficult because you would have to subclassing exception, but then somehow get /// ANTLR to make those kinds of exception objects instead of the default. /// /// This looks weird, but trust me--it makes the most sense in terms of flexibility. /// /// For grammar debugging, you will want to override this to add more information /// such as the stack frame with GetRuleInvocationStack(e, this.GetType().Fullname) /// and, for no viable alts, the decision description and state etc... /// /// Override this to change the message generated for one or more exception types. /// </summary> public virtual string GetErrorMessage(RecognitionException e, string[] tokenNames) { string msg = e.Message; if (e is UnwantedTokenException) { UnwantedTokenException ute = (UnwantedTokenException)e; string tokenName = "<unknown>"; if (ute.Expecting == Token.EOF) { tokenName = "EOF"; } else { tokenName = tokenNames[ute.Expecting]; } msg = "extraneous input " + GetTokenErrorDisplay(ute.UnexpectedToken) + " expecting " + tokenName; } else if (e is MissingTokenException) { MissingTokenException mte = (MissingTokenException)e; string tokenName = "<unknown>"; if (mte.Expecting == Token.EOF) { tokenName = "EOF"; } else { tokenName = tokenNames[mte.Expecting]; } msg = "missing " + tokenName + " at " + GetTokenErrorDisplay(e.Token); } else if (e is MismatchedTokenException) { MismatchedTokenException mte = (MismatchedTokenException)e; string tokenName = "<unknown>"; if (mte.Expecting == Token.EOF) { tokenName = "EOF"; } else { tokenName = tokenNames[mte.Expecting]; } msg = "mismatched input " + GetTokenErrorDisplay(e.Token) + " expecting " + tokenName; } //else if (e is MismatchedTreeNodeException) //{ // MismatchedTreeNodeException mtne = (MismatchedTreeNodeException)e; // string tokenName = "<unknown>"; // if (mtne.expecting == Token.EOF) // { // tokenName = "EOF"; // } // else // { // tokenName = tokenNames[mtne.expecting]; // } // // The ternary operator is only necessary because of a bug in the .NET framework // msg = "mismatched tree node: " + ((mtne.Node!=null && mtne.Node.ToString()!=null) ? // mtne.Node : string.Empty) + " expecting " + tokenName; //} else if (e is NoViableAltException) { //NoViableAltException nvae = (NoViableAltException)e; // for development, can add "decision=<<"+nvae.grammarDecisionDescription+">>" // and "(decision="+nvae.decisionNumber+") and // "state "+nvae.stateNumber msg = "no viable alternative at input " + GetTokenErrorDisplay(e.Token); } else if (e is EarlyExitException) { //EarlyExitException eee = (EarlyExitException)e; // for development, can add "(decision="+eee.decisionNumber+")" msg = "required (...)+ loop did not match anything at input " + GetTokenErrorDisplay(e.Token); } else if (e is MismatchedSetException) { MismatchedSetException mse = (MismatchedSetException)e; msg = "mismatched input " + GetTokenErrorDisplay(e.Token) + " expecting set " + mse.expecting; } else if (e is MismatchedNotSetException) { MismatchedNotSetException mse = (MismatchedNotSetException)e; msg = "mismatched input " + GetTokenErrorDisplay(e.Token) + " expecting set " + mse.expecting; } else if (e is FailedPredicateException) { FailedPredicateException fpe = (FailedPredicateException)e; msg = "rule " + fpe.ruleName + " failed predicate: {" + fpe.predicateText + "}?"; } return(msg); }
private void mESC() { Enter_ESC(); EnterRule("ESC", 47); TraceIn("ESC", 47); try { // C:\\Users\\Oscar\\Documents\\Visual Studio 2010\\Projects\\TigerNET\\Grammar\\Tiger.g:86:14: ( '\\\\' ( 'n' | 't' | '\\\\' | '\"' ) ) DebugEnterAlt(1); // C:\\Users\\Oscar\\Documents\\Visual Studio 2010\\Projects\\TigerNET\\Grammar\\Tiger.g:86:16: '\\\\' ( 'n' | 't' | '\\\\' | '\"' ) { DebugLocation(86, 16); Match('\\'); DebugLocation(86, 20); if (input.LA(1)=='\"'||input.LA(1)=='\\'||input.LA(1)=='n'||input.LA(1)=='t') { input.Consume(); } else { MismatchedSetException mse = new MismatchedSetException(null,input); DebugRecognitionException(mse); Recover(mse); throw mse;} } } finally { TraceOut("ESC", 47); LeaveRule("ESC", 47); Leave_ESC(); } }
private void mCHAR() { Enter_CHAR(); EnterRule("CHAR", 49); TraceIn("CHAR", 49); try { // C:\\Users\\Oscar\\Documents\\Visual Studio 2010\\Projects\\TigerNET\\Grammar\\Tiger.g:88:15: (~ ( '\\n' | '\\t' | '\\\\' | '\"' | ' ' ) ) DebugEnterAlt(1); // C:\\Users\\Oscar\\Documents\\Visual Studio 2010\\Projects\\TigerNET\\Grammar\\Tiger.g:88:17: ~ ( '\\n' | '\\t' | '\\\\' | '\"' | ' ' ) { DebugLocation(88, 17); if ((input.LA(1)>='\u0000' && input.LA(1)<='\b')||(input.LA(1)>='\u000B' && input.LA(1)<='\u001F')||input.LA(1)=='!'||(input.LA(1)>='#' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFF')) { input.Consume(); } else { MismatchedSetException mse = new MismatchedSetException(null,input); DebugRecognitionException(mse); Recover(mse); throw mse;} } } finally { TraceOut("CHAR", 49); LeaveRule("CHAR", 49); Leave_CHAR(); } }
// $ANTLR end "method" // $ANTLR start "association" // D:\\Olle\\Projects\\WikiUml\\source\\Grammar\\WikiUml.g:79:1: association returns [Association association] : (ma= multiplicity )? (labelA= label )? a= ( SIMPLE_ASSOCIATION | DIRECTIONAL_ASSOCIATION | BIDECTIONAL_ASSOCIATION | INHERRITANCE_ASSOCIATION ) (labelB= label )? (mb= multiplicity )? ; public Association association() // throws RecognitionException [1] { Association association = default(Association); IToken a = null; string ma = default(string); string labelA = default(string); string labelB = default(string); string mb = default(string); association = new Association(); try { // D:\\Olle\\Projects\\WikiUml\\source\\Grammar\\WikiUml.g:80:2: ( (ma= multiplicity )? (labelA= label )? a= ( SIMPLE_ASSOCIATION | DIRECTIONAL_ASSOCIATION | BIDECTIONAL_ASSOCIATION | INHERRITANCE_ASSOCIATION ) (labelB= label )? (mb= multiplicity )? ) // D:\\Olle\\Projects\\WikiUml\\source\\Grammar\\WikiUml.g:81:2: (ma= multiplicity )? (labelA= label )? a= ( SIMPLE_ASSOCIATION | DIRECTIONAL_ASSOCIATION | BIDECTIONAL_ASSOCIATION | INHERRITANCE_ASSOCIATION ) (labelB= label )? (mb= multiplicity )? { // D:\\Olle\\Projects\\WikiUml\\source\\Grammar\\WikiUml.g:81:5: (ma= multiplicity )? int alt11 = 2; int LA11_0 = input.LA(1); if ( (LA11_0 == MM) ) { alt11 = 1; } switch (alt11) { case 1 : // D:\\Olle\\Projects\\WikiUml\\source\\Grammar\\WikiUml.g:81:5: ma= multiplicity { PushFollow(FOLLOW_multiplicity_in_association276); ma = multiplicity(); state.followingStackPointer--; } break; } // D:\\Olle\\Projects\\WikiUml\\source\\Grammar\\WikiUml.g:81:28: (labelA= label )? int alt12 = 2; int LA12_0 = input.LA(1); if ( (LA12_0 == 21) ) { alt12 = 1; } switch (alt12) { case 1 : // D:\\Olle\\Projects\\WikiUml\\source\\Grammar\\WikiUml.g:81:28: labelA= label { PushFollow(FOLLOW_label_in_association283); labelA = label(); state.followingStackPointer--; } break; } a = (IToken)input.LT(1); if ( (input.LA(1) >= SIMPLE_ASSOCIATION && input.LA(1) <= INHERRITANCE_ASSOCIATION) ) { input.Consume(); state.errorRecovery = false; } else { MismatchedSetException mse = new MismatchedSetException(null,input); throw mse; } // D:\\Olle\\Projects\\WikiUml\\source\\Grammar\\WikiUml.g:81:150: (labelB= label )? int alt13 = 2; int LA13_0 = input.LA(1); if ( (LA13_0 == 21) ) { alt13 = 1; } switch (alt13) { case 1 : // D:\\Olle\\Projects\\WikiUml\\source\\Grammar\\WikiUml.g:81:150: labelB= label { PushFollow(FOLLOW_label_in_association312); labelB = label(); state.followingStackPointer--; } break; } // D:\\Olle\\Projects\\WikiUml\\source\\Grammar\\WikiUml.g:81:163: (mb= multiplicity )? int alt14 = 2; int LA14_0 = input.LA(1); if ( (LA14_0 == MM) ) { alt14 = 1; } switch (alt14) { case 1 : // D:\\Olle\\Projects\\WikiUml\\source\\Grammar\\WikiUml.g:81:163: mb= multiplicity { PushFollow(FOLLOW_multiplicity_in_association320); mb = multiplicity(); state.followingStackPointer--; } break; } if(a.Type == SIMPLE_ASSOCIATION) association.Type = AssociationType.Simple; else if(a.Type == DIRECTIONAL_ASSOCIATION) association.Type = AssociationType.Directional; else if(a.Type == BIDECTIONAL_ASSOCIATION) association.Type = AssociationType.Bidirectional; else if(a.Type == INHERRITANCE_ASSOCIATION) association.Type = AssociationType.Inherritance; association.LabelA = labelA; association.LabelB = labelB; association.MultiplicityA = ma; association.MultiplicityB = mb; } } catch (RecognitionException re) { ReportError(re); Recover(input,re); } finally { } return association; }
private AstParserRuleReturnScope<CommonTree, IToken> reservedNamespace() { EnterRule_reservedNamespace(); EnterRule("reservedNamespace", 76); TraceIn("reservedNamespace", 76); AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>(); retval.Start = (IToken)input.LT(1); CommonTree root_0 = default(CommonTree); IToken set246 = default(IToken); CommonTree set246_tree = default(CommonTree); try { DebugEnterRule(GrammarFileName, "reservedNamespace"); DebugLocation(593, 1); try { // AS3.g:594:2: ( PUBLIC | PRIVATE | PROTECTED | INTERNAL ) DebugEnterAlt(1); // AS3.g: { root_0 = (CommonTree)adaptor.Nil(); DebugLocation(594, 2); set246=(IToken)input.LT(1); if (input.LA(1)==INTERNAL||input.LA(1)==PRIVATE||(input.LA(1)>=PROTECTED && input.LA(1)<=PUBLIC)) { input.Consume(); if (state.backtracking == 0) adaptor.AddChild(root_0, (CommonTree)adaptor.Create(set246)); state.errorRecovery=false;state.failed=false; } else { if (state.backtracking>0) {state.failed=true; return retval;} MismatchedSetException mse = new MismatchedSetException(null,input); DebugRecognitionException(mse); throw mse; } } retval.Stop = (IToken)input.LT(-1); if (state.backtracking == 0) { retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0); adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop); } } catch (RecognitionException re) { ReportError(re); Recover(input,re); retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re); } finally { TraceOut("reservedNamespace", 76); LeaveRule("reservedNamespace", 76); LeaveRule_reservedNamespace(); } DebugLocation(598, 1); } finally { DebugExitRule(GrammarFileName, "reservedNamespace"); } return retval; }
private void mIDENTIFIER_START_ASCII() { EnterRule_IDENTIFIER_START_ASCII(); EnterRule("IDENTIFIER_START_ASCII", 25); TraceIn("IDENTIFIER_START_ASCII", 25); try { // ..\\..\\NameParsing\\CSharpNames.g:184:2: ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) DebugEnterAlt(1); // ..\\..\\NameParsing\\CSharpNames.g: { DebugLocation(184, 2); if ((input.LA(1)>='A' && input.LA(1)<='Z')||input.LA(1)=='_'||(input.LA(1)>='a' && input.LA(1)<='z')) { input.Consume(); } else { MismatchedSetException mse = new MismatchedSetException(null,input); DebugRecognitionException(mse); Recover(mse); throw mse; } } } finally { TraceOut("IDENTIFIER_START_ASCII", 25); LeaveRule("IDENTIFIER_START_ASCII", 25); LeaveRule_IDENTIFIER_START_ASCII(); } }
private AstParserRuleReturnScope<CommonTree, IToken> equalityOperator() { EnterRule_equalityOperator(); EnterRule("equalityOperator", 108); TraceIn("equalityOperator", 108); AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>(); retval.Start = (IToken)input.LT(1); CommonTree root_0 = default(CommonTree); IToken set346 = default(IToken); CommonTree set346_tree = default(CommonTree); try { DebugEnterRule(GrammarFileName, "equalityOperator"); DebugLocation(819, 1); try { // AS3.g:820:2: ( STRICT_EQUAL | STRICT_NOT_EQUAL | NOT_EQUAL | EQUAL ) DebugEnterAlt(1); // AS3.g: { root_0 = (CommonTree)adaptor.Nil(); DebugLocation(820, 2); set346=(IToken)input.LT(1); if (input.LA(1)==EQUAL||input.LA(1)==NOT_EQUAL||(input.LA(1)>=STRICT_EQUAL && input.LA(1)<=STRICT_NOT_EQUAL)) { input.Consume(); if (state.backtracking == 0) adaptor.AddChild(root_0, (CommonTree)adaptor.Create(set346)); state.errorRecovery=false;state.failed=false; } else { if (state.backtracking>0) {state.failed=true; return retval;} MismatchedSetException mse = new MismatchedSetException(null,input); DebugRecognitionException(mse); throw mse; } } retval.Stop = (IToken)input.LT(-1); if (state.backtracking == 0) { retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0); adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop); } } catch (RecognitionException re) { ReportError(re); Recover(input,re); retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re); } finally { TraceOut("equalityOperator", 108); LeaveRule("equalityOperator", 108); LeaveRule_equalityOperator(); } DebugLocation(821, 1); } finally { DebugExitRule(GrammarFileName, "equalityOperator"); } return retval; }
private void mWS() { EnterRule_WS(); EnterRule("WS", 25); TraceIn("WS", 25); try { int _type = WS; int _channel = DefaultTokenChannel; // /Users/abdullin/MessageContracts.g:147:5: ( ( ' ' | '\\t' | '\\r' | '\\n' ) ) DebugEnterAlt(1); // /Users/abdullin/MessageContracts.g:147:9: ( ' ' | '\\t' | '\\r' | '\\n' ) { DebugLocation(147, 9); if ((input.LA(1)>='\t' && input.LA(1)<='\n')||input.LA(1)=='\r'||input.LA(1)==' ') { input.Consume(); } else { MismatchedSetException mse = new MismatchedSetException(null,input); DebugRecognitionException(mse); Recover(mse); throw mse; } DebugLocation(151, 11); _channel=HIDDEN; } state.type = _type; state.channel = _channel; } finally { TraceOut("WS", 25); LeaveRule("WS", 25); LeaveRule_WS(); } }
private AstParserRuleReturnScope<CommonTree, IToken> multiplicativeOperator() { EnterRule_multiplicativeOperator(); EnterRule("multiplicativeOperator", 116); TraceIn("multiplicativeOperator", 116); AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>(); retval.Start = (IToken)input.LT(1); CommonTree root_0 = default(CommonTree); IToken set362 = default(IToken); CommonTree set362_tree = default(CommonTree); try { DebugEnterRule(GrammarFileName, "multiplicativeOperator"); DebugLocation(859, 1); try { // AS3.g:860:2: ( STAR | DIV | MOD ) DebugEnterAlt(1); // AS3.g: { root_0 = (CommonTree)adaptor.Nil(); DebugLocation(860, 2); set362=(IToken)input.LT(1); if (input.LA(1)==DIV||input.LA(1)==MOD||input.LA(1)==STAR) { input.Consume(); if (state.backtracking == 0) adaptor.AddChild(root_0, (CommonTree)adaptor.Create(set362)); state.errorRecovery=false;state.failed=false; } else { if (state.backtracking>0) {state.failed=true; return retval;} MismatchedSetException mse = new MismatchedSetException(null,input); DebugRecognitionException(mse); throw mse; } } retval.Stop = (IToken)input.LT(-1); if (state.backtracking == 0) { retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0); adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop); } } catch (RecognitionException re) { ReportError(re); Recover(input,re); retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re); } finally { TraceOut("multiplicativeOperator", 116); LeaveRule("multiplicativeOperator", 116); LeaveRule_multiplicativeOperator(); } DebugLocation(861, 1); } finally { DebugExitRule(GrammarFileName, "multiplicativeOperator"); } return retval; }
private void mModifier() { EnterRule_Modifier(); EnterRule("Modifier", 17); TraceIn("Modifier", 17); try { int _type = Modifier; int _channel = DefaultTokenChannel; // /Users/abdullin/MessageContracts.g:106:2: ( '?' | '!' | ';' ) DebugEnterAlt(1); // /Users/abdullin/MessageContracts.g: { DebugLocation(106, 2); if (input.LA(1)=='!'||input.LA(1)==';'||input.LA(1)=='?') { input.Consume(); } else { MismatchedSetException mse = new MismatchedSetException(null,input); DebugRecognitionException(mse); Recover(mse); throw mse; } } state.type = _type; state.channel = _channel; } finally { TraceOut("Modifier", 17); LeaveRule("Modifier", 17); LeaveRule_Modifier(); } }
private AstParserRuleReturnScope<CommonTree, IToken> varOrConst() { EnterRule_varOrConst(); EnterRule("varOrConst", 29); TraceIn("varOrConst", 29); AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>(); retval.Start = (IToken)input.LT(1); CommonTree root_0 = default(CommonTree); IToken set99 = default(IToken); CommonTree set99_tree = default(CommonTree); try { DebugEnterRule(GrammarFileName, "varOrConst"); DebugLocation(308, 1); try { // AS3.g:309:2: ( VAR | CONST ) DebugEnterAlt(1); // AS3.g: { root_0 = (CommonTree)adaptor.Nil(); DebugLocation(309, 2); set99=(IToken)input.LT(1); if (input.LA(1)==CONST||input.LA(1)==VAR) { input.Consume(); if (state.backtracking == 0) adaptor.AddChild(root_0, (CommonTree)adaptor.Create(set99)); state.errorRecovery=false;state.failed=false; } else { if (state.backtracking>0) {state.failed=true; return retval;} MismatchedSetException mse = new MismatchedSetException(null,input); DebugRecognitionException(mse); throw mse; } } retval.Stop = (IToken)input.LT(-1); if (state.backtracking == 0) { retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0); adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop); } } catch (RecognitionException re) { ReportError(re); Recover(input,re); retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re); } finally { TraceOut("varOrConst", 29); LeaveRule("varOrConst", 29); LeaveRule_varOrConst(); } DebugLocation(310, 1); } finally { DebugExitRule(GrammarFileName, "varOrConst"); } return retval; }
private void mHEX_DIGIT() { EnterRule_HEX_DIGIT(); EnterRule("HEX_DIGIT", 20); TraceIn("HEX_DIGIT", 20); try { // /Users/abdullin/MessageContracts.g:122:11: ( ( '0' .. '9' | 'a' .. 'f' | 'A' .. 'F' ) ) DebugEnterAlt(1); // /Users/abdullin/MessageContracts.g: { DebugLocation(122, 11); if ((input.LA(1)>='0' && input.LA(1)<='9')||(input.LA(1)>='A' && input.LA(1)<='F')||(input.LA(1)>='a' && input.LA(1)<='f')) { input.Consume(); } else { MismatchedSetException mse = new MismatchedSetException(null,input); DebugRecognitionException(mse); Recover(mse); throw mse; } } } finally { TraceOut("HEX_DIGIT", 20); LeaveRule("HEX_DIGIT", 20); LeaveRule_HEX_DIGIT(); } }
private void mWS() { EnterRule_WS(); EnterRule("WS", 7); TraceIn("WS", 7); try { int _type = WS; int _channel = DefaultTokenChannel; // FuncProtoToShim.g:42:2: ( ( '\\t' | ' ' ) ) DebugEnterAlt(1); // FuncProtoToShim.g:43:3: ( '\\t' | ' ' ) { DebugLocation(43, 3); if (input.LA(1)=='\t'||input.LA(1)==' ') { input.Consume(); } else { MismatchedSetException mse = new MismatchedSetException(null,input); DebugRecognitionException(mse); Recover(mse); throw mse;} DebugLocation(48, 3); _channel=TokenChannels.Hidden; } state.type = _type; state.channel = _channel; } finally { TraceOut("WS", 7); LeaveRule("WS", 7); LeaveRule_WS(); } }
private void mHEX_DIGIT() { EnterRule_HEX_DIGIT(); EnterRule("HEX_DIGIT", 21); TraceIn("HEX_DIGIT", 21); try { // D:\\_Dokumente\\GitHub\\lokad-codedsl\\Source\\MessageContracts.g:135:11: ( ( '0' .. '9' | 'a' .. 'f' | 'A' .. 'F' ) ) DebugEnterAlt(1); // D:\\_Dokumente\\GitHub\\lokad-codedsl\\Source\\MessageContracts.g: { DebugLocation(135, 11); if ((input.LA(1)>='0' && input.LA(1)<='9')||(input.LA(1)>='A' && input.LA(1)<='F')||(input.LA(1)>='a' && input.LA(1)<='f')) { input.Consume(); } else { MismatchedSetException mse = new MismatchedSetException(null,input); DebugRecognitionException(mse); Recover(mse); throw mse; } } } finally { TraceOut("HEX_DIGIT", 21); LeaveRule("HEX_DIGIT", 21); LeaveRule_HEX_DIGIT(); } }
// $ANTLR end "COMMENTS" // $ANTLR start "ID" public void mID() // throws RecognitionException [2] { try { int _type = ID; int _channel = DEFAULT_TOKEN_CHANNEL; // C:\\Development\\TT.Net\\TT\\Template.g:58:4: ( ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' )* ) // C:\\Development\\TT.Net\\TT\\Template.g:58:6: ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '_' )* { if ( (input.LA(1) >= 'A' && input.LA(1) <= 'Z') || input.LA(1) == '_' || (input.LA(1) >= 'a' && input.LA(1) <= 'z') ) { input.Consume(); } else { MismatchedSetException mse = new MismatchedSetException(null,input); Recover(mse); throw mse;} // C:\\Development\\TT.Net\\TT\\Template.g:58:30: ( 'a' .. 'z' | 'A' .. 'Z' | '_' )* do { int alt6 = 2; int LA6_0 = input.LA(1); if ( ((LA6_0 >= 'A' && LA6_0 <= 'Z') || LA6_0 == '_' || (LA6_0 >= 'a' && LA6_0 <= 'z')) ) { alt6 = 1; } switch (alt6) { case 1 : // C:\\Development\\TT.Net\\TT\\Template.g: { if ( (input.LA(1) >= 'A' && input.LA(1) <= 'Z') || input.LA(1) == '_' || (input.LA(1) >= 'a' && input.LA(1) <= 'z') ) { input.Consume(); } else { MismatchedSetException mse = new MismatchedSetException(null,input); Recover(mse); throw mse;} } break; default: goto loop6; } } while (true); loop6: ; // Stops C# compiler whining that label 'loop6' has no statements } state.type = _type; state.channel = _channel; } finally { } }
private void mWS() { EnterRule_WS(); EnterRule("WS", 26); TraceIn("WS", 26); try { int _type = WS; int _channel = DefaultTokenChannel; // D:\\_Dokumente\\GitHub\\lokad-codedsl\\Source\\MessageContracts.g:160:5: ( ( ' ' | '\\t' | '\\r' | '\\n' ) ) DebugEnterAlt(1); // D:\\_Dokumente\\GitHub\\lokad-codedsl\\Source\\MessageContracts.g:160:9: ( ' ' | '\\t' | '\\r' | '\\n' ) { DebugLocation(160, 9); if ((input.LA(1)>='\t' && input.LA(1)<='\n')||input.LA(1)=='\r'||input.LA(1)==' ') { input.Consume(); } else { MismatchedSetException mse = new MismatchedSetException(null,input); DebugRecognitionException(mse); Recover(mse); throw mse; } DebugLocation(164, 11); _channel=HIDDEN; } state.type = _type; state.channel = _channel; } finally { TraceOut("WS", 26); LeaveRule("WS", 26); LeaveRule_WS(); } }
private void mSPACE() { Enter_SPACE(); EnterRule("SPACE", 46); TraceIn("SPACE", 46); try { int _type = SPACE; int _channel = DefaultTokenChannel; // C:\\Users\\Oscar\\Documents\\Visual Studio 2010\\Projects\\TigerNET\\Grammar\\Tiger.g:85:7: ( ( '\\n' | '\\t' | ' ' | '\\r' ) ) DebugEnterAlt(1); // C:\\Users\\Oscar\\Documents\\Visual Studio 2010\\Projects\\TigerNET\\Grammar\\Tiger.g:85:9: ( '\\n' | '\\t' | ' ' | '\\r' ) { DebugLocation(85, 9); if ((input.LA(1)>='\t' && input.LA(1)<='\n')||input.LA(1)=='\r'||input.LA(1)==' ') { input.Consume(); } else { MismatchedSetException mse = new MismatchedSetException(null,input); DebugRecognitionException(mse); Recover(mse); throw mse;} DebugLocation(85, 30); _channel = Hidden; } state.type = _type; state.channel = _channel; } finally { TraceOut("SPACE", 46); LeaveRule("SPACE", 46); Leave_SPACE(); } }
private void mID() { EnterRule_ID(); EnterRule("ID", 17); TraceIn("ID", 17); try { int _type = ID; int _channel = DefaultTokenChannel; // D:\\_Dokumente\\GitHub\\lokad-codedsl\\Source\\MessageContracts.g:115:5: ( ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '_' | '<' | '>' | '[' | ']' )* ) DebugEnterAlt(1); // D:\\_Dokumente\\GitHub\\lokad-codedsl\\Source\\MessageContracts.g:115:7: ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '_' | '<' | '>' | '[' | ']' )* { DebugLocation(115, 7); if ((input.LA(1)>='A' && input.LA(1)<='Z')||input.LA(1)=='_'||(input.LA(1)>='a' && input.LA(1)<='z')) { input.Consume(); } else { MismatchedSetException mse = new MismatchedSetException(null,input); DebugRecognitionException(mse); Recover(mse); throw mse; } DebugLocation(115, 30); // D:\\_Dokumente\\GitHub\\lokad-codedsl\\Source\\MessageContracts.g:115:30: ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '_' | '<' | '>' | '[' | ']' )* try { DebugEnterSubRule(1); while (true) { int alt1=2; try { DebugEnterDecision(1, decisionCanBacktrack[1]); int LA1_0 = input.LA(1); if (((LA1_0>='0' && LA1_0<='9')||LA1_0=='<'||LA1_0=='>'||(LA1_0>='A' && LA1_0<='[')||LA1_0==']'||LA1_0=='_'||(LA1_0>='a' && LA1_0<='z'))) { alt1 = 1; } } finally { DebugExitDecision(1); } switch ( alt1 ) { case 1: DebugEnterAlt(1); // D:\\_Dokumente\\GitHub\\lokad-codedsl\\Source\\MessageContracts.g: { DebugLocation(115, 30); input.Consume(); } break; default: goto loop1; } } loop1: ; } finally { DebugExitSubRule(1); } } state.type = _type; state.channel = _channel; } finally { TraceOut("ID", 17); LeaveRule("ID", 17); LeaveRule_ID(); } }
private void mLETTER() { Enter_LETTER(); EnterRule("LETTER", 48); TraceIn("LETTER", 48); try { // C:\\Users\\Oscar\\Documents\\Visual Studio 2010\\Projects\\TigerNET\\Grammar\\Tiger.g:87:17: ( 'a' .. 'z' | 'A' .. 'Z' ) DebugEnterAlt(1); // C:\\Users\\Oscar\\Documents\\Visual Studio 2010\\Projects\\TigerNET\\Grammar\\Tiger.g: { DebugLocation(87, 17); if ((input.LA(1)>='A' && input.LA(1)<='Z')||(input.LA(1)>='a' && input.LA(1)<='z')) { input.Consume(); } else { MismatchedSetException mse = new MismatchedSetException(null,input); DebugRecognitionException(mse); Recover(mse); throw mse;} } } finally { TraceOut("LETTER", 48); LeaveRule("LETTER", 48); Leave_LETTER(); } }
private void mModifier() { EnterRule_Modifier(); EnterRule("Modifier", 18); TraceIn("Modifier", 18); try { int _type = Modifier; int _channel = DefaultTokenChannel; // D:\\_Dokumente\\GitHub\\lokad-codedsl\\Source\\MessageContracts.g:119:2: ( '?' | '!' | ';' ) DebugEnterAlt(1); // D:\\_Dokumente\\GitHub\\lokad-codedsl\\Source\\MessageContracts.g: { DebugLocation(119, 2); if (input.LA(1)=='!'||input.LA(1)==';'||input.LA(1)=='?') { input.Consume(); } else { MismatchedSetException mse = new MismatchedSetException(null,input); DebugRecognitionException(mse); Recover(mse); throw mse; } } state.type = _type; state.channel = _channel; } finally { TraceOut("Modifier", 18); LeaveRule("Modifier", 18); LeaveRule_Modifier(); } }
private void mID() { Enter_ID(); EnterRule("ID", 50); TraceIn("ID", 50); try { int _type = ID; int _channel = DefaultTokenChannel; // C:\\Users\\Oscar\\Documents\\Visual Studio 2010\\Projects\\TigerNET\\Grammar\\Tiger.g:89:4: ( LETTER ( LETTER | DIGIT | Underscore )* ) DebugEnterAlt(1); // C:\\Users\\Oscar\\Documents\\Visual Studio 2010\\Projects\\TigerNET\\Grammar\\Tiger.g:89:6: LETTER ( LETTER | DIGIT | Underscore )* { DebugLocation(89, 6); mLETTER(); DebugLocation(89, 12); // C:\\Users\\Oscar\\Documents\\Visual Studio 2010\\Projects\\TigerNET\\Grammar\\Tiger.g:89:12: ( LETTER | DIGIT | Underscore )* try { DebugEnterSubRule(3); while (true) { int alt3=2; try { DebugEnterDecision(3, decisionCanBacktrack[3]); int LA3_0 = input.LA(1); if (((LA3_0>='0' && LA3_0<='9')||(LA3_0>='A' && LA3_0<='Z')||LA3_0=='_'||(LA3_0>='a' && LA3_0<='z'))) { alt3=1; } } finally { DebugExitDecision(3); } switch ( alt3 ) { case 1: DebugEnterAlt(1); // C:\\Users\\Oscar\\Documents\\Visual Studio 2010\\Projects\\TigerNET\\Grammar\\Tiger.g: { DebugLocation(89, 12); if ((input.LA(1)>='0' && input.LA(1)<='9')||(input.LA(1)>='A' && input.LA(1)<='Z')||input.LA(1)=='_'||(input.LA(1)>='a' && input.LA(1)<='z')) { input.Consume(); } else { MismatchedSetException mse = new MismatchedSetException(null,input); DebugRecognitionException(mse); Recover(mse); throw mse;} } break; default: goto loop3; } } loop3: ; } finally { DebugExitSubRule(3); } } state.type = _type; state.channel = _channel; } finally { TraceOut("ID", 50); LeaveRule("ID", 50); Leave_ID(); } }
private void mWS() { EnterRule_WS(); EnterRule("WS", 41); TraceIn("WS", 41); try { int _type = WS; int _channel = DefaultTokenChannel; // FlashTeaseScript.g:233:2: ( ( ' ' | '\\r' | '\\t' | '\\u000C' | '\\n' ) ) DebugEnterAlt(1); // FlashTeaseScript.g:233:4: ( ' ' | '\\r' | '\\t' | '\\u000C' | '\\n' ) { DebugLocation(233, 4); if ((input.LA(1)>='\t' && input.LA(1)<='\n')||(input.LA(1)>='\f' && input.LA(1)<='\r')||input.LA(1)==' ') { input.Consume(); } else { MismatchedSetException mse = new MismatchedSetException(null,input); DebugRecognitionException(mse); Recover(mse); throw mse;} DebugLocation(233, 34); Skip(); } state.type = _type; state.channel = _channel; } finally { TraceOut("WS", 41); LeaveRule("WS", 41); LeaveRule_WS(); } }