本文整理汇总了C#中Antlr.Runtime.NoViableAltException类的典型用法代码示例。如果您正苦于以下问题:C# NoViableAltException类的具体用法?C# NoViableAltException怎么用?C# NoViableAltException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NoViableAltException类属于Antlr.Runtime命名空间,在下文中一共展示了NoViableAltException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: mOR
private void mOR () {
this.Enter_OR ();
this.EnterRule ("OR", 1);
this.TraceIn ("OR", 1);
try {
int _type = OR;
int _channel = DefaultTokenChannel;
// D:\\Compilers\\Verification\\LTLParser.g:46:4: ( '||' | 'or' )
int alt1 = 2;
try {
this.DebugEnterDecision (1, decisionCanBacktrack [1]);
int LA1_0 = this.input.LA (1);
if ((LA1_0 == '|'))
alt1 = 1;
else if ((LA1_0 == 'o'))
alt1 = 2;
else {
NoViableAltException nvae = new NoViableAltException ("", 1, 0, this.input);
this.DebugRecognitionException (nvae);
throw nvae;
}
}
finally {
this.DebugExitDecision (1);
}
switch (alt1) {
case 1 :
this.DebugEnterAlt (1);
// D:\\Compilers\\Verification\\LTLParser.g:46:6: '||'
{
this.DebugLocation (46, 6);
this.Match ("||");
}
break;
case 2 :
this.DebugEnterAlt (2);
// D:\\Compilers\\Verification\\LTLParser.g:46:13: 'or'
{
this.DebugLocation (46, 13);
this.Match ("or");
}
break;
}
this.state.type = _type;
this.state.channel = _channel;
}
finally {
this.TraceOut ("OR", 1);
this.LeaveRule ("OR", 1);
this.Leave_OR ();
}
}
开发者ID:victorsamun,项目名称:NSimulator,代码行数:54,代码来源:LTLParserLexer.cs
示例2: NoViableAlt
protected virtual void NoViableAlt(int s, IIntStream input)
{
if (this.recognizer.state.backtracking > 0)
{
this.recognizer.state.failed = true;
}
else
{
NoViableAltException nvae = new NoViableAltException(this.Description, this.decisionNumber, s, input);
this.Error(nvae);
throw nvae;
}
}
开发者ID:brunolauze,项目名称:mysql-connector-net-6,代码行数:13,代码来源:DFA.cs
示例3: Error
public override void Error(NoViableAltException nvae)
{
DebugRecognitionException(nvae);
}
开发者ID:omederos,项目名称:TigerNET,代码行数:4,代码来源:TigerLexer.cs
示例4: classLevelStatement
// $ANTLR start "classLevelStatement"
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:88:1: classLevelStatement : ( propertyDeclaration | relationshipDeclaration );
public classLevelStatement_return classLevelStatement() // throws RecognitionException [1]
{
var retval = new classLevelStatement_return();
retval.Start = input.LT( 1 );
CommonTree root_0 = null;
propertyDeclaration_return propertyDeclaration15 = default( propertyDeclaration_return );
relationshipDeclaration_return relationshipDeclaration16 = default( relationshipDeclaration_return );
try
{
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:89:2: ( propertyDeclaration | relationshipDeclaration )
int alt5 = 2;
int LA5_0 = input.LA( 1 );
if ( ( LA5_0 == 62 ) )
alt5 = 1;
else if ( ( LA5_0 == 67 ) )
alt5 = 2;
else
{
var nvae_d5s0 =
new NoViableAltException( "", 5, 0, input );
throw nvae_d5s0;
}
switch ( alt5 )
{
case 1:
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:89:4: propertyDeclaration
{
root_0 = (CommonTree)adaptor.GetNilNode();
PushFollow( FOLLOW_propertyDeclaration_in_classLevelStatement354 );
propertyDeclaration15 = propertyDeclaration();
state.followingStackPointer--;
adaptor.AddChild( root_0, propertyDeclaration15.Tree );
}
break;
case 2:
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:90:4: relationshipDeclaration
{
root_0 = (CommonTree)adaptor.GetNilNode();
PushFollow( FOLLOW_relationshipDeclaration_in_classLevelStatement359 );
relationshipDeclaration16 = relationshipDeclaration();
state.followingStackPointer--;
adaptor.AddChild( root_0, relationshipDeclaration16.Tree );
}
break;
}
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;
}
开发者ID:ChrisEdwards,项目名称:CalcEngine,代码行数:73,代码来源:AntlrCalcEngineParser.cs
示例5: entityChain
// $ANTLR start "entityChain"
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:232:1: entityChain : ( thisKeyword | filteredEntity ) ( '.' filteredEntity )* ;
public entityChain_return entityChain() // throws RecognitionException [1]
{
var retval = new entityChain_return();
retval.Start = input.LT( 1 );
CommonTree root_0 = null;
IToken char_literal77 = null;
thisKeyword_return thisKeyword75 = default( thisKeyword_return );
filteredEntity_return filteredEntity76 = default( filteredEntity_return );
filteredEntity_return filteredEntity78 = default( filteredEntity_return );
CommonTree char_literal77_tree = null;
try
{
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:233:2: ( ( thisKeyword | filteredEntity ) ( '.' filteredEntity )* )
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:233:5: ( thisKeyword | filteredEntity ) ( '.' filteredEntity )*
{
root_0 = (CommonTree)adaptor.GetNilNode();
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:233:5: ( thisKeyword | filteredEntity )
int alt28 = 2;
int LA28_0 = input.LA( 1 );
if ( ( LA28_0 == 91 ) )
alt28 = 1;
else if ( ( LA28_0 == ID ) )
alt28 = 2;
else
{
var nvae_d28s0 =
new NoViableAltException( "", 28, 0, input );
throw nvae_d28s0;
}
switch ( alt28 )
{
case 1:
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:233:7: thisKeyword
{
PushFollow( FOLLOW_thisKeyword_in_entityChain1224 );
thisKeyword75 = thisKeyword();
state.followingStackPointer--;
adaptor.AddChild( root_0, thisKeyword75.Tree );
}
break;
case 2:
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:233:21: filteredEntity
{
PushFollow( FOLLOW_filteredEntity_in_entityChain1228 );
filteredEntity76 = filteredEntity();
state.followingStackPointer--;
adaptor.AddChild( root_0, filteredEntity76.Tree );
}
break;
}
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:233:38: ( '.' filteredEntity )*
do
{
int alt29 = 2;
int LA29_0 = input.LA( 1 );
if ( ( LA29_0 == 90 ) )
alt29 = 1;
switch ( alt29 )
{
case 1:
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:233:40: '.' filteredEntity
{
char_literal77 = (IToken)Match( input, 90, FOLLOW_90_in_entityChain1234 );
char_literal77_tree = (CommonTree)adaptor.Create( char_literal77 );
root_0 = (CommonTree)adaptor.BecomeRoot( char_literal77_tree, root_0 );
PushFollow( FOLLOW_filteredEntity_in_entityChain1237 );
filteredEntity78 = filteredEntity();
state.followingStackPointer--;
adaptor.AddChild( root_0, filteredEntity78.Tree );
}
break;
default:
goto loop29;
}
} while ( true );
loop29:
; // Stops C# compiler whining that label 'loop29' has no statements
}
//.........这里部分代码省略.........
开发者ID:ChrisEdwards,项目名称:CalcEngine,代码行数:101,代码来源:AntlrCalcEngineParser.cs
示例6: rootLevelStatement
// $ANTLR start "rootLevelStatement"
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:71:1: rootLevelStatement : ( formulaDeclaration | classDeclaration );
public rootLevelStatement_return rootLevelStatement() // throws RecognitionException [1]
{
var retval = new rootLevelStatement_return();
retval.Start = input.LT( 1 );
CommonTree root_0 = null;
formulaDeclaration_return formulaDeclaration2 = default( formulaDeclaration_return );
classDeclaration_return classDeclaration3 = default( classDeclaration_return );
try
{
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:72:2: ( formulaDeclaration | classDeclaration )
int alt2 = 2;
int LA2_0 = input.LA( 1 );
if ( ( LA2_0 == ID ) )
alt2 = 1;
else if ( ( LA2_0 == 57 ) )
alt2 = 2;
else
{
var nvae_d2s0 =
new NoViableAltException( "", 2, 0, input );
throw nvae_d2s0;
}
switch ( alt2 )
{
case 1:
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:72:4: formulaDeclaration
{
root_0 = (CommonTree)adaptor.GetNilNode();
PushFollow( FOLLOW_formulaDeclaration_in_rootLevelStatement242 );
formulaDeclaration2 = formulaDeclaration();
state.followingStackPointer--;
adaptor.AddChild( root_0, formulaDeclaration2.Tree );
}
break;
case 2:
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:73:4: classDeclaration
{
root_0 = (CommonTree)adaptor.GetNilNode();
PushFollow( FOLLOW_classDeclaration_in_rootLevelStatement248 );
classDeclaration3 = classDeclaration();
state.followingStackPointer--;
adaptor.AddChild( root_0, classDeclaration3.Tree );
}
break;
}
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;
}
开发者ID:ChrisEdwards,项目名称:CalcEngine,代码行数:73,代码来源:AntlrCalcEngineParser.cs
示例7: modulusOp
// $ANTLR start "modulusOp"
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:185:1: modulusOp : (x= 'mod' -> OP_MODULUS[$x] | x= '%' -> OP_MODULUS[$x] );
public modulusOp_return modulusOp() // throws RecognitionException [1]
{
var retval = new modulusOp_return();
retval.Start = input.LT( 1 );
CommonTree root_0 = null;
IToken x = null;
CommonTree x_tree = null;
var stream_78 = new RewriteRuleTokenStream( adaptor, "token 78" );
var stream_77 = new RewriteRuleTokenStream( adaptor, "token 77" );
try
{
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:186:2: (x= 'mod' -> OP_MODULUS[$x] | x= '%' -> OP_MODULUS[$x] )
int alt25 = 2;
int LA25_0 = input.LA( 1 );
if ( ( LA25_0 == 77 ) )
alt25 = 1;
else if ( ( LA25_0 == 78 ) )
alt25 = 2;
else
{
var nvae_d25s0 =
new NoViableAltException( "", 25, 0, input );
throw nvae_d25s0;
}
switch ( alt25 )
{
case 1:
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:186:4: x= 'mod'
{
x = (IToken)Match( input, 77, FOLLOW_77_in_modulusOp957 );
stream_77.Add( x );
// AST REWRITE
// elements:
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
// wildcard labels:
retval.Tree = root_0;
var stream_retval = new RewriteRuleSubtreeStream( adaptor, "rule retval", retval != null ? retval.Tree : null );
root_0 = (CommonTree)adaptor.GetNilNode();
// 186:12: -> OP_MODULUS[$x]
{
adaptor.AddChild( root_0, adaptor.Create( OP_MODULUS, x ) );
}
retval.Tree = root_0;
retval.Tree = root_0;
}
break;
case 2:
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:187:4: x= '%'
{
x = (IToken)Match( input, 78, FOLLOW_78_in_modulusOp969 );
stream_78.Add( x );
// AST REWRITE
// elements:
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
// wildcard labels:
retval.Tree = root_0;
var stream_retval = new RewriteRuleSubtreeStream( adaptor, "rule retval", retval != null ? retval.Tree : null );
root_0 = (CommonTree)adaptor.GetNilNode();
// 187:12: -> OP_MODULUS[$x]
{
adaptor.AddChild( root_0, adaptor.Create( OP_MODULUS, x ) );
}
retval.Tree = root_0;
retval.Tree = root_0;
}
break;
}
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 );
//.........这里部分代码省略.........
开发者ID:ChrisEdwards,项目名称:CalcEngine,代码行数:101,代码来源:AntlrCalcEngineParser.cs
示例8: orOp
// $ANTLR start "orOp"
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:177:1: orOp : (x= 'or' -> OP_OR[$x] | x= '||' -> OP_OR[$x] );
public orOp_return orOp() // throws RecognitionException [1]
{
var retval = new orOp_return();
retval.Start = input.LT( 1 );
CommonTree root_0 = null;
IToken x = null;
CommonTree x_tree = null;
var stream_73 = new RewriteRuleTokenStream( adaptor, "token 73" );
var stream_74 = new RewriteRuleTokenStream( adaptor, "token 74" );
try
{
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:178:2: (x= 'or' -> OP_OR[$x] | x= '||' -> OP_OR[$x] )
int alt23 = 2;
int LA23_0 = input.LA( 1 );
if ( ( LA23_0 == 73 ) )
alt23 = 1;
else if ( ( LA23_0 == 74 ) )
alt23 = 2;
else
{
var nvae_d23s0 =
new NoViableAltException( "", 23, 0, input );
throw nvae_d23s0;
}
switch ( alt23 )
{
case 1:
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:178:4: x= 'or'
{
x = (IToken)Match( input, 73, FOLLOW_73_in_orOp898 );
stream_73.Add( x );
// AST REWRITE
// elements:
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
// wildcard labels:
retval.Tree = root_0;
var stream_retval = new RewriteRuleSubtreeStream( adaptor, "rule retval", retval != null ? retval.Tree : null );
root_0 = (CommonTree)adaptor.GetNilNode();
// 178:11: -> OP_OR[$x]
{
adaptor.AddChild( root_0, adaptor.Create( OP_OR, x ) );
}
retval.Tree = root_0;
retval.Tree = root_0;
}
break;
case 2:
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:179:4: x= '||'
{
x = (IToken)Match( input, 74, FOLLOW_74_in_orOp910 );
stream_74.Add( x );
// AST REWRITE
// elements:
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
// wildcard labels:
retval.Tree = root_0;
var stream_retval = new RewriteRuleSubtreeStream( adaptor, "rule retval", retval != null ? retval.Tree : null );
root_0 = (CommonTree)adaptor.GetNilNode();
// 179:11: -> OP_OR[$x]
{
adaptor.AddChild( root_0, adaptor.Create( OP_OR, x ) );
}
retval.Tree = root_0;
retval.Tree = root_0;
}
break;
}
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 );
//.........这里部分代码省略.........
开发者ID:ChrisEdwards,项目名称:CalcEngine,代码行数:101,代码来源:AntlrCalcEngineParser.cs
示例9: expr
// $ANTLR start "expr"
// Interp.g:34:1: expr returns [Element ret] : ( assignment | structdec | structobjdec | print );
public InterpParser.expr_return expr() // throws RecognitionException [1]
{
InterpParser.expr_return retval = new InterpParser.expr_return();
retval.Start = input.LT(1);
object root_0 = null;
InterpParser.assignment_return assignment2 = null;
InterpParser.structdec_return structdec3 = null;
InterpParser.structobjdec_return structobjdec4 = null;
InterpParser.print_return print5 = null;
try
{
// Interp.g:35:3: ( assignment | structdec | structobjdec | print )
int alt2 = 4;
switch ( input.LA(1) )
{
case VARIABLE:
{
int LA2_1 = input.LA(2);
if ( (LA2_1 == ASSIGNMENT || LA2_1 == 19) )
{
alt2 = 1;
}
else if ( (LA2_1 == VARIABLE) )
{
alt2 = 3;
}
else
{
NoViableAltException nvae_d2s1 =
new NoViableAltException("", 2, 1, input);
throw nvae_d2s1;
}
}
break;
case 16:
{
alt2 = 2;
}
break;
case 20:
{
alt2 = 4;
}
break;
default:
NoViableAltException nvae_d2s0 =
new NoViableAltException("", 2, 0, input);
throw nvae_d2s0;
}
switch (alt2)
{
case 1 :
// Interp.g:35:5: assignment
{
root_0 = (object)adaptor.GetNilNode();
PushFollow(FOLLOW_assignment_in_expr92);
assignment2 = assignment();
state.followingStackPointer--;
adaptor.AddChild(root_0, assignment2.Tree);
retval.ret = ((assignment2 != null) ? assignment2.ret : null);
}
break;
case 2 :
// Interp.g:36:5: structdec
{
root_0 = (object)adaptor.GetNilNode();
PushFollow(FOLLOW_structdec_in_expr100);
structdec3 = structdec();
state.followingStackPointer--;
adaptor.AddChild(root_0, structdec3.Tree);
retval.ret = ((structdec3 != null) ? structdec3.ret : null);
}
break;
case 3 :
// Interp.g:37:5: structobjdec
{
root_0 = (object)adaptor.GetNilNode();
PushFollow(FOLLOW_structobjdec_in_expr108);
structobjdec4 = structobjdec();
//.........这里部分代码省略.........
开发者ID:shranjan,项目名称:pinac,代码行数:101,代码来源:InterpParser.cs
示例10: typeExpression
private AstParserRuleReturnScope<CommonTree, IToken> typeExpression()
{
EnterRule_typeExpression();
EnterRule("typeExpression", 71);
TraceIn("typeExpression", 71);
AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
retval.Start = (IToken)input.LT(1);
CommonTree root_0 = default(CommonTree);
IToken COLON232 = default(IToken);
IToken string_literal234 = default(IToken);
IToken STAR235 = default(IToken);
AstParserRuleReturnScope<CommonTree, IToken> typeIdentifier233 = default(AstParserRuleReturnScope<CommonTree, IToken>);
CommonTree COLON232_tree = default(CommonTree);
CommonTree string_literal234_tree = default(CommonTree);
CommonTree STAR235_tree = default(CommonTree);
RewriteRuleITokenStream stream_COLON=new RewriteRuleITokenStream(adaptor,"token COLON");
RewriteRuleITokenStream stream_257=new RewriteRuleITokenStream(adaptor,"token 257");
RewriteRuleITokenStream stream_STAR=new RewriteRuleITokenStream(adaptor,"token STAR");
RewriteRuleSubtreeStream stream_typeIdentifier=new RewriteRuleSubtreeStream(adaptor,"rule typeIdentifier");
try { DebugEnterRule(GrammarFileName, "typeExpression");
DebugLocation(567, 4);
try
{
// AS3.g:568:2: ( COLON ( typeIdentifier | 'void' | STAR ) -> ^( TYPE_SPEC COLON ( typeIdentifier )? ( 'void' )? ( STAR )? ) )
DebugEnterAlt(1);
// AS3.g:569:3: COLON ( typeIdentifier | 'void' | STAR )
{
DebugLocation(569, 3);
COLON232=(IToken)Match(input,COLON,Follow._COLON_in_typeExpression3075); if (state.failed) return retval;
if (state.backtracking == 0) stream_COLON.Add(COLON232);
DebugLocation(569, 9);
// AS3.g:569:9: ( typeIdentifier | 'void' | STAR )
int alt49=3;
try { DebugEnterSubRule(49);
try { DebugEnterDecision(49, false);
switch (input.LA(1))
{
case AS:
case DYNAMIC:
case GET:
case IDENT:
case IS:
case NAMESPACE:
case SET:
case SUPER:
case USE:
case XML:
{
alt49 = 1;
}
break;
case 257:
{
alt49 = 2;
}
break;
case STAR:
{
alt49 = 3;
}
break;
default:
{
if (state.backtracking>0) {state.failed=true; return retval;}
NoViableAltException nvae = new NoViableAltException("", 49, 0, input, 1);
DebugRecognitionException(nvae);
throw nvae;
}
}
} finally { DebugExitDecision(49); }
switch (alt49)
{
case 1:
DebugEnterAlt(1);
// AS3.g:569:10: typeIdentifier
{
DebugLocation(569, 10);
PushFollow(Follow._typeIdentifier_in_typeExpression3078);
typeIdentifier233=typeIdentifier();
PopFollow();
if (state.failed) return retval;
if (state.backtracking == 0) stream_typeIdentifier.Add(typeIdentifier233.Tree);
}
break;
case 2:
DebugEnterAlt(2);
// AS3.g:569:27: 'void'
{
DebugLocation(569, 27);
string_literal234=(IToken)Match(input,257,Follow._257_in_typeExpression3082); if (state.failed) return retval;
if (state.backtracking == 0) stream_257.Add(string_literal234);
}
//.........这里部分代码省略.........
开发者ID:jbakst,项目名称:xas,代码行数:101,代码来源:AS3Parser.cs
示例11: forInClauseDecl
private AstParserRuleReturnScope<CommonTree, IToken> forInClauseDecl()
{
EnterRule_forInClauseDecl();
EnterRule("forInClauseDecl", 62);
TraceIn("forInClauseDecl", 62);
AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
retval.Start = (IToken)input.LT(1);
CommonTree root_0 = default(CommonTree);
AstParserRuleReturnScope<CommonTree, IToken> varOrConst206 = default(AstParserRuleReturnScope<CommonTree, IToken>);
AstParserRuleReturnScope<CommonTree, IToken> ident207 = default(AstParserRuleReturnScope<CommonTree, IToken>);
AstParserRuleReturnScope<CommonTree, IToken> typeExpression208 = default(AstParserRuleReturnScope<CommonTree, IToken>);
AstParserRuleReturnScope<CommonTree, IToken> ident209 = default(AstParserRuleReturnScope<CommonTree, IToken>);
try { DebugEnterRule(GrammarFileName, "forInClauseDecl");
DebugLocation(522, 1);
try
{
// AS3.g:523:2: ( varOrConst ident ( typeExpression )? | ident )
int alt45=2;
try { DebugEnterDecision(45, false);
int LA45_1 = input.LA(1);
if ((LA45_1==CONST||LA45_1==VAR))
{
alt45 = 1;
}
else if ((LA45_1==AS||LA45_1==DYNAMIC||LA45_1==GET||LA45_1==IDENT||LA45_1==IS||LA45_1==NAMESPACE||LA45_1==SET||LA45_1==SUPER||LA45_1==USE||LA45_1==XML))
{
alt45 = 2;
}
else
{
if (state.backtracking>0) {state.failed=true; return retval;}
NoViableAltException nvae = new NoViableAltException("", 45, 0, input, 1);
DebugRecognitionException(nvae);
throw nvae;
}
} finally { DebugExitDecision(45); }
switch (alt45)
{
case 1:
DebugEnterAlt(1);
// AS3.g:523:4: varOrConst ident ( typeExpression )?
{
root_0 = (CommonTree)adaptor.Nil();
DebugLocation(523, 4);
PushFollow(Follow._varOrConst_in_forInClauseDecl2840);
varOrConst206=varOrConst();
PopFollow();
if (state.failed) return retval;
if (state.backtracking == 0) adaptor.AddChild(root_0, varOrConst206.Tree);
DebugLocation(523, 15);
PushFollow(Follow._ident_in_forInClauseDecl2842);
ident207=ident();
PopFollow();
if (state.failed) return retval;
if (state.backtracking == 0) adaptor.AddChild(root_0, ident207.Tree);
DebugLocation(523, 21);
// AS3.g:523:21: ( typeExpression )?
int alt44=2;
try { DebugEnterSubRule(44);
try { DebugEnterDecision(44, false);
int LA44_1 = input.LA(1);
if ((LA44_1==COLON))
{
alt44 = 1;
}
} finally { DebugExitDecision(44); }
switch (alt44)
{
case 1:
DebugEnterAlt(1);
// AS3.g:523:21: typeExpression
{
DebugLocation(523, 21);
PushFollow(Follow._typeExpression_in_forInClauseDecl2844);
typeExpression208=typeExpression();
PopFollow();
if (state.failed) return retval;
if (state.backtracking == 0) adaptor.AddChild(root_0, typeExpression208.Tree);
}
break;
}
} finally { DebugExitSubRule(44); }
}
break;
case 2:
DebugEnterAlt(2);
// AS3.g:524:11: ident
{
root_0 = (CommonTree)adaptor.Nil();
//.........这里部分代码省略.........
开发者ID:jbakst,项目名称:xas,代码行数:101,代码来源:AS3Parser.cs
示例12: statement
private AstParserRuleReturnScope<CommonTree, IToken> statement()
{
EnterRule_statement();
EnterRule("statement", 41);
TraceIn("statement", 41);
AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
retval.Start = (IToken)input.LT(1);
CommonTree root_0 = default(CommonTree);
AstParserRuleReturnScope<CommonTree, IToken> block130 = default(AstParserRuleReturnScope<CommonTree, IToken>);
AstParserRuleReturnScope<CommonTree, IToken> declarationStatement131 = default(AstParserRuleReturnScope<CommonTree, IToken>);
AstParserRuleReturnScope<CommonTree, IToken> expressionStatement132 = default(AstParserRuleReturnScope<CommonTree, IToken>);
AstParserRuleReturnScope<CommonTree, IToken> ifStatement133 = default(AstParserRuleReturnScope<CommonTree, IToken>);
AstParserRuleReturnScope<CommonTree, IToken> forEachStatement134 = default(AstParserRuleReturnScope<CommonTree, IToken>);
AstParserRuleReturnScope<CommonTree, IToken> whileStatement135 = default(AstParserRuleReturnScope<CommonTree, IToken>);
AstParserRuleReturnScope<CommonTree, IToken> doWhileStatement136 = default(AstParserRuleReturnScope<CommonTree, IToken>);
AstParserRuleReturnScope<CommonTree, IToken> withStatement137 = default(AstParserRuleReturnScope<CommonTree, IToken>);
AstParserRuleReturnScope<CommonTree, IToken> switchStatement138 = default(AstParserRuleReturnScope<CommonTree, IToken>);
AstParserRuleReturnScope<CommonTree, IToken> breakStatement139 = default(AstParserRuleReturnScope<CommonTree, IToken>);
AstParserRuleReturnScope<CommonTree, IToken> continueStatement140 = default(AstParserRuleReturnScope<CommonTree, IToken>);
AstParserRuleReturnScope<CommonTree, IToken> returnStatement141 = default(AstParserRuleReturnScope<CommonTree, IToken>);
AstParserRuleReturnScope<CommonTree, IToken> throwStatement142 = default(AstParserRuleReturnScope<CommonTree, IToken>);
AstParserRuleReturnScope<CommonTree, IToken> tryStatement143 = default(AstParserRuleReturnScope<CommonTree, IToken>);
AstParserRuleReturnScope<CommonTree, IToken> defaultXMLNamespaceStatement144 = default(AstParserRuleReturnScope<CommonTree, IToken>);
AstParserRuleReturnScope<CommonTree, IToken> semi145 = default(AstParserRuleReturnScope<CommonTree, IToken>);
try { DebugEnterRule(GrammarFileName, "statement");
DebugLocation(371, 1);
try
{
// AS3.g:372:2: ( ( LCURLY )=> block | declarationStatement | expressionStatement | ifStatement | forEachStatement | whileStatement | doWhileStatement | withStatement | switchStatement | breakStatement | continueStatement | returnStatement | throwStatement | tryStatement | defaultXMLNamespaceStatement | semi )
int alt34=16;
try { DebugEnterDecision(34, false);
switch (input.LA(1))
{
case LCURLY:
{
int LA34_2 = input.LA(2);
if ((EvaluatePredicate(synpred13_AS3_fragment)))
{
alt34 = 1;
}
else if ((true))
{
alt34 = 3;
}
else
{
if (state.backtracking>0) {state.failed=true; return retval;}
NoViableAltException nvae = new NoViableAltException("", 34, 1, input, 2);
DebugRecognitionException(nvae);
throw nvae;
}
}
break;
case CONST:
case VAR:
{
alt34 = 2;
}
break;
case AS:
case BNOT:
case DEC:
case DECIMAL_LITERAL:
case DYNAMIC:
case E4X_ATTRI:
case FALSE:
case FLOAT_LITERAL:
case FUNCTION:
case GET:
case HEX_LITERAL:
case IDENT:
case INC:
case INTERNAL:
case IS:
case LBRACK:
case LNOT:
case LPAREN:
case MINUS:
case NAMESPACE:
case NEW:
case NULL:
case OCTAL_LITERAL:
case PLUS:
case PRIVATE:
case PROTECTED:
case PUBLIC:
case REGEX_LITERAL:
case SET:
case STRING_LITERAL_DOUBLE:
case STRING_LITERAL_SINGLE:
case SUPER:
case TRUE:
case USE:
case XML:
case XML_LITERAL:
case 243:
//.........这里部分代码省略.........
开发者ID:jbakst,项目名称:xas,代码行数:101,代码来源:AS3Parser.cs
示例13: parameterDeclaration
private AstParserRuleReturnScope<CommonTree, IToken> parameterDeclaration()
{
EnterRule_parameterDeclaration();
EnterRule("parameterDeclaration", 34);
TraceIn("parameterDeclaration", 34);
AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
retval.Start = (IToken)input.LT(1);
CommonTree root_0 = default(CommonTree);
AstParserRuleReturnScope<CommonTree, IToken> basicParameterDeclaration112 = default(AstParserRuleReturnScope<CommonTree, IToken>);
AstParserRuleReturnScope<CommonTree, IToken> parameterRestDeclaration113 = default(AstParserRuleReturnScope<CommonTree, IToken>);
try { DebugEnterRule(GrammarFileName, "parameterDeclaration");
DebugLocation(339, 1);
try
{
// AS3.g:340:2: ( basicParameterDeclaration | parameterRestDeclaration )
int alt27=2;
try { DebugEnterDecision(27, false);
int LA27_1 = input.LA(1);
if ((LA27_1==AS||LA27_1==CONST||LA27_1==DYNAMIC||LA27_1==GET||LA27_1==IDENT||LA27_1==IS||LA27_1==NAMESPACE||LA27_1==SET||LA27_1==SUPER||LA27_1==USE||LA27_1==XML))
{
alt27 = 1;
}
else if ((LA27_1==REST))
{
alt27 = 2;
}
else
{
if (state.backtracking>0) {state.failed=true; return retval;}
NoViableAltException nvae = new NoViableAltException("", 27, 0, input, 1);
DebugRecognitionException(nvae);
throw nvae;
}
} finally { DebugExitDecision(27); }
switch (alt27)
{
case 1:
DebugEnterAlt(1);
// AS3.g:340:4: basicParameterDeclaration
{
root_0 = (CommonTree)adaptor.Nil();
DebugLocation(340, 4);
PushFollow(Follow._basicParameterDeclaration_in_parameterDeclaration1862);
basicParameterDeclaration112=basicParameterDeclaration();
PopFollow();
if (state.failed) return retval;
if (state.backtracking == 0) adaptor.AddChild(root_0, basicParameterDeclaration112.Tree);
}
break;
case 2:
DebugEnterAlt(2);
// AS3.g:340:32: parameterRestDeclaration
{
root_0 = (CommonTree)adaptor.Nil();
DebugLocation(340, 32);
PushFollow(Follow._parameterRestDeclaration_in_parameterDeclaration1866);
parameterRestDeclaration113=parameterRestDeclaration();
PopFollow();
if (state.failed) return retval;
if (state.backtracking == 0) adaptor.AddChild(root_0, parameterRestDeclaration113.Tree);
}
break;
}
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("parameterDeclaration", 34);
LeaveRule("parameterDeclaration", 34);
LeaveRule_parameterDeclaration();
}
DebugLocation(341, 1);
} finally { DebugExitRule(GrammarFileName, "parameterDeclaration"); }
return retval;
}
开发者ID:jbakst,项目名称:xas,代码行数:97,代码来源:AS3Parser.cs
示例14: compilationUnit
public AstParserRuleReturnScope<CommonTree, IToken> compilationUnit()
{
EnterRule_compilationUnit();
EnterRule("compilationUnit", 1);
TraceIn("compilationUnit", 1);
AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
retval.Start = (IToken)input.LT(1);
CommonTree root_0 = default(CommonTree);
AstParserRuleReturnScope<CommonTree, IToken> as2CompilationUnit1 = default(AstParserRuleReturnScope<CommonTree, IToken>);
AstParserRuleReturnScope<CommonTree, IToken> as3CompilationUnit2 = default(AstParserRuleReturnScope<CommonTree, IToken>);
RewriteRuleSubtreeStream stream_as2CompilationUnit=new RewriteRuleSubtreeStream(adaptor,"rule as2CompilationUnit");
RewriteRuleSubtreeStream stream_as3CompilationUnit=new RewriteRuleSubtreeStream(adaptor,"rule as3CompilationUnit");
try { DebugEnterRule(GrammarFileName, "compilationUnit");
DebugLocation(114, 1);
try
{
// AS3.g:115:2: ( ( as2CompilationUnit | as3CompilationUnit ) -> ^( COMPILATION_UNIT ( as2CompilationUnit )? ( as3CompilationUnit )? ) )
DebugEnterAlt(1);
// AS3.g:115:4: ( as2CompilationUnit | as3CompilationUnit )
{
DebugLocation(115, 4);
// AS3.g:115:4: ( as2CompilationUnit | as3CompilationUnit )
int alt1=2;
try { DebugEnterSubRule(1);
try { DebugEnterDecision(1, false);
int LA1_1 = input.LA(1);
if ((LA1_1==CLASS||LA1_1==DYNAMIC||LA1_1==IDENT||LA1_1==IMPORT||(LA1_1>=INCLUDE_DIRECTIVE && LA1_1<=INTERFACE)||LA1_1==INTERNAL||LA1_1==PRIVATE||(LA1_1>=PROTECTED && LA1_1<=PUBLIC)||LA1_1==STATIC||(LA1_1>=244 && LA1_1<=246)||LA1_1==250||LA1_1==252))
{
alt1 = 1;
}
else if ((LA1_1==PACKAGE))
{
alt1 = 2;
}
else
{
if (state.backtracking>0) {state.failed=true; return retval;}
NoViableAltException nvae = new NoViableAltException("", 1, 0, input, 1);
DebugRecognitionException(nvae);
throw nvae;
}
} finally { DebugExitDecision(1); }
switch (alt1)
{
case 1:
DebugEnterAlt(1);
// AS3.g:115:6: as2CompilationUnit
{
DebugLocation(115, 6);
PushFollow(Follow._as2CompilationUnit_in_compilationUnit476);
as2CompilationUnit1=as2CompilationUnit();
PopFollow();
if (state.failed) return retval;
if (state.backtracking == 0) stream_as2CompilationUnit.Add(as2CompilationUnit1.Tree);
}
break;
case 2:
DebugEnterAlt(2);
// AS3.g:116:5: as3CompilationUnit
{
DebugLocation(116, 5);
PushFollow(Follow._as3CompilationUnit_in_compilationUnit482);
as3CompilationUnit2=as3CompilationUnit();
PopFollow();
if (state.failed) return retval;
if (state.backtracking == 0) stream_as3CompilationUnit.Add(as3CompilationUnit2.Tree);
}
break;
}
} finally { DebugExitSubRule(1); }
{
// AST REWRITE
// elements: as2CompilationUnit, as3CompilationUnit
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
// wildcard labels:
if (state.backtracking == 0) {
retval.Tree = root_0;
RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null);
root_0 = (CommonTree)adaptor.Nil();
// 117:5: -> ^( COMPILATION_UNIT ( as2CompilationUnit )? ( as3CompilationUnit )? )
{
DebugLocation(117, 8);
// AS3.g:117:8: ^( COMPILATION_UNIT ( as2CompilationUnit )? ( as3CompilationUnit )? )
{
CommonTree root_1 = (CommonTree)adaptor.Nil();
DebugLocation(117, 10);
//.........这里部分代码省略.........
开发者ID:jbakst,项目名称:xas,代码行数:101,代码来源:AS3Parser.cs
示例15: SpecialStateTransition20
private int SpecialStateTransition20(DFA dfa, int s, IIntStream _input)
{
ITokenStream input = (ITokenStream)_input;
int _s = s;
s = -1;
int LA20_1 = input.LA(1);
int index20_1 = input.Index;
switch (_s)
{
case 0:
{
input.Rewind();
if ((EvaluatePredicate(synpred12_AS3_fragment))) {s = 62;}
else if ((true)) {s = 2;}
input.Seek(index20_1);
break;
}
default:
break;
}
if (s >= 0)
return s;
if (state.backtracking > 0) {state.failed=true; return -1;}
NoViableAltException nvae = new NoViableAltException(dfa.Description, 20, _s, input);
dfa.Error(nvae);
throw nvae;
}
开发者ID:jbakst,项目名称:xas,代码行数:32,代码来源:AS3Parser.cs
示例16: multiplicativeExpr
// $ANTLR start "multiplicativeExpr"
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:150:1: multiplicativeExpr : unaryExpr ( ( multiplyOp | divideOp | modulusOp ) unaryExpr )* ;
public multiplicativeExpr_return multiplicativeExpr() // throws RecognitionException [1]
{
var retval = new multiplicativeExpr_return();
retval.Start = input.LT( 1 );
CommonTree root_0 = null;
unaryExpr_return unaryExpr58 = default( unaryExpr_return );
multiplyOp_return multiplyOp59 = default( multiplyOp_return );
divideOp_return divideOp60 = default( divideOp_return );
modulusOp_return modulusOp61 = default( modulusOp_return );
unaryExpr_return unaryExpr62 = default( unaryExpr_return );
try
{
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:151:2: ( unaryExpr ( ( multiplyOp | divideOp | modulusOp ) unaryExpr )* )
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:151:4: unaryExpr ( ( multiplyOp | divideOp | modulusOp ) unaryExpr )*
{
root_0 = (CommonTree)adaptor.GetNilNode();
PushFollow( FOLLOW_unaryExpr_in_multiplicativeExpr749 );
unaryExpr58 = unaryExpr();
state.followingStackPointer--;
adaptor.AddChild( root_0, unaryExpr58.Tree );
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:151:14: ( ( multiplyOp | divideOp | modulusOp ) unaryExpr )*
do
{
int alt18 = 2;
int LA18_0 = input.LA( 1 );
if ( ( ( LA18_0 >= 77 && LA18_0 <= 78 ) || ( LA18_0 >= 88 && LA18_0 <= 89 ) ) )
alt18 = 1;
switch ( alt18 )
{
case 1:
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:151:16: ( multiplyOp | divideOp | modulusOp ) unaryExpr
{
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:151:16: ( multiplyOp | divideOp | modulusOp )
int alt17 = 3;
switch ( input.LA( 1 ) )
{
case 88:
{
alt17 = 1;
}
break;
case 89:
{
alt17 = 2;
}
break;
case 77:
case 78:
{
alt17 = 3;
}
break;
default:
var nvae_d17s0 =
new NoViableAltException( "", 17, 0, input );
throw nvae_d17s0;
}
switch ( alt17 )
{
case 1:
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:151:18: multiplyOp
{
PushFollow( FOLLOW_multiplyOp_in_multiplicativeExpr755 );
multiplyOp59 = multiplyOp();
state.followingStackPointer--;
root_0 = (CommonTree)adaptor.BecomeRoot( multiplyOp59.Tree, root_0 );
}
break;
case 2:
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:151:32: divideOp
{
PushFollow( FOLLOW_divideOp_in_multiplicativeExpr760 );
divideOp60 = divideOp();
state.followingStackPointer--;
root_0 = (CommonTree)adaptor.BecomeRoot( divideOp60.Tree, root_0 );
}
break;
case 3:
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:151:44: modulusOp
{
PushFollow( FOLLOW_modulusOp_in_multiplicativeExpr765 );
//.........这里部分代码省略.........
开发者ID:ChrisEdwards,项目名称:CalcEngine,代码行数:101 |
请发表评论