PageRenderTime 64ms CodeModel.GetById 28ms RepoModel.GetById 0ms app.codeStats 0ms

/antlr-3.4/runtime/CSharp3/Sources/Antlr3.Runtime.Test/BuildOptions/ProfileGrammarParser.cs

https://bitbucket.org/cyanogenmod/android_external_antlr
C# | 1560 lines | 1153 code | 292 blank | 115 comment | 60 complexity | 6872f734df0523f5c9f47a6b76fe44da MD5 | raw file
  1. // $ANTLR 3.1.2 BuildOptions\\ProfileGrammar.g3 2009-09-30 13:18:17
  2. // The variable 'variable' is assigned but its value is never used.
  3. #pragma warning disable 219
  4. // Unreachable code detected.
  5. #pragma warning disable 162
  6. using System.Collections.Generic;
  7. using Antlr.Runtime;
  8. using Stack = System.Collections.Generic.Stack<object>;
  9. using List = System.Collections.IList;
  10. using ArrayList = System.Collections.Generic.List<object>;
  11. using Antlr.Runtime.Debug;
  12. using IOException = System.IO.IOException;
  13. using Antlr.Runtime.Tree;
  14. using RewriteRuleITokenStream = Antlr.Runtime.Tree.RewriteRuleTokenStream;
  15. [System.CodeDom.Compiler.GeneratedCode("ANTLR", "3.1.2")]
  16. [System.CLSCompliant(false)]
  17. public partial class ProfileGrammarParser : DebugParser
  18. {
  19. internal static readonly string[] tokenNames = new string[] {
  20. "<invalid>", "<EOR>", "<DOWN>", "<UP>", "CALL", "FUNC", "ID", "INT", "NEWLINE", "WS", "'-'", "'%'", "'('", "')'", "'*'", "'/'", "'+'", "'='"
  21. };
  22. public const int EOF=-1;
  23. public const int T__10=10;
  24. public const int T__11=11;
  25. public const int T__12=12;
  26. public const int T__13=13;
  27. public const int T__14=14;
  28. public const int T__15=15;
  29. public const int T__16=16;
  30. public const int T__17=17;
  31. public const int CALL=4;
  32. public const int FUNC=5;
  33. public const int ID=6;
  34. public const int INT=7;
  35. public const int NEWLINE=8;
  36. public const int WS=9;
  37. // delegates
  38. // delegators
  39. public static readonly string[] ruleNames =
  40. new string[]
  41. {
  42. "invalidRule", "atom", "expr", "formalPar", "func", "multExpr", "prog",
  43. "stat"
  44. };
  45. int ruleLevel = 0;
  46. public virtual int RuleLevel { get { return ruleLevel; } }
  47. public virtual void IncRuleLevel() { ruleLevel++; }
  48. public virtual void DecRuleLevel() { ruleLevel--; }
  49. public ProfileGrammarParser( ITokenStream input )
  50. : this( input, new Profiler(null), new RecognizerSharedState() )
  51. {
  52. }
  53. public ProfileGrammarParser( ITokenStream input, IDebugEventListener dbg, RecognizerSharedState state )
  54. : base( input, dbg, state )
  55. {
  56. Profiler p = (Profiler)dbg;
  57. p.setParser(this);
  58. InitializeTreeAdaptor();
  59. if ( TreeAdaptor == null )
  60. TreeAdaptor = new CommonTreeAdaptor();
  61. ITreeAdaptor adap = new CommonTreeAdaptor();
  62. TreeAdaptor = adap;
  63. proxy.TreeAdaptor = adap;
  64. }
  65. public ProfileGrammarParser( ITokenStream input, IDebugEventListener dbg )
  66. : base( input, dbg )
  67. {
  68. Profiler p = (Profiler)dbg;
  69. p.setParser(this);InitializeTreeAdaptor();
  70. if ( TreeAdaptor == null )
  71. TreeAdaptor = new CommonTreeAdaptor();
  72. ITreeAdaptor adap = new CommonTreeAdaptor();
  73. TreeAdaptor = adap;
  74. }
  75. public virtual bool AlreadyParsedRule( IIntStream input, int ruleIndex )
  76. {
  77. ((Profiler)dbg).ExamineRuleMemoization(input, ruleIndex, ProfileGrammarParser.ruleNames[ruleIndex]);
  78. return super.AlreadyParsedRule(input, ruleIndex);
  79. }
  80. public virtual void Memoize( IIntStream input, int ruleIndex, int ruleStartIndex )
  81. {
  82. ((Profiler)dbg).Memoize(input, ruleIndex, ruleStartIndex, ProfileGrammarParser.ruleNames[ruleIndex]);
  83. super.Memoize(input, ruleIndex, ruleStartIndex);
  84. }
  85. protected virtual bool EvalPredicate( bool result, string predicate )
  86. {
  87. dbg.SemanticPredicate( result, predicate );
  88. return result;
  89. }
  90. // Implement this function in your helper file to use a custom tree adaptor
  91. partial void InitializeTreeAdaptor();
  92. protected DebugTreeAdaptor adaptor;
  93. public ITreeAdaptor TreeAdaptor
  94. {
  95. get
  96. {
  97. return adaptor;
  98. }
  99. set
  100. {
  101. this.adaptor = new DebugTreeAdaptor(dbg,adaptor);
  102. }
  103. }
  104. public override string[] TokenNames { get { return ProfileGrammarParser.tokenNames; } }
  105. public override string GrammarFileName { get { return "BuildOptions\\ProfileGrammar.g3"; } }
  106. #region Rules
  107. public class prog_return : ParserRuleReturnScope
  108. {
  109. internal CommonTree tree;
  110. public override object Tree { get { return tree; } }
  111. }
  112. // $ANTLR start "prog"
  113. // BuildOptions\\ProfileGrammar.g3:50:0: prog : ( stat )* ;
  114. private ProfileGrammarParser.prog_return prog( )
  115. {
  116. ProfileGrammarParser.prog_return retval = new ProfileGrammarParser.prog_return();
  117. retval.start = input.LT(1);
  118. CommonTree root_0 = null;
  119. ProfileGrammarParser.stat_return stat1 = default(ProfileGrammarParser.stat_return);
  120. try
  121. {
  122. dbg.EnterRule( GrammarFileName, "prog" );
  123. if ( RuleLevel == 0 )
  124. {
  125. dbg.Commence();
  126. }
  127. IncRuleLevel();
  128. dbg.Location( 50, -1 );
  129. try
  130. {
  131. // BuildOptions\\ProfileGrammar.g3:50:7: ( ( stat )* )
  132. dbg.EnterAlt( 1 );
  133. // BuildOptions\\ProfileGrammar.g3:50:7: ( stat )*
  134. {
  135. root_0 = (CommonTree)adaptor.Nil();
  136. dbg.Location( 50, 6 );
  137. // BuildOptions\\ProfileGrammar.g3:50:7: ( stat )*
  138. try
  139. {
  140. dbg.EnterSubRule( 1 );
  141. for ( ; ; )
  142. {
  143. int alt1=2;
  144. try
  145. {
  146. dbg.EnterDecision( 1 );
  147. int LA1_0 = input.LA(1);
  148. if ( ((LA1_0>=ID && LA1_0<=NEWLINE)||LA1_0==12) )
  149. {
  150. alt1=1;
  151. }
  152. }
  153. finally
  154. {
  155. dbg.ExitDecision( 1 );
  156. }
  157. switch ( alt1 )
  158. {
  159. case 1:
  160. dbg.EnterAlt( 1 );
  161. // BuildOptions\\ProfileGrammar.g3:50:9: stat
  162. {
  163. dbg.Location( 50, 8 );
  164. PushFollow(Follow._stat_in_prog53);
  165. stat1=stat();
  166. state._fsp--;
  167. adaptor.AddChild(root_0, stat1.Tree);
  168. }
  169. break;
  170. default:
  171. goto loop1;
  172. }
  173. }
  174. loop1:
  175. ;
  176. }
  177. finally
  178. {
  179. dbg.ExitSubRule( 1 );
  180. }
  181. }
  182. retval.stop = input.LT(-1);
  183. retval.tree = (CommonTree)adaptor.RulePostProcessing(root_0);
  184. adaptor.SetTokenBoundaries(retval.tree, retval.start, retval.stop);
  185. }
  186. catch ( RecognitionException re )
  187. {
  188. ReportError(re);
  189. Recover(input,re);
  190. retval.tree = (CommonTree)adaptor.ErrorNode(input, retval.start, input.LT(-1), re);
  191. }
  192. finally
  193. {
  194. }
  195. dbg.Location(51, 4);
  196. }
  197. finally
  198. {
  199. dbg.ExitRule( GrammarFileName, "prog" );
  200. DecRuleLevel();
  201. if ( RuleLevel == 0 )
  202. {
  203. dbg.Terminate();
  204. }
  205. }
  206. return retval;
  207. }
  208. // $ANTLR end "prog"
  209. public class stat_return : ParserRuleReturnScope
  210. {
  211. internal CommonTree tree;
  212. public override object Tree { get { return tree; } }
  213. }
  214. // $ANTLR start "stat"
  215. // BuildOptions\\ProfileGrammar.g3:53:0: stat : ( expr NEWLINE -> expr | ID '=' expr NEWLINE -> ^( '=' ID expr ) | func NEWLINE -> func | NEWLINE ->);
  216. private ProfileGrammarParser.stat_return stat( )
  217. {
  218. ProfileGrammarParser.stat_return retval = new ProfileGrammarParser.stat_return();
  219. retval.start = input.LT(1);
  220. CommonTree root_0 = null;
  221. IToken NEWLINE3=null;
  222. IToken ID4=null;
  223. IToken char_literal5=null;
  224. IToken NEWLINE7=null;
  225. IToken NEWLINE9=null;
  226. IToken NEWLINE10=null;
  227. ProfileGrammarParser.expr_return expr2 = default(ProfileGrammarParser.expr_return);
  228. ProfileGrammarParser.expr_return expr6 = default(ProfileGrammarParser.expr_return);
  229. ProfileGrammarParser.func_return func8 = default(ProfileGrammarParser.func_return);
  230. CommonTree NEWLINE3_tree=null;
  231. CommonTree ID4_tree=null;
  232. CommonTree char_literal5_tree=null;
  233. CommonTree NEWLINE7_tree=null;
  234. CommonTree NEWLINE9_tree=null;
  235. CommonTree NEWLINE10_tree=null;
  236. RewriteRuleITokenStream stream_NEWLINE=new RewriteRuleITokenStream(adaptor,"token NEWLINE");
  237. RewriteRuleITokenStream stream_ID=new RewriteRuleITokenStream(adaptor,"token ID");
  238. RewriteRuleITokenStream stream_17=new RewriteRuleITokenStream(adaptor,"token 17");
  239. RewriteRuleSubtreeStream stream_expr=new RewriteRuleSubtreeStream(adaptor,"rule expr");
  240. RewriteRuleSubtreeStream stream_func=new RewriteRuleSubtreeStream(adaptor,"rule func");
  241. try
  242. {
  243. dbg.EnterRule( GrammarFileName, "stat" );
  244. if ( RuleLevel == 0 )
  245. {
  246. dbg.Commence();
  247. }
  248. IncRuleLevel();
  249. dbg.Location( 53, -1 );
  250. try
  251. {
  252. // BuildOptions\\ProfileGrammar.g3:53:9: ( expr NEWLINE -> expr | ID '=' expr NEWLINE -> ^( '=' ID expr ) | func NEWLINE -> func | NEWLINE ->)
  253. int alt2=4;
  254. try
  255. {
  256. dbg.EnterDecision( 2 );
  257. try
  258. {
  259. isCyclicDecision = true;
  260. alt2 = dfa2.Predict(input);
  261. }
  262. catch ( NoViableAltException nvae )
  263. {
  264. dbg.RecognitionException( nvae );
  265. throw nvae;
  266. }
  267. }
  268. finally
  269. {
  270. dbg.ExitDecision( 2 );
  271. }
  272. switch ( alt2 )
  273. {
  274. case 1:
  275. dbg.EnterAlt( 1 );
  276. // BuildOptions\\ProfileGrammar.g3:53:9: expr NEWLINE
  277. {
  278. dbg.Location( 53, 8 );
  279. PushFollow(Follow._expr_in_stat70);
  280. expr2=expr();
  281. state._fsp--;
  282. stream_expr.Add(expr2.Tree);
  283. dbg.Location( 53, 13 );
  284. NEWLINE3=(IToken)Match(input,NEWLINE,Follow._NEWLINE_in_stat72);
  285. stream_NEWLINE.Add(NEWLINE3);
  286. {
  287. // AST REWRITE
  288. // elements: expr
  289. // token labels:
  290. // rule labels: retval
  291. // token list labels:
  292. // rule list labels:
  293. // wildcard labels:
  294. retval.tree = root_0;
  295. RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);
  296. root_0 = (CommonTree)adaptor.Nil();
  297. // 53:41: -> expr
  298. {
  299. dbg.Location( 53, 43 );
  300. adaptor.AddChild(root_0, stream_expr.NextTree());
  301. }
  302. retval.tree = root_0;
  303. }
  304. }
  305. break;
  306. case 2:
  307. dbg.EnterAlt( 2 );
  308. // BuildOptions\\ProfileGrammar.g3:54:9: ID '=' expr NEWLINE
  309. {
  310. dbg.Location( 54, 8 );
  311. ID4=(IToken)Match(input,ID,Follow._ID_in_stat105);
  312. stream_ID.Add(ID4);
  313. dbg.Location( 54, 11 );
  314. char_literal5=(IToken)Match(input,17,Follow._17_in_stat107);
  315. stream_17.Add(char_literal5);
  316. dbg.Location( 54, 15 );
  317. PushFollow(Follow._expr_in_stat109);
  318. expr6=expr();
  319. state._fsp--;
  320. stream_expr.Add(expr6.Tree);
  321. dbg.Location( 54, 20 );
  322. NEWLINE7=(IToken)Match(input,NEWLINE,Follow._NEWLINE_in_stat111);
  323. stream_NEWLINE.Add(NEWLINE7);
  324. {
  325. // AST REWRITE
  326. // elements: 17, ID, expr
  327. // token labels:
  328. // rule labels: retval
  329. // token list labels:
  330. // rule list labels:
  331. // wildcard labels:
  332. retval.tree = root_0;
  333. RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);
  334. root_0 = (CommonTree)adaptor.Nil();
  335. // 54:41: -> ^( '=' ID expr )
  336. {
  337. dbg.Location( 54, 43 );
  338. // BuildOptions\\ProfileGrammar.g3:54:44: ^( '=' ID expr )
  339. {
  340. CommonTree root_1 = (CommonTree)adaptor.Nil();
  341. dbg.Location( 54, 45 );
  342. root_1 = (CommonTree)adaptor.BecomeRoot(stream_17.NextNode(), root_1);
  343. dbg.Location( 54, 49 );
  344. adaptor.AddChild(root_1, stream_ID.NextNode());
  345. dbg.Location( 54, 52 );
  346. adaptor.AddChild(root_1, stream_expr.NextTree());
  347. adaptor.AddChild(root_0, root_1);
  348. }
  349. }
  350. retval.tree = root_0;
  351. }
  352. }
  353. break;
  354. case 3:
  355. dbg.EnterAlt( 3 );
  356. // BuildOptions\\ProfileGrammar.g3:55:9: func NEWLINE
  357. {
  358. dbg.Location( 55, 8 );
  359. PushFollow(Follow._func_in_stat143);
  360. func8=func();
  361. state._fsp--;
  362. stream_func.Add(func8.Tree);
  363. dbg.Location( 55, 13 );
  364. NEWLINE9=(IToken)Match(input,NEWLINE,Follow._NEWLINE_in_stat145);
  365. stream_NEWLINE.Add(NEWLINE9);
  366. {
  367. // AST REWRITE
  368. // elements: func
  369. // token labels:
  370. // rule labels: retval
  371. // token list labels:
  372. // rule list labels:
  373. // wildcard labels:
  374. retval.tree = root_0;
  375. RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);
  376. root_0 = (CommonTree)adaptor.Nil();
  377. // 55:41: -> func
  378. {
  379. dbg.Location( 55, 43 );
  380. adaptor.AddChild(root_0, stream_func.NextTree());
  381. }
  382. retval.tree = root_0;
  383. }
  384. }
  385. break;
  386. case 4:
  387. dbg.EnterAlt( 4 );
  388. // BuildOptions\\ProfileGrammar.g3:56:9: NEWLINE
  389. {
  390. dbg.Location( 56, 8 );
  391. NEWLINE10=(IToken)Match(input,NEWLINE,Follow._NEWLINE_in_stat178);
  392. stream_NEWLINE.Add(NEWLINE10);
  393. {
  394. // AST REWRITE
  395. // elements:
  396. // token labels:
  397. // rule labels: retval
  398. // token list labels:
  399. // rule list labels:
  400. // wildcard labels:
  401. retval.tree = root_0;
  402. RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);
  403. root_0 = (CommonTree)adaptor.Nil();
  404. // 56:41: ->
  405. {
  406. dbg.Location( 57, 4 );
  407. root_0 = null;
  408. }
  409. retval.tree = root_0;
  410. }
  411. }
  412. break;
  413. }
  414. retval.stop = input.LT(-1);
  415. retval.tree = (CommonTree)adaptor.RulePostProcessing(root_0);
  416. adaptor.SetTokenBoundaries(retval.tree, retval.start, retval.stop);
  417. }
  418. catch ( RecognitionException re )
  419. {
  420. ReportError(re);
  421. Recover(input,re);
  422. retval.tree = (CommonTree)adaptor.ErrorNode(input, retval.start, input.LT(-1), re);
  423. }
  424. finally
  425. {
  426. }
  427. dbg.Location(57, 4);
  428. }
  429. finally
  430. {
  431. dbg.ExitRule( GrammarFileName, "stat" );
  432. DecRuleLevel();
  433. if ( RuleLevel == 0 )
  434. {
  435. dbg.Terminate();
  436. }
  437. }
  438. return retval;
  439. }
  440. // $ANTLR end "stat"
  441. public class func_return : ParserRuleReturnScope
  442. {
  443. internal CommonTree tree;
  444. public override object Tree { get { return tree; } }
  445. }
  446. // $ANTLR start "func"
  447. // BuildOptions\\ProfileGrammar.g3:59:0: func : ID '(' formalPar ')' '=' expr -> ^( FUNC ID formalPar expr ) ;
  448. private ProfileGrammarParser.func_return func( )
  449. {
  450. ProfileGrammarParser.func_return retval = new ProfileGrammarParser.func_return();
  451. retval.start = input.LT(1);
  452. CommonTree root_0 = null;
  453. IToken ID11=null;
  454. IToken char_literal12=null;
  455. IToken char_literal14=null;
  456. IToken char_literal15=null;
  457. ProfileGrammarParser.formalPar_return formalPar13 = default(ProfileGrammarParser.formalPar_return);
  458. ProfileGrammarParser.expr_return expr16 = default(ProfileGrammarParser.expr_return);
  459. CommonTree ID11_tree=null;
  460. CommonTree char_literal12_tree=null;
  461. CommonTree char_literal14_tree=null;
  462. CommonTree char_literal15_tree=null;
  463. RewriteRuleITokenStream stream_ID=new RewriteRuleITokenStream(adaptor,"token ID");
  464. RewriteRuleITokenStream stream_12=new RewriteRuleITokenStream(adaptor,"token 12");
  465. RewriteRuleITokenStream stream_13=new RewriteRuleITokenStream(adaptor,"token 13");
  466. RewriteRuleITokenStream stream_17=new RewriteRuleITokenStream(adaptor,"token 17");
  467. RewriteRuleSubtreeStream stream_formalPar=new RewriteRuleSubtreeStream(adaptor,"rule formalPar");
  468. RewriteRuleSubtreeStream stream_expr=new RewriteRuleSubtreeStream(adaptor,"rule expr");
  469. try
  470. {
  471. dbg.EnterRule( GrammarFileName, "func" );
  472. if ( RuleLevel == 0 )
  473. {
  474. dbg.Commence();
  475. }
  476. IncRuleLevel();
  477. dbg.Location( 59, -1 );
  478. try
  479. {
  480. // BuildOptions\\ProfileGrammar.g3:59:9: ( ID '(' formalPar ')' '=' expr -> ^( FUNC ID formalPar expr ) )
  481. dbg.EnterAlt( 1 );
  482. // BuildOptions\\ProfileGrammar.g3:59:9: ID '(' formalPar ')' '=' expr
  483. {
  484. dbg.Location( 59, 8 );
  485. ID11=(IToken)Match(input,ID,Follow._ID_in_func219);
  486. stream_ID.Add(ID11);
  487. dbg.Location( 59, 12 );
  488. char_literal12=(IToken)Match(input,12,Follow._12_in_func222);
  489. stream_12.Add(char_literal12);
  490. dbg.Location( 59, 16 );
  491. PushFollow(Follow._formalPar_in_func224);
  492. formalPar13=formalPar();
  493. state._fsp--;
  494. stream_formalPar.Add(formalPar13.Tree);
  495. dbg.Location( 59, 26 );
  496. char_literal14=(IToken)Match(input,13,Follow._13_in_func226);
  497. stream_13.Add(char_literal14);
  498. dbg.Location( 59, 30 );
  499. char_literal15=(IToken)Match(input,17,Follow._17_in_func228);
  500. stream_17.Add(char_literal15);
  501. dbg.Location( 59, 34 );
  502. PushFollow(Follow._expr_in_func230);
  503. expr16=expr();
  504. state._fsp--;
  505. stream_expr.Add(expr16.Tree);
  506. {
  507. // AST REWRITE
  508. // elements: ID, formalPar, expr
  509. // token labels:
  510. // rule labels: retval
  511. // token list labels:
  512. // rule list labels:
  513. // wildcard labels:
  514. retval.tree = root_0;
  515. RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);
  516. root_0 = (CommonTree)adaptor.Nil();
  517. // 59:41: -> ^( FUNC ID formalPar expr )
  518. {
  519. dbg.Location( 59, 43 );
  520. // BuildOptions\\ProfileGrammar.g3:59:44: ^( FUNC ID formalPar expr )
  521. {
  522. CommonTree root_1 = (CommonTree)adaptor.Nil();
  523. dbg.Location( 59, 45 );
  524. root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(FUNC, "FUNC"), root_1);
  525. dbg.Location( 59, 50 );
  526. adaptor.AddChild(root_1, stream_ID.NextNode());
  527. dbg.Location( 59, 53 );
  528. adaptor.AddChild(root_1, stream_formalPar.NextTree());
  529. dbg.Location( 59, 63 );
  530. adaptor.AddChild(root_1, stream_expr.NextTree());
  531. adaptor.AddChild(root_0, root_1);
  532. }
  533. }
  534. retval.tree = root_0;
  535. }
  536. }
  537. retval.stop = input.LT(-1);
  538. retval.tree = (CommonTree)adaptor.RulePostProcessing(root_0);
  539. adaptor.SetTokenBoundaries(retval.tree, retval.start, retval.stop);
  540. }
  541. catch ( RecognitionException re )
  542. {
  543. ReportError(re);
  544. Recover(input,re);
  545. retval.tree = (CommonTree)adaptor.ErrorNode(input, retval.start, input.LT(-1), re);
  546. }
  547. finally
  548. {
  549. functionDefinitions.Add(((CommonTree)retval.Tree));
  550. }
  551. dbg.Location(60, 4);
  552. }
  553. finally
  554. {
  555. dbg.ExitRule( GrammarFileName, "func" );
  556. DecRuleLevel();
  557. if ( RuleLevel == 0 )
  558. {
  559. dbg.Terminate();
  560. }
  561. }
  562. return retval;
  563. }
  564. // $ANTLR end "func"
  565. public class formalPar_return : ParserRuleReturnScope
  566. {
  567. internal CommonTree tree;
  568. public override object Tree { get { return tree; } }
  569. }
  570. // $ANTLR start "formalPar"
  571. // BuildOptions\\ProfileGrammar.g3:65:0: formalPar : ( ID | INT );
  572. private ProfileGrammarParser.formalPar_return formalPar( )
  573. {
  574. ProfileGrammarParser.formalPar_return retval = new ProfileGrammarParser.formalPar_return();
  575. retval.start = input.LT(1);
  576. CommonTree root_0 = null;
  577. IToken set17=null;
  578. CommonTree set17_tree=null;
  579. try
  580. {
  581. dbg.EnterRule( GrammarFileName, "formalPar" );
  582. if ( RuleLevel == 0 )
  583. {
  584. dbg.Commence();
  585. }
  586. IncRuleLevel();
  587. dbg.Location( 65, -1 );
  588. try
  589. {
  590. // BuildOptions\\ProfileGrammar.g3:66:9: ( ID | INT )
  591. dbg.EnterAlt( 1 );
  592. // BuildOptions\\ProfileGrammar.g3:
  593. {
  594. root_0 = (CommonTree)adaptor.Nil();
  595. dbg.Location( 66, 8 );
  596. set17=(IToken)input.LT(1);
  597. if ( (input.LA(1)>=ID && input.LA(1)<=INT) )
  598. {
  599. input.Consume();
  600. adaptor.AddChild(root_0, (CommonTree)adaptor.Create(set17));
  601. state.errorRecovery=false;
  602. }
  603. else
  604. {
  605. MismatchedSetException mse = new MismatchedSetException(null,input);
  606. dbg.RecognitionException( mse );
  607. throw mse;
  608. }
  609. }
  610. retval.stop = input.LT(-1);
  611. retval.tree = (CommonTree)adaptor.RulePostProcessing(root_0);
  612. adaptor.SetTokenBoundaries(retval.tree, retval.start, retval.stop);
  613. }
  614. catch ( RecognitionException re )
  615. {
  616. ReportError(re);
  617. Recover(input,re);
  618. retval.tree = (CommonTree)adaptor.ErrorNode(input, retval.start, input.LT(-1), re);
  619. }
  620. finally
  621. {
  622. }
  623. dbg.Location(68, 1);
  624. }
  625. finally
  626. {
  627. dbg.ExitRule( GrammarFileName, "formalPar" );
  628. DecRuleLevel();
  629. if ( RuleLevel == 0 )
  630. {
  631. dbg.Terminate();
  632. }
  633. }
  634. return retval;
  635. }
  636. // $ANTLR end "formalPar"
  637. public class expr_return : ParserRuleReturnScope
  638. {
  639. internal CommonTree tree;
  640. public override object Tree { get { return tree; } }
  641. }
  642. // $ANTLR start "expr"
  643. // BuildOptions\\ProfileGrammar.g3:73:0: expr : multExpr ( ( '+' | '-' ) multExpr )* ;
  644. private ProfileGrammarParser.expr_return expr( )
  645. {
  646. ProfileGrammarParser.expr_return retval = new ProfileGrammarParser.expr_return();
  647. retval.start = input.LT(1);
  648. CommonTree root_0 = null;
  649. IToken char_literal19=null;
  650. IToken char_literal20=null;
  651. ProfileGrammarParser.multExpr_return multExpr18 = default(ProfileGrammarParser.multExpr_return);
  652. ProfileGrammarParser.multExpr_return multExpr21 = default(ProfileGrammarParser.multExpr_return);
  653. CommonTree char_literal19_tree=null;
  654. CommonTree char_literal20_tree=null;
  655. try
  656. {
  657. dbg.EnterRule( GrammarFileName, "expr" );
  658. if ( RuleLevel == 0 )
  659. {
  660. dbg.Commence();
  661. }
  662. IncRuleLevel();
  663. dbg.Location( 73, -1 );
  664. try
  665. {
  666. // BuildOptions\\ProfileGrammar.g3:73:9: ( multExpr ( ( '+' | '-' ) multExpr )* )
  667. dbg.EnterAlt( 1 );
  668. // BuildOptions\\ProfileGrammar.g3:73:9: multExpr ( ( '+' | '-' ) multExpr )*
  669. {
  670. root_0 = (CommonTree)adaptor.Nil();
  671. dbg.Location( 73, 8 );
  672. PushFollow(Follow._multExpr_in_expr288);
  673. multExpr18=multExpr();
  674. state._fsp--;
  675. adaptor.AddChild(root_0, multExpr18.Tree);
  676. dbg.Location( 73, 17 );
  677. // BuildOptions\\ProfileGrammar.g3:73:18: ( ( '+' | '-' ) multExpr )*
  678. try
  679. {
  680. dbg.EnterSubRule( 4 );
  681. for ( ; ; )
  682. {
  683. int alt4=2;
  684. try
  685. {
  686. dbg.EnterDecision( 4 );
  687. int LA4_0 = input.LA(1);
  688. if ( (LA4_0==10||LA4_0==16) )
  689. {
  690. alt4=1;
  691. }
  692. }
  693. finally
  694. {
  695. dbg.ExitDecision( 4 );
  696. }
  697. switch ( alt4 )
  698. {
  699. case 1:
  700. dbg.EnterAlt( 1 );
  701. // BuildOptions\\ProfileGrammar.g3:73:19: ( '+' | '-' ) multExpr
  702. {
  703. dbg.Location( 73, 18 );
  704. // BuildOptions\\ProfileGrammar.g3:73:19: ( '+' | '-' )
  705. int alt3=2;
  706. try
  707. {
  708. dbg.EnterSubRule( 3 );
  709. try
  710. {
  711. dbg.EnterDecision( 3 );
  712. int LA3_0 = input.LA(1);
  713. if ( (LA3_0==16) )
  714. {
  715. alt3=1;
  716. }
  717. else if ( (LA3_0==10) )
  718. {
  719. alt3=2;
  720. }
  721. else
  722. {
  723. NoViableAltException nvae = new NoViableAltException("", 3, 0, input);
  724. dbg.RecognitionException( nvae );
  725. throw nvae;
  726. }
  727. }
  728. finally
  729. {
  730. dbg.ExitDecision( 3 );
  731. }
  732. switch ( alt3 )
  733. {
  734. case 1:
  735. dbg.EnterAlt( 1 );
  736. // BuildOptions\\ProfileGrammar.g3:73:20: '+'
  737. {
  738. dbg.Location( 73, 22 );
  739. char_literal19=(IToken)Match(input,16,Follow._16_in_expr292);
  740. char_literal19_tree = (CommonTree)adaptor.Create(char_literal19);
  741. root_0 = (CommonTree)adaptor.BecomeRoot(char_literal19_tree, root_0);
  742. }
  743. break;
  744. case 2:
  745. dbg.EnterAlt( 2 );
  746. // BuildOptions\\ProfileGrammar.g3:73:25: '-'
  747. {
  748. dbg.Location( 73, 27 );
  749. char_literal20=(IToken)Match(input,10,Follow._10_in_expr295);
  750. char_literal20_tree = (CommonTree)adaptor.Create(char_literal20);
  751. root_0 = (CommonTree)adaptor.BecomeRoot(char_literal20_tree, root_0);
  752. }
  753. break;
  754. }
  755. }
  756. finally
  757. {
  758. dbg.ExitSubRule( 3 );
  759. }
  760. dbg.Location( 73, 30 );
  761. PushFollow(Follow._multExpr_in_expr299);
  762. multExpr21=multExpr();
  763. state._fsp--;
  764. adaptor.AddChild(root_0, multExpr21.Tree);
  765. }
  766. break;
  767. default:
  768. goto loop4;
  769. }
  770. }
  771. loop4:
  772. ;
  773. }
  774. finally
  775. {
  776. dbg.ExitSubRule( 4 );
  777. }
  778. }
  779. retval.stop = input.LT(-1);
  780. retval.tree = (CommonTree)adaptor.RulePostProcessing(root_0);
  781. adaptor.SetTokenBoundaries(retval.tree, retval.start, retval.stop);
  782. }
  783. catch ( RecognitionException re )
  784. {
  785. ReportError(re);
  786. Recover(input,re);
  787. retval.tree = (CommonTree)adaptor.ErrorNode(input, retval.start, input.LT(-1), re);
  788. }
  789. finally
  790. {
  791. }
  792. dbg.Location(74, 4);
  793. }
  794. finally
  795. {
  796. dbg.ExitRule( GrammarFileName, "expr" );
  797. DecRuleLevel();
  798. if ( RuleLevel == 0 )
  799. {
  800. dbg.Terminate();
  801. }
  802. }
  803. return retval;
  804. }
  805. // $ANTLR end "expr"
  806. public class multExpr_return : ParserRuleReturnScope
  807. {
  808. internal CommonTree tree;
  809. public override object Tree { get { return tree; } }
  810. }
  811. // $ANTLR start "multExpr"
  812. // BuildOptions\\ProfileGrammar.g3:76:0: multExpr : atom ( ( '*' | '/' | '%' ) atom )* ;
  813. private ProfileGrammarParser.multExpr_return multExpr( )
  814. {
  815. ProfileGrammarParser.multExpr_return retval = new ProfileGrammarParser.multExpr_return();
  816. retval.start = input.LT(1);
  817. CommonTree root_0 = null;
  818. IToken set23=null;
  819. ProfileGrammarParser.atom_return atom22 = default(ProfileGrammarParser.atom_return);
  820. ProfileGrammarParser.atom_return atom24 = default(ProfileGrammarParser.atom_return);
  821. CommonTree set23_tree=null;
  822. try
  823. {
  824. dbg.EnterRule( GrammarFileName, "multExpr" );
  825. if ( RuleLevel == 0 )
  826. {
  827. dbg.Commence();
  828. }
  829. IncRuleLevel();
  830. dbg.Location( 76, -1 );
  831. try
  832. {
  833. // BuildOptions\\ProfileGrammar.g3:77:9: ( atom ( ( '*' | '/' | '%' ) atom )* )
  834. dbg.EnterAlt( 1 );
  835. // BuildOptions\\ProfileGrammar.g3:77:9: atom ( ( '*' | '/' | '%' ) atom )*
  836. {
  837. root_0 = (CommonTree)adaptor.Nil();
  838. dbg.Location( 77, 8 );
  839. PushFollow(Follow._atom_in_multExpr320);
  840. atom22=atom();
  841. state._fsp--;
  842. adaptor.AddChild(root_0, atom22.Tree);
  843. dbg.Location( 77, 13 );
  844. // BuildOptions\\ProfileGrammar.g3:77:14: ( ( '*' | '/' | '%' ) atom )*
  845. try
  846. {
  847. dbg.EnterSubRule( 5 );
  848. for ( ; ; )
  849. {
  850. int alt5=2;
  851. try
  852. {
  853. dbg.EnterDecision( 5 );
  854. int LA5_0 = input.LA(1);
  855. if ( (LA5_0==11||(LA5_0>=14 && LA5_0<=15)) )
  856. {
  857. alt5=1;
  858. }
  859. }
  860. finally
  861. {
  862. dbg.ExitDecision( 5 );
  863. }
  864. switch ( alt5 )
  865. {
  866. case 1:
  867. dbg.EnterAlt( 1 );
  868. // BuildOptions\\ProfileGrammar.g3:77:15: ( '*' | '/' | '%' ) atom
  869. {
  870. dbg.Location( 77, 27 );
  871. set23=(IToken)input.LT(1);
  872. set23=(IToken)input.LT(1);
  873. if ( input.LA(1)==11||(input.LA(1)>=14 && input.LA(1)<=15) )
  874. {
  875. input.Consume();
  876. root_0 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(set23), root_0);
  877. state.errorRecovery=false;
  878. }
  879. else
  880. {
  881. MismatchedSetException mse = new MismatchedSetException(null,input);
  882. dbg.RecognitionException( mse );
  883. throw mse;
  884. }
  885. dbg.Location( 77, 29 );
  886. PushFollow(Follow._atom_in_multExpr332);
  887. atom24=atom();
  888. state._fsp--;
  889. adaptor.AddChild(root_0, atom24.Tree);
  890. }
  891. break;
  892. default:
  893. goto loop5;
  894. }
  895. }
  896. loop5:
  897. ;
  898. }
  899. finally
  900. {
  901. dbg.ExitSubRule( 5 );
  902. }
  903. }
  904. retval.stop = input.LT(-1);
  905. retval.tree = (CommonTree)adaptor.RulePostProcessing(root_0);
  906. adaptor.SetTokenBoundaries(retval.tree, retval.start, retval.stop);
  907. }
  908. catch ( RecognitionException re )
  909. {
  910. ReportError(re);
  911. Recover(input,re);
  912. retval.tree = (CommonTree)adaptor.ErrorNode(input, retval.start, input.LT(-1), re);
  913. }
  914. finally
  915. {
  916. }
  917. dbg.Location(78, 4);
  918. }
  919. finally
  920. {
  921. dbg.ExitRule( GrammarFileName, "multExpr" );
  922. DecRuleLevel();
  923. if ( RuleLevel == 0 )
  924. {
  925. dbg.Terminate();
  926. }
  927. }
  928. return retval;
  929. }
  930. // $ANTLR end "multExpr"
  931. public class atom_return : ParserRuleReturnScope
  932. {
  933. internal CommonTree tree;
  934. public override object Tree { get { return tree; } }
  935. }
  936. // $ANTLR start "atom"
  937. // BuildOptions\\ProfileGrammar.g3:80:0: atom : ( INT | ID | '(' expr ')' -> expr | ID '(' expr ')' -> ^( CALL ID expr ) );
  938. private ProfileGrammarParser.atom_return atom( )
  939. {
  940. ProfileGrammarParser.atom_return retval = new ProfileGrammarParser.atom_return();
  941. retval.start = input.LT(1);
  942. CommonTree root_0 = null;
  943. IToken INT25=null;
  944. IToken ID26=null;
  945. IToken char_literal27=null;
  946. IToken char_literal29=null;
  947. IToken ID30=null;
  948. IToken char_literal31=null;
  949. IToken char_literal33=null;
  950. ProfileGrammarParser.expr_return expr28 = default(ProfileGrammarParser.expr_return);
  951. ProfileGrammarParser.expr_return expr32 = default(ProfileGrammarParser.expr_return);
  952. CommonTree INT25_tree=null;
  953. CommonTree ID26_tree=null;
  954. CommonTree char_literal27_tree=null;
  955. CommonTree char_literal29_tree=null;
  956. CommonTree ID30_tree=null;
  957. CommonTree char_literal31_tree=null;
  958. CommonTree char_literal33_tree=null;
  959. RewriteRuleITokenStream stream_12=new RewriteRuleITokenStream(adaptor,"token 12");
  960. RewriteRuleITokenStream stream_13=new RewriteRuleITokenStream(adaptor,"token 13");
  961. RewriteRuleITokenStream stream_ID=new RewriteRuleITokenStream(adaptor,"token ID");
  962. RewriteRuleSubtreeStream stream_expr=new RewriteRuleSubtreeStream(adaptor,"rule expr");
  963. try
  964. {
  965. dbg.EnterRule( GrammarFileName, "atom" );
  966. if ( RuleLevel == 0 )
  967. {
  968. dbg.Commence();
  969. }
  970. IncRuleLevel();
  971. dbg.Location( 80, -1 );
  972. try
  973. {
  974. // BuildOptions\\ProfileGrammar.g3:80:9: ( INT | ID | '(' expr ')' -> expr | ID '(' expr ')' -> ^( CALL ID expr ) )
  975. int alt6=4;
  976. try
  977. {
  978. dbg.EnterDecision( 6 );
  979. switch ( input.LA(1) )
  980. {
  981. case INT:
  982. {
  983. alt6=1;
  984. }
  985. break;
  986. case ID:
  987. {
  988. int LA6_2 = input.LA(2);
  989. if ( (LA6_2==12) )
  990. {
  991. alt6=4;
  992. }
  993. else if ( (LA6_2==NEWLINE||(LA6_2>=10 && LA6_2<=11)||(LA6_2>=13 && LA6_2<=16)) )
  994. {
  995. alt6=2;
  996. }
  997. else
  998. {
  999. NoViableAltException nvae = new NoViableAltException("", 6, 2, input);
  1000. dbg.RecognitionException( nvae );
  1001. throw nvae;
  1002. }
  1003. }
  1004. break;
  1005. case 12:
  1006. {
  1007. alt6=3;
  1008. }
  1009. break;
  1010. default:
  1011. {
  1012. NoViableAltException nvae = new NoViableAltException("", 6, 0, input);
  1013. dbg.RecognitionException( nvae );
  1014. throw nvae;
  1015. }
  1016. }
  1017. }
  1018. finally
  1019. {
  1020. dbg.ExitDecision( 6 );
  1021. }
  1022. switch ( alt6 )
  1023. {
  1024. case 1:
  1025. dbg.EnterAlt( 1 );
  1026. // BuildOptions\\ProfileGrammar.g3:80:9: INT
  1027. {
  1028. root_0 = (CommonTree)adaptor.Nil();
  1029. dbg.Location( 80, 8 );
  1030. INT25=(IToken)Match(input,INT,Follow._INT_in_atom348);
  1031. INT25_tree = (CommonTree)adaptor.Create(INT25);
  1032. adaptor.AddChild(root_0, INT25_tree);
  1033. }
  1034. break;
  1035. case 2:
  1036. dbg.EnterAlt( 2 );
  1037. // BuildOptions\\ProfileGrammar.g3:81:9: ID
  1038. {
  1039. root_0 = (CommonTree)adaptor.Nil();
  1040. dbg.Location( 81, 8 );
  1041. ID26=(IToken)Match(input,ID,Follow._ID_in_atom358);
  1042. ID26_tree = (CommonTree)adaptor.Create(ID26);
  1043. adaptor.AddChild(root_0, ID26_tree);
  1044. }
  1045. break;
  1046. case 3:
  1047. dbg.EnterAlt( 3 );
  1048. // BuildOptions\\ProfileGrammar.g3:82:9: '(' expr ')'
  1049. {
  1050. dbg.Location( 82, 8 );
  1051. char_literal27=(IToken)Match(input,12,Follow._12_in_atom368);
  1052. stream_12.Add(char_literal27);
  1053. dbg.Location( 82, 12 );
  1054. PushFollow(Follow._expr_in_atom370);
  1055. expr28=expr();
  1056. state._fsp--;
  1057. stream_expr.Add(expr28.Tree);
  1058. dbg.Location( 82, 17 );
  1059. char_literal29=(IToken)Match(input,13,Follow._13_in_atom372);
  1060. stream_13.Add(char_literal29);
  1061. {
  1062. // AST REWRITE
  1063. // elements: expr
  1064. // token labels:
  1065. // rule labels: retval
  1066. // token list labels:
  1067. // rule list labels:
  1068. // wildcard labels:
  1069. retval.tree = root_0;
  1070. RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);
  1071. root_0 = (CommonTree)adaptor.Nil();
  1072. // 82:25: -> expr
  1073. {
  1074. dbg.Location( 82, 27 );
  1075. adaptor.AddChild(root_0, stream_expr.NextTree());
  1076. }
  1077. retval.tree = root_0;
  1078. }
  1079. }
  1080. break;
  1081. case 4:
  1082. dbg.EnterAlt( 4 );
  1083. // BuildOptions\\ProfileGrammar.g3:83:9: ID '(' expr ')'
  1084. {
  1085. dbg.Location( 83, 8 );
  1086. ID30=(IToken)Match(input,ID,Follow._ID_in_atom389);
  1087. stream_ID.Add(ID30);
  1088. dbg.Location( 83, 11 );
  1089. char_literal31=(IToken)Match(input,12,Follow._12_in_atom391);
  1090. stream_12.Add(char_literal31);
  1091. dbg.Location( 83, 15 );
  1092. PushFollow(Follow._expr_in_atom393);
  1093. expr32=expr();
  1094. state._fsp--;
  1095. stream_expr.Add(expr32.Tree);
  1096. dbg.Location( 83, 20 );
  1097. char_literal33=(IToken)Match(input,13,Follow._13_in_atom395);
  1098. stream_13.Add(char_literal33);
  1099. {
  1100. // AST REWRITE
  1101. // elements: ID, expr
  1102. // token labels:
  1103. // rule labels: retval
  1104. // token list labels:
  1105. // rule list labels:
  1106. // wildcard labels:
  1107. retval.tree = root_0;
  1108. RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);
  1109. root_0 = (CommonTree)adaptor.Nil();
  1110. // 83:25: -> ^( CALL ID expr )
  1111. {
  1112. dbg.Location( 83, 27 );
  1113. // BuildOptions\\ProfileGrammar.g3:83:28: ^( CALL ID expr )
  1114. {
  1115. CommonTree root_1 = (CommonTree)adaptor.Nil();
  1116. dbg.Location( 83, 29 );
  1117. root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(CALL, "CALL"), root_1);
  1118. dbg.Location( 83, 34 );
  1119. adaptor.AddChild(root_1, stream_ID.NextNode());
  1120. dbg.Location( 83, 37 );
  1121. adaptor.AddChild(root_1, stream_expr.NextTree());
  1122. adaptor.AddChild(root_0, root_1);
  1123. }
  1124. }
  1125. retval.tree = root_0;
  1126. }
  1127. }
  1128. break;
  1129. }
  1130. retval.stop = input.LT(-1);
  1131. retval.tree = (CommonTree)adaptor.RulePostProcessing(root_0);
  1132. adaptor.SetTokenBoundaries(retval.tree, retval.start, retval.stop);
  1133. }
  1134. catch ( RecognitionException re )
  1135. {
  1136. ReportError(re);
  1137. Recover(input,re);
  1138. retval.tree = (CommonTree)adaptor.ErrorNode(input, retval.start, input.LT(-1), re);
  1139. }
  1140. finally
  1141. {
  1142. }
  1143. dbg.Location(84, 4);
  1144. }
  1145. finally
  1146. {
  1147. dbg.ExitRule( GrammarFileName, "atom" );
  1148. DecRuleLevel();
  1149. if ( RuleLevel == 0 )
  1150. {
  1151. dbg.Terminate();
  1152. }
  1153. }
  1154. return retval;
  1155. }
  1156. // $ANTLR end "atom"
  1157. #endregion Rules
  1158. #region DFA
  1159. DFA2 dfa2;
  1160. protected override void InitDFAs()
  1161. {
  1162. base.InitDFAs();
  1163. dfa2 = new DFA2( this );
  1164. }
  1165. class DFA2 : DFA
  1166. {
  1167. const string DFA2_eotS =
  1168. "\xA\xFFFF";
  1169. const string DFA2_eofS =
  1170. "\xA\xFFFF";
  1171. const string DFA2_minS =
  1172. "\x1\x6\x1\xFFFF\x1\x8\x1\xFFFF\x1\x6\x1\xFFFF\x2\xA\x1\x8\x1\xFFFF";
  1173. const string DFA2_maxS =
  1174. "\x1\xC\x1\xFFFF\x1\x11\x1\xFFFF\x1\xC\x1\xFFFF\x2\x10\x1\x11\x1\xFFFF";
  1175. const string DFA2_acceptS =
  1176. "\x1\xFFFF\x1\x1\x1\xFFFF\x1\x4\x1\xFFFF\x1\x2\x3\xFFFF\x1\x3";
  1177. const string DFA2_specialS =
  1178. "\xA\xFFFF}>";
  1179. static readonly string[] DFA2_transitionS =
  1180. {
  1181. "\x1\x2\x1\x1\x1\x3\x3\xFFFF\x1\x1",
  1182. "",
  1183. "\x1\x1\x1\xFFFF\x2\x1\x1\x4\x1\xFFFF\x3\x1\x1\x5",
  1184. "",
  1185. "\x1\x7\x1\x6\x4\xFFFF\x1\x1",
  1186. "",
  1187. "\x2\x1\x1\xFFFF\x1\x8\x3\x1",
  1188. "\x3\x1\x1\x8\x3\x1",
  1189. "\x1\x1\x1\xFFFF\x2\x1\x2\xFFFF\x3\x1\x1\x9",
  1190. ""
  1191. };
  1192. static readonly short[] DFA2_eot = DFA.UnpackEncodedString(DFA2_eotS);
  1193. static readonly short[] DFA2_eof = DFA.UnpackEncodedString(DFA2_eofS);
  1194. static readonly char[] DFA2_min = DFA.UnpackEncodedStringToUnsignedChars(DFA2_minS);
  1195. static readonly char[] DFA2_max = DFA.UnpackEncodedStringToUnsignedChars(DFA2_maxS);
  1196. static readonly short[] DFA2_accept = DFA.UnpackEncodedString(DFA2_acceptS);
  1197. static readonly short[] DFA2_special = DFA.UnpackEncodedString(DFA2_specialS);
  1198. static readonly short[][] DFA2_transition;
  1199. static DFA2()
  1200. {
  1201. int numStates = DFA2_transitionS.Length;
  1202. DFA2_transition = new short[numStates][];
  1203. for ( int i=0; i < numStates; i++ )
  1204. {
  1205. DFA2_transition[i] = DFA.UnpackEncodedString(DFA2_transitionS[i]);
  1206. }
  1207. }
  1208. public DFA2( BaseRecognizer recognizer )
  1209. {
  1210. this.recognizer = recognizer;
  1211. this.decisionNumber = 2;
  1212. this.eot = DFA2_eot;
  1213. this.eof = DFA2_eof;
  1214. this.min = DFA2_min;
  1215. this.max = DFA2_max;
  1216. this.accept = DFA2_accept;
  1217. this.special = DFA2_special;
  1218. this.transition = DFA2_transition;
  1219. }
  1220. public override string GetDescription()
  1221. {
  1222. return "53:0: stat : ( expr NEWLINE -> expr | ID '=' expr NEWLINE -> ^( '=' ID expr ) | func NEWLINE -> func | NEWLINE ->);";
  1223. }
  1224. public override void Error( NoViableAltException nvae )
  1225. {
  1226. ((DebugParser)recognizer).dbg.RecognitionException( nvae );
  1227. }
  1228. }
  1229. #endregion DFA
  1230. #region Follow sets
  1231. private static class Follow
  1232. {
  1233. public static readonly BitSet _stat_in_prog53 = new BitSet(new ulong[]{0x11C2UL});
  1234. public static readonly BitSet _expr_in_stat70 = new BitSet(new ulong[]{0x100UL});
  1235. public static readonly BitSet _NEWLINE_in_stat72 = new BitSet(new ulong[]{0x2UL});
  1236. public static readonly BitSet _ID_in_stat105 = new BitSet(new ulong[]{0x20000UL});
  1237. public static readonly BitSet _17_in_stat107 = new BitSet(new ulong[]{0x10C0UL});
  1238. public static readonly BitSet _expr_in_stat109 = new BitSet(new ulong[]{0x100UL});
  1239. public static readonly BitSet _NEWLINE_in_stat111 = new BitSet(new ulong[]{0x2UL});
  1240. public static readonly BitSet _func_in_stat143 = new BitSet(new ulong[]{0x100UL});
  1241. public static readonly BitSet _NEWLINE_in_stat145 = new BitSet(new ulong[]{0x2UL});
  1242. public static readonly BitSet _NEWLINE_in_stat178 = new BitSet(new ulong[]{0x2UL});
  1243. public static readonly BitSet _ID_in_func219 = new BitSet(new ulong[]{0x1000UL});
  1244. public static readonly BitSet _12_in_func222 = new BitSet(new ulong[]{0xC0UL});
  1245. public static readonly BitSet _formalPar_in_func224 = new BitSet(new ulong[]{0x2000UL});
  1246. public static readonly BitSet _13_in_func226 = new BitSet(new ulong[]{0x20000UL});
  1247. public static readonly BitSet _17_in_func228 = new BitSet(new ulong[]{0x10C0UL});
  1248. public static readonly BitSet _expr_in_func230 = new BitSet(new ulong[]{0x2UL});
  1249. public static readonly BitSet _set_in_formalPar267 = new BitSet(new ulong[]{0x2UL});
  1250. public static readonly BitSet _multExpr_in_expr288 = new BitSet(new ulong[]{0x10402UL});
  1251. public static readonly BitSet _16_in_expr292 = new BitSet(new ulong[]{0x10C0UL});
  1252. public static readonly BitSet _10_in_expr295 = new BitSet(new ulong[]{0x10C0UL});
  1253. public static readonly BitSet _multExpr_in_expr299 = new BitSet(new ulong[]{0x10402UL});
  1254. public static readonly BitSet _atom_in_multExpr320 = new BitSet(new ulong[]{0xC802UL});
  1255. public static readonly BitSet _set_in_multExpr323 = new BitSet(new ulong[]{0x10C0UL});
  1256. public static readonly BitSet _atom_in_multExpr332 = new BitSet(new ulong[]{0xC802UL});
  1257. public static readonly BitSet _INT_in_atom348 = new BitSet(new ulong[]{0x2UL});
  1258. public static readonly BitSet _ID_in_atom358 = new BitSet(new ulong[]{0x2UL});
  1259. public static readonly BitSet _12_in_atom368 = new BitSet(new ulong[]{0x10C0UL});
  1260. public static readonly BitSet _expr_in_atom370 = new BitSet(new ulong[]{0x2000UL});
  1261. public static readonly BitSet _13_in_atom372 = new BitSet(new ulong[]{0x2UL});
  1262. public static readonly BitSet _ID_in_atom389 = new BitSet(new ulong[]{0x1000UL});
  1263. public static readonly BitSet _12_in_atom391 = new BitSet(new ulong[]{0x10C0UL});
  1264. public static readonly BitSet _expr_in_atom393 = new BitSet(new ulong[]{0x2000UL});
  1265. public static readonly BitSet _13_in_atom395 = new BitSet(new ulong[]{0x2UL});
  1266. }
  1267. #endregion Follow sets
  1268. }