Note: This website is archived. For up-to-date information about D projects and development, please visit wiki.dlang.org.

root/trunk/enki/EnkiParser.d

Revision 289, 72.4 kB (checked in by h3r3tic, 17 years ago)

ported Enki to Tango; bootstraps, no other tests done yet

Line 
1 //Generated by Enki v1.2
2
3 /+
4     Copyright (c) 2006 Eric Anderton
5
6     Permission is hereby granted, free of charge, to any person
7     obtaining a copy of this software and associated documentation
8     files (the "Software"), to deal in the Software without
9     restriction, including without limitation the rights to use,
10     copy, modify, merge, publish, distribute, sublicense, and/or
11     sell copies of the Software, and to permit persons to whom the
12     Software is furnished to do so, subject to the following
13     conditions:
14
15     The above copyright notice and this permission notice shall be
16     included in all copies or substantial portions of the Software.
17
18     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25     OTHER DEALINGS IN THE SOFTWARE.
26 +/
27
28 module enki.EnkiParser;
29 version(build) pragma(export_version,EnkiUTF8);
30
31 debug private import tango.io.Stdout;
32 private import enki.types;
33 private import enki.EnkiBackend;
34 private import enki.Rule;
35 private import enki.Expression;
36 private import enki.Directive;
37
38
39
40 class EnkiParser : BaseEnkiParser{
41
42     /*
43     
44 WS
45     ::=  ws [ (  SlashSlashComment |  SlashStarComment)  WS];
46
47     */
48     public ResultT!(bool) parse_WS(){
49         debug Stdout.formatln("parse_WS()");
50         uint start1 = position;
51         //no declarations
52        
53        
54         {//Expression
55             uint start2 = position;
56             if(!(parse_ws().success)){
57                 goto mismatch4;
58             }
59             {//OptionalExpr
60                 {//Expression
61                     uint start4 = position;
62                     {//Expression
63                         uint start5 = position;
64                         if((parse_SlashSlashComment().success) || (parse_SlashStarComment().success)){
65                             clearErrors();
66                         }else{
67                             setError("Expected SlashSlashComment or SlashStarComment.");
68                             position = start5;
69                             goto mismatch6;
70                         }
71                     }
72                     if(!(parse_WS().success)){
73                         goto mismatch6;
74                     }
75                     goto match5;
76                 mismatch6:
77                     {/*do nothing*/}
78                     position = start4;
79                     {/*do nothing*/}
80                 match5:
81                     clearErrors();
82                     {/*do nothing*/}
83                 }
84             }
85             goto match3;
86         mismatch4:
87             setError("Expected ws.");
88             position = start2;
89             goto mismatch2;
90         match3:
91             clearErrors();
92             goto match1;
93         }
94     match1:
95         debug Stdout.formatln("parse_WS() PASS");
96         return ResultT!(bool)(true);
97     mismatch2:
98         position = start1;
99         return ResultT!(bool)();
100     }
101
102     /*
103     
104 Syntax
105     = void createSyntax(SyntaxLine[] lines)
106     ::=  WS { (  Rule:~lines |  Comment:~lines |  Directive:~lines)  WS} eoi;
107
108     */
109     public ResultT!(String) parse_Syntax(){
110         debug Stdout.formatln("parse_Syntax()");
111         uint start6 = position;
112         SyntaxLine[] bind_lines;
113        
114        
115         {//Expression
116             uint start7 = position;
117             if(!(parse_WS().success)){
118                 goto mismatch10;
119             }
120             {//ZeroOrMoreExpr
121                 uint start8 = position;
122                 uint termPos9;
123             loop11:
124                 termPos9 = position;
125                 if(parse_eoi().success){
126                     goto loopend12;
127                 }else{
128                     goto exprStart13;
129                 }
130             exprStart13:
131                 {//Expression
132                     uint start10 = position;
133                     {//Expression
134                         uint start11 = position;
135                         if((parse_Rule().assignCat!(SyntaxLine[])(bind_lines)) || (parse_Comment().assignCat!(SyntaxLine[])(bind_lines)) || (parse_Directive().assignCat!(SyntaxLine[])(bind_lines))){
136                             clearErrors();
137                         }else{
138                             setError("Expected Rule, Comment or Directive.");
139                             position = start11;
140                             goto mismatch15;
141                         }
142                     }
143                     if(!(parse_WS().success)){
144                         goto mismatch15;
145                     }
146                     goto match14;
147                 mismatch15:
148                     {/*do nothing*/}
149                     position = start10;
150                     goto loopend12;
151                 match14:
152                     clearErrors();
153                     goto loop11;
154                 }
155             loopend12:
156                 {/*do nothing*/}
157             }
158             goto match9;
159         mismatch10:
160             setError("Expected WS.");
161             position = start7;
162             goto mismatch8;
163         match9:
164             clearErrors();
165             goto match7;
166         }
167     match7:
168         debug Stdout.formatln("parse_Syntax() PASS");
169         createSyntax(bind_lines);
170         return ResultT!(String)(sliceData(start6,position));
171     mismatch8:
172         position = start6;
173         return ResultT!(String)();
174     }
175
176     /*
177     
178 Rule
179     = new Rule(String name,RulePredicate pred,Expression expr,RuleDecl decl)
180     ::=  Identifier:name  WS [  RuleDecl:decl  WS] [  RulePredicate:pred]  WS  "::="  WS  Expression:expr  WS  ";";
181
182     */
183     public ResultT!(Rule) parse_Rule(){
184         debug Stdout.formatln("parse_Rule()");
185         uint start12 = position;
186         String bind_name;
187         RulePredicate bind_pred;
188         Expression bind_expr;
189         RuleDecl bind_decl;
190        
191        
192         {//Expression
193             uint start13 = position;
194             if(!(parse_Identifier().assign!(String)(bind_name))){
195                 goto mismatch19;
196             }
197             if(!(parse_WS().success)){
198                 goto mismatch19;
199             }
200             {//OptionalExpr
201                 {//Expression
202                     uint start15 = position;
203                     if((parse_RuleDecl().assign!(RuleDecl)(bind_decl) && parse_WS().success)){
204                         clearErrors();
205                     }else{
206                         position = start15;
207                     }
208                 }
209             }
210             {//OptionalExpr
211                 {//Expression
212                     uint start17 = position;
213                     if((parse_RulePredicate().assign!(RulePredicate)(bind_pred))){
214                         clearErrors();
215                     }else{
216                         position = start17;
217                     }
218                 }
219             }
220             if(!(parse_WS().success)){
221                 goto mismatch19;
222             }
223             if(!(terminal("::=").success)){
224                 goto mismatch19;
225             }
226             if(!(parse_WS().success)){
227                 goto mismatch19;
228             }
229             if(!(parse_Expression().assign!(Expression)(bind_expr))){
230                 goto mismatch19;
231             }
232             if(!(parse_WS().success)){
233                 goto mismatch19;
234             }
235             if(!(terminal(";").success)){
236                 goto mismatch19;
237             }
238             goto match18;
239         mismatch19:
240             setError("Expected Identifier.");
241             position = start13;
242             goto mismatch17;
243         match18:
244             clearErrors();
245             goto match16;
246         }
247     match16:
248         debug Stdout.formatln("parse_Rule() PASS");
249         ResultT!(Rule) passed = ResultT!(Rule)(new Rule(bind_name,bind_pred,bind_expr,bind_decl));
250         return passed;
251     mismatch17:
252         position = start12;
253         ResultT!(Rule) failed = ResultT!(Rule)();
254         return failed;
255     }
256
257     /*
258     
259 RuleDecl
260     = new RuleDecl(Param[] params)
261     ::=  ParamsExpr:params;
262
263     */
264     public ResultT!(RuleDecl) parse_RuleDecl(){
265         debug Stdout.formatln("parse_RuleDecl()");
266         uint start18 = position;
267         Param[] bind_params;
268        
269        
270         {//Expression
271             uint start19 = position;
272             if((parse_ParamsExpr().assign!(Param[])(bind_params))){
273                 clearErrors();
274                 goto match20;
275             }else{
276                 setError("Expected ParamsExpr.");
277                 position = start19;
278                 goto mismatch21;
279             }
280         }
281     match20:
282         debug Stdout.formatln("parse_RuleDecl() PASS");
283         ResultT!(RuleDecl) passed = ResultT!(RuleDecl)(new RuleDecl(bind_params));
284         return passed;
285     mismatch21:
286         position = start18;
287         ResultT!(RuleDecl) failed = ResultT!(RuleDecl)();
288         return failed;
289     }
290
291     /*
292     
293 RulePredicate
294     = RulePredicate pred
295     ::=  "="  WS (  ClassPredicate:pred |  FunctionPredicate:pred |  BindingPredicate:pred);
296
297     */
298     public ResultT!(RulePredicate) parse_RulePredicate(){
299         debug Stdout.formatln("parse_RulePredicate()");
300         uint start20 = position;
301         RulePredicate bind_pred;
302        
303        
304         {//Expression
305             uint start21 = position;
306             if(!(terminal("=").success)){
307                 goto mismatch25;
308             }
309             if(!(parse_WS().success)){
310                 goto mismatch25;
311             }
312             {//Expression
313                 uint start22 = position;
314                 if((parse_ClassPredicate().assign!(RulePredicate)(bind_pred)) || (parse_FunctionPredicate().assign!(RulePredicate)(bind_pred)) || (parse_BindingPredicate().assign!(RulePredicate)(bind_pred))){
315                     clearErrors();
316                 }else{
317                     setError("Expected ClassPredicate, FunctionPredicate or BindingPredicate.");
318                     position = start22;
319                     goto mismatch25;
320                 }
321             }
322             goto match24;
323         mismatch25:
324             {/*do nothing*/}
325             position = start21;
326             goto mismatch23;
327         match24:
328             clearErrors();
329             goto match22;
330         }
331     match22:
332         debug Stdout.formatln("parse_RulePredicate() PASS");
333         return ResultT!(RulePredicate)(bind_pred);
334     mismatch23:
335         position = start20;
336         return ResultT!(RulePredicate)();
337     }
338
339     /*
340     
341 ClassPredicate
342     = new ClassPredicate(String name,Param[] params)
343     ::=  "new"  WS  Identifier:name  WS  ParamsExpr:params;
344
345     */
346     public ResultT!(ClassPredicate) parse_ClassPredicate(){
347         debug Stdout.formatln("parse_ClassPredicate()");
348         uint start23 = position;
349         String bind_name;
350         Param[] bind_params;
351        
352        
353         {//Expression
354             uint start24 = position;
355             if((terminal("new").success && parse_WS().success && parse_Identifier().assign!(String)(bind_name) && parse_WS().success && parse_ParamsExpr().assign!(Param[])(bind_params))){
356                 clearErrors();
357                 goto match26;
358             }else{
359                 position = start24;
360                 goto mismatch27;
361             }
362         }
363     match26:
364         debug Stdout.formatln("parse_ClassPredicate() PASS");
365         ResultT!(ClassPredicate) passed = ResultT!(ClassPredicate)(new ClassPredicate(bind_name,bind_params));
366         return passed;
367     mismatch27:
368         position = start23;
369         ResultT!(ClassPredicate) failed = ResultT!(ClassPredicate)();
370         return failed;
371     }
372
373     /*
374     
375 FunctionPredicate
376     = new FunctionPredicate(Param decl,Param[] params)
377     ::=  ExplicitParam:decl  WS  ParamsExpr:params;
378
379     */
380     public ResultT!(FunctionPredicate) parse_FunctionPredicate(){
381         debug Stdout.formatln("parse_FunctionPredicate()");
382         uint start25 = position;
383         Param bind_decl;
384         Param[] bind_params;
385        
386        
387         {//Expression
388             uint start26 = position;
389             if((parse_ExplicitParam().assign!(Param)(bind_decl) && parse_WS().success && parse_ParamsExpr().assign!(Param[])(bind_params))){
390                 clearErrors();
391                 goto match28;
392             }else{
393                 setError("Expected ExplicitParam.");
394                 position = start26;
395                 goto mismatch29;
396             }
397         }
398     match28:
399         debug Stdout.formatln("parse_FunctionPredicate() PASS");
400         ResultT!(FunctionPredicate) passed = ResultT!(FunctionPredicate)(new FunctionPredicate(bind_decl,bind_params));
401         return passed;
402     mismatch29:
403         position = start25;
404         ResultT!(FunctionPredicate) failed = ResultT!(FunctionPredicate)();
405         return failed;
406     }
407
408     /*
409     
410 BindingPredicate
411     = new BindingPredicate(Param param)
412     ::=  Param:param;
413
414     */
415     public ResultT!(BindingPredicate) parse_BindingPredicate(){
416         debug Stdout.formatln("parse_BindingPredicate()");
417         uint start27 = position;
418         Param bind_param;
419        
420        
421         {//Expression
422             uint start28 = position;
423             if((parse_Param().assign!(Param)(bind_param))){
424                 clearErrors();
425                 goto match30;
426             }else{
427                 setError("Expected Param.");
428                 position = start28;
429                 goto mismatch31;
430             }
431         }
432     match30:
433         debug Stdout.formatln("parse_BindingPredicate() PASS");
434         ResultT!(BindingPredicate) passed = ResultT!(BindingPredicate)(new BindingPredicate(bind_param));
435         return passed;
436     mismatch31:
437         position = start27;
438         ResultT!(BindingPredicate) failed = ResultT!(BindingPredicate)();
439         return failed;
440     }
441
442     /*
443     
444 ParamsExpr
445     = Param[] params
446     ::=  "("  WS [  Param:~params  WS {  ","  WS  Param:~params  WS}]  ")";
447
448     */
449     public ResultT!(Param[]) parse_ParamsExpr(){
450         debug Stdout.formatln("parse_ParamsExpr()");
451         uint start29 = position;
452         Param[] bind_params;
453        
454        
455         {//Expression
456             uint start30 = position;
457             if(!(terminal("(").success)){
458                 goto mismatch35;
459             }
460             if(!(parse_WS().success)){
461                 goto mismatch35;
462             }
463             {//OptionalExpr
464                 {//Expression
465                     uint start32 = position;
466                     if(!(parse_Param().assignCat!(Param[])(bind_params))){
467                         goto mismatch37;
468                     }
469                     if(!(parse_WS().success)){
470                         goto mismatch37;
471                     }
472                     {//ZeroOrMoreExpr
473                         uint termPos34;
474                     loop38:
475                         termPos34 = position;
476                     exprStart40:
477                         {//Expression
478                             uint start35 = position;
479                             if((terminal(",").success && parse_WS().success && parse_Param().assignCat!(Param[])(bind_params) && parse_WS().success)){
480                                 clearErrors();
481                                 goto loop38;
482                             }else{
483                                 position = start35;
484                                 goto loopend39;
485                             }
486                         }
487                     loopend39:
488                         {/*do nothing*/}
489                     }
490                     goto match36;
491                 mismatch37:
492                     {/*do nothing*/}
493                     position = start32;
494                     {/*do nothing*/}
495                 match36:
496                     clearErrors();
497                     {/*do nothing*/}
498                 }
499             }
500             if(!(terminal(")").success)){
501                 goto mismatch35;
502             }
503             goto match34;
504         mismatch35:
505             {/*do nothing*/}
506             position = start30;
507             goto mismatch33;
508         match34:
509             clearErrors();
510             goto match32;
511         }
512     match32:
513         debug Stdout.formatln("parse_ParamsExpr() PASS");
514         return ResultT!(Param[])(bind_params);
515     mismatch33:
516         position = start29;
517         return ResultT!(Param[])();
518     }
519
520     /*
521     
522 Param
523     = Param param
524     ::=  ExplicitParam:param |  WeakParam:param;
525
526     */
527     public ResultT!(Param) parse_Param(){
528         debug Stdout.formatln("parse_Param()");
529         uint start36 = position;
530         Param bind_param;
531        
532        
533         {//Expression
534             uint start37 = position;
535             if((parse_ExplicitParam().assign!(Param)(bind_param)) || (parse_WeakParam().assign!(Param)(bind_param))){
536                 clearErrors();
537                 goto match41;
538             }else{
539                 setError("Expected ExplicitParam or WeakParam.");
540                 position = start37;
541                 goto mismatch42;
542             }
543         }
544     match41:
545         debug Stdout.formatln("parse_Param() PASS");
546         return ResultT!(Param)(bind_param);
547     mismatch42:
548         position = start36;
549         return ResultT!(Param)();
550     }
551
552     /*
553     
554 WeakParam
555     = new Param(String name)
556     ::=  Identifier:name;
557
558     */
559     public ResultT!(Param) parse_WeakParam(){
560         debug Stdout.formatln("parse_WeakParam()");
561         uint start38 = position;
562         String bind_name;
563        
564        
565         {//Expression
566             uint start39 = position;
567             if((parse_Identifier().assign!(String)(bind_name))){
568                 clearErrors();
569                 goto match43;
570             }else{
571                 setError("Expected Identifier.");
572                 position = start39;
573                 goto mismatch44;
574             }
575         }
576     match43:
577         debug Stdout.formatln("parse_WeakParam() PASS");
578         ResultT!(Param) passed = ResultT!(Param)(new Param(bind_name));
579         return passed;
580     mismatch44:
581         position = start38;
582         ResultT!(Param) failed = ResultT!(Param)();
583         return failed;
584     }
585
586     /*
587     
588 ExplicitParam
589     = new Param(bool isArray,String type,String name)
590     ::=  Identifier:type  WS [  "[]":isArray  Brackets  WS]  Identifier:name;
591
592     */
593     public ResultT!(Param) parse_ExplicitParam(){
594         debug Stdout.formatln("parse_ExplicitParam()");
595         uint start40 = position;
596         bool bind_isArray;
597         String bind_type;
598         String bind_name;
599        
600        
601         {//Expression
602             uint start41 = position;
603             if(!(parse_Identifier().assign!(String)(bind_type))){
604                 goto mismatch48;
605             }
606             if(!(parse_WS().success)){
607                 goto mismatch48;
608             }
609             {//OptionalExpr
610                 {//Expression
611                     uint start43 = position;
612                     if((terminal("[]").assign!(bool)(bind_isArray) && parse_Brackets().success && parse_WS().success)){
613                         clearErrors();
614                     }else{
615                         position = start43;
616                     }
617                 }
618             }
619             if(!(parse_Identifier().assign!(String)(bind_name))){
620                 goto mismatch48;
621             }
622             goto match47;
623         mismatch48:
624             setError("Expected Identifier.");
625             position = start41;
626             goto mismatch46;
627         match47:
628             clearErrors();
629             goto match45;
630         }
631     match45:
632         debug Stdout.formatln("parse_ExplicitParam() PASS");
633         ResultT!(Param) passed = ResultT!(Param)(new Param(bind_isArray,bind_type,bind_name));
634         return passed;
635     mismatch46:
636         position = start40;
637         ResultT!(Param) failed = ResultT!(Param)();
638         return failed;
639     }
640
641     /*
642     
643 Brackets
644     ::= [  "[]"  Brackets];
645
646     */
647     public ResultT!(bool) parse_Brackets(){
648         debug Stdout.formatln("parse_Brackets()");
649         uint start44 = position;
650         //no declarations
651        
652        
653         {//Expression
654             uint start45 = position;
655             {//OptionalExpr
656                 {//Expression
657                     uint start47 = position;
658                     if((terminal("[]").success && parse_Brackets().success)){
659                         clearErrors();
660                     }else{
661                         position = start47;
662                     }
663                 }
664             }
665             goto match51;
666         mismatch52:
667             {/*do nothing*/}
668             position = start45;
669             goto mismatch50;
670         match51:
671             clearErrors();
672             goto match49;
673         }
674     match49:
675         debug Stdout.formatln("parse_Brackets() PASS");
676         return ResultT!(bool)(true);
677     mismatch50:
678         position = start44;
679         return ResultT!(bool)();
680     }
681
682     /*
683     
684 Expression
685     = new Expression(Term[] terms)
686     ::=  Term:~terms  WS {  "|"  WS  Term:~terms  WS};
687
688     */
689     public ResultT!(Expression) parse_Expression(){
690         debug Stdout.formatln("parse_Expression()");
691         uint start48 = position;
692         Term[] bind_terms;
693        
694        
695         {//Expression
696             uint start49 = position;
697             if(!(parse_Term().assignCat!(Term[])(bind_terms))){
698                 goto mismatch56;
699             }
700             if(!(parse_WS().success)){
701                 goto mismatch56;
702             }
703             {//ZeroOrMoreExpr
704                 uint termPos51;
705             loop57:
706                 termPos51 = position;
707             exprStart59:
708                 {//Expression
709                     uint start52 = position;
710                     if((terminal("|").success && parse_WS().success && parse_Term().assignCat!(Term[])(bind_terms) && parse_WS().success)){
711                         clearErrors();
712                         goto loop57;
713                     }else{
714                         position = start52;
715                         goto loopend58;
716                     }
717                 }
718             loopend58:
719                 {/*do nothing*/}
720             }
721             goto match55;
722         mismatch56:
723             setError("Expected Term.");
724             position = start49;
725             goto mismatch54;
726         match55:
727             clearErrors();
728             goto match53;
729         }
730     match53:
731         debug Stdout.formatln("parse_Expression() PASS");
732         ResultT!(Expression) passed = ResultT!(Expression)(new Expression(bind_terms));
733         return passed;
734     mismatch54:
735         position = start48;
736         ResultT!(Expression) failed = ResultT!(Expression)();
737         return failed;
738     }
739
740     /*
741     
742 Term
743     = SubExpression[] factors
744     ::=  SubExpression:~factors  WS {  SubExpression:~factors  WS};
745
746     */
747     public ResultT!(SubExpression[]) parse_Term(){
748         debug Stdout.formatln("parse_Term()");
749         uint start53 = position;
750         SubExpression[] bind_factors;
751        
752        
753         {//Expression
754             uint start54 = position;
755             if(!(parse_SubExpression().assignCat!(SubExpression[])(bind_factors))){
756                 goto mismatch63;
757             }
758             if(!(parse_WS().success)){
759                 goto mismatch63;
760             }
761             {//ZeroOrMoreExpr
762                 uint termPos56;
763             loop64:
764                 termPos56 = position;
765             exprStart66:
766                 {//Expression
767                     uint start57 = position;
768                     if((parse_SubExpression().assignCat!(SubExpression[])(bind_factors) && parse_WS().success)){
769                         clearErrors();
770                         goto loop64;
771                     }else{
772                         setError("Expected SubExpression.");
773                         position = start57;
774                         goto loopend65;
775                     }
776                 }
777             loopend65:
778                 {/*do nothing*/}
779             }
780             goto match62;
781         mismatch63:
782             setError("Expected SubExpression.");
783             position = start54;
784             goto mismatch61;
785         match62:
786             clearErrors();
787             goto match60;
788         }
789     match60:
790         debug Stdout.formatln("parse_Term() PASS");
791         return ResultT!(SubExpression[])(bind_factors);
792     mismatch61:
793         position = start53;
794         return ResultT!(SubExpression[])();
795     }
796
797     /*
798     
799 SubExpression
800     = SubExpression expr
801     ::=  Production:expr |  Substitution:expr |  Terminal:expr |  Range:expr |  Regexp:expr |  GroupExpr:expr |  OptionalExpr:expr |  ZeroOrMoreExpr:expr |  NegateExpr:expr |  TestExpr:expr |  LiteralExpr:expr |  CustomTerminal:expr;
802
803     */
804     public ResultT!(SubExpression) parse_SubExpression(){
805         debug Stdout.formatln("parse_SubExpression()");
806         uint start58 = position;
807         SubExpression bind_expr;
808        
809        
810         {//Expression
811             uint start59 = position;
812             if((parse_Production().assign!(SubExpression)(bind_expr)) || (parse_Substitution().assign!(SubExpression)(bind_expr)) || (parse_Terminal().assign!(SubExpression)(bind_expr)) || (parse_Range().assign!(SubExpression)(bind_expr)) || (parse_Regexp().assign!(SubExpression)(bind_expr)) || (parse_GroupExpr().assign!(SubExpression)(bind_expr)) || (parse_OptionalExpr().assign!(SubExpression)(bind_expr)) || (parse_ZeroOrMoreExpr().assign!(SubExpression)(bind_expr)) || (parse_NegateExpr().assign!(SubExpression)(bind_expr)) || (parse_TestExpr().assign!(SubExpression)(bind_expr)) || (parse_LiteralExpr().assign!(SubExpression)(bind_expr)) || (parse_CustomTerminal().assign!(SubExpression)(bind_expr))){
813                 clearErrors();
814                 goto match67;
815             }else{
816                 setError("Expected Production, Substitution, Terminal, Range, Regexp, GroupExpr, OptionalExpr, ZeroOrMoreExpr, NegateExpr, TestExpr, LiteralExpr or CustomTerminal.");
817                 position = start59;
818                 goto mismatch68;
819             }
820         }
821     match67:
822         debug Stdout.formatln("parse_SubExpression() PASS");
823         return ResultT!(SubExpression)(bind_expr);
824     mismatch68:
825         position = start58;
826         return ResultT!(SubExpression)();
827     }
828
829     /*
830     
831 Production
832     = new Production(String name,Binding binding,ProductionArg[] args)
833     ::=  Identifier:name  WS [  "!("  WS  ProductionArg:~args {  WS  ","  WS  ProductionArg:~args} ")"] [  Binding:binding];
834
835     */
836     public ResultT!(Production) parse_Production(){
837         debug Stdout.formatln("parse_Production()");
838         uint start60 = position;
839         String bind_name;
840         Binding bind_binding;
841         ProductionArg[] bind_args;
842        
843        
844         {//Expression
845             uint start61 = position;
846             if(!(parse_Identifier().assign!(String)(bind_name))){
847                 goto mismatch72;
848             }
849             if(!(parse_WS().success)){
850                 goto mismatch72;
851             }
852             {//OptionalExpr
853                 {//Expression
854                     uint start63 = position;
855                     if(!(terminal("!(").success)){
856                         goto mismatch74;
857                     }
858                     if(!(parse_WS().success)){
859                         goto mismatch74;
860                     }
861                     if(!(parse_ProductionArg().assignCat!(ProductionArg[])(bind_args))){
862                         goto mismatch74;
863                     }
864                     {//ZeroOrMoreExpr
865                         uint start64 = position;
866                         uint termPos65;
867                     loop75:
868                         termPos65 = position;
869                         if(terminal(")").success){
870                             goto loopend76;
871                         }else{
872                             goto exprStart77;
873                         }
874                     exprStart77:
875                         {//Expression
876                             uint start66 = position;
877                             if((parse_WS().success && terminal(",").success && parse_WS().success && parse_ProductionArg().assignCat!(ProductionArg[])(bind_args))){
878                                 clearErrors();
879                                 goto loop75;
880                             }else{
881                                 setError("Expected WS.");
882                                 position = start66;
883                                 goto loopend76;
884                             }
885                         }
886                     loopend76:
887                         {/*do nothing*/}
888                     }
889                     goto match73;
890                 mismatch74:
891                     {/*do nothing*/}
892                     position = start63;
893                     {/*do nothing*/}
894                 match73:
895                     clearErrors();
896                     {/*do nothing*/}
897                 }
898             }
899             {//OptionalExpr
900                 {//Expression
901                     uint start68 = position;
902                     if((parse_Binding().assign!(Binding)(bind_binding))){
903                         clearErrors();
904                     }else{
905                         position = start68;
906                     }
907                 }
908             }
909             goto match71;
910         mismatch72:
911             setError("Expected Identifier.");
912             position = start61;
913             goto mismatch70;
914         match71:
915             clearErrors();
916             goto match69;
917         }
918     match69:
919         debug Stdout.formatln("parse_Production() PASS");
920         ResultT!(Production) passed = ResultT!(Production)(new Production(bind_name,bind_binding,bind_args));
921         return passed;
922     mismatch70:
923         position = start60;
924         ResultT!(Production) failed = ResultT!(Production)();
925         return failed;
926     }
927
928     /*
929     
930 ProductionArg
931     = ProductionArg arg
932     ::=  StringProductionArg:arg |  BindingProductionArg:arg;
933
934     */
935     public ResultT!(ProductionArg) parse_ProductionArg(){
936         debug Stdout.formatln("parse_ProductionArg()");
937         uint start69 = position;
938         ProductionArg bind_arg;
939        
940        
941         {//Expression
942             uint start70 = position;
943             if((parse_StringProductionArg().assign!(ProductionArg)(bind_arg)) || (parse_BindingProductionArg().assign!(ProductionArg)(bind_arg))){
944                 clearErrors();
945                 goto match78;
946             }else{
947                 setError("Expected StringProductionArg or BindingProductionArg.");
948                 position = start70;
949                 goto mismatch79;
950             }
951         }
952     match78:
953         debug Stdout.formatln("parse_ProductionArg() PASS");
954         return ResultT!(ProductionArg)(bind_arg);
955     mismatch79:
956         position = start69;
957         return ResultT!(ProductionArg)();
958     }
959
960     /*
961     
962 StringProductionArg
963     = new StringProductionArg(String value)
964     ::=  String:value;
965
966     */
967     public ResultT!(StringProductionArg) parse_StringProductionArg(){
968         debug Stdout.formatln("parse_StringProductionArg()");
969         uint start71 = position;
970         String bind_value;
971        
972        
973         {//Expression
974             uint start72 = position;
975             if((parse_String().assign!(String)(bind_value))){
976                 clearErrors();
977                 goto match80;
978             }else{
979                 setError("Expected String.");
980                 position = start72;
981                 goto mismatch81;
982             }
983         }
984     match80:
985         debug Stdout.formatln("parse_StringProductionArg() PASS");
986         ResultT!(StringProductionArg) passed = ResultT!(StringProductionArg)(new StringProductionArg(bind_value));
987         return passed;
988     mismatch81:
989         position = start71;
990         ResultT!(StringProductionArg) failed = ResultT!(StringProductionArg)();
991         return failed;
992     }
993
994     /*
995     
996 BindingProductionArg
997     = new BindingProductionArg(String value)
998     ::=  Identifier:value;
999
1000     */
1001     public ResultT!(BindingProductionArg) parse_BindingProductionArg(){
1002         debug Stdout.formatln("parse_BindingProductionArg()");
1003         uint start73 = position;
1004         String bind_value;
1005        
1006        
1007         {//Expression
1008             uint start74 = position;
1009             if((parse_Identifier().assign!(String)(bind_value))){
1010                 clearErrors();
1011                 goto match82;
1012             }else{
1013                 setError("Expected Identifier.");
1014                 position = start74;
1015                 goto mismatch83;
1016             }
1017         }
1018     match82:
1019         debug Stdout.formatln("parse_BindingProductionArg() PASS");
1020         ResultT!(BindingProductionArg) passed = ResultT!(BindingProductionArg)(new BindingProductionArg(bind_value));
1021         return passed;
1022     mismatch83:
1023         position = start73;
1024         ResultT!(BindingProductionArg) failed = ResultT!(BindingProductionArg)();
1025         return failed;
1026     }
1027
1028     /*
1029     
1030 Substitution
1031     = new Substitution(String name,Binding binding)
1032     ::=  "."  Identifier:name  WS [  Binding:binding];
1033
1034     */
1035     public ResultT!(Substitution) parse_Substitution(){
1036         debug Stdout.formatln("parse_Substitution()");
1037         uint start75 = position;
1038         String bind_name;
1039         Binding bind_binding;
1040        
1041        
1042         {//Expression
1043             uint start76 = position;
1044             if(!(terminal(".").success)){
1045                 goto mismatch87;
1046             }
1047             if(!(parse_Identifier().assign!(String)(bind_name))){
1048                 goto mismatch87;
1049             }
1050             if(!(parse_WS().success)){
1051                 goto mismatch87;
1052             }
1053             {//OptionalExpr
1054                 {//Expression
1055                     uint start78 = position;
1056                     if((parse_Binding().assign!(Binding)(bind_binding))){
1057                         clearErrors();
1058                     }else{
1059                         position = start78;
1060                     }
1061                 }
1062             }
1063             goto match86;
1064         mismatch87:
1065             {/*do nothing*/}
1066             position = start76;
1067             goto mismatch85;
1068         match86:
1069             clearErrors();
1070             goto match84;
1071         }
1072     match84:
1073         debug Stdout.formatln("parse_Substitution() PASS");
1074         ResultT!(Substitution) passed = ResultT!(Substitution)(new Substitution(bind_name,bind_binding));
1075         return passed;
1076     mismatch85:
1077         position = start75;
1078         ResultT!(Substitution) failed = ResultT!(Substitution)();
1079         return failed;
1080     }
1081
1082     /*
1083     
1084 GroupExpr
1085     = new GroupExpr(Expression expr,Binding binding)
1086     ::=  "("  WS  Expression:expr  WS  ")"  WS [  Binding:binding];
1087
1088     */
1089     public ResultT!(GroupExpr) parse_GroupExpr(){
1090         debug Stdout.formatln("parse_GroupExpr()");
1091         uint start79 = position;
1092         Expression bind_expr;
1093         Binding bind_binding;
1094        
1095        
1096         {//Expression
1097             uint start80 = position;
1098             if(!(terminal("(").success)){
1099                 goto mismatch91;
1100             }
1101             if(!(parse_WS().success)){
1102                 goto mismatch91;
1103             }
1104             if(!(parse_Expression().assign!(Expression)(bind_expr))){
1105                 goto mismatch91;
1106             }
1107             if(!(parse_WS().success)){
1108                 goto mismatch91;
1109             }
1110             if(!(terminal(")").success)){
1111                 goto mismatch91;
1112             }
1113             if(!(parse_WS().success)){
1114                 goto mismatch91;
1115             }
1116             {//OptionalExpr
1117                 {//Expression
1118                     uint start82 = position;
1119                     if((parse_Binding().assign!(Binding)(bind_binding))){
1120                         clearErrors();
1121                     }else{
1122                         position = start82;
1123                     }
1124                 }
1125             }
1126             goto match90;
1127         mismatch91:
1128             {/*do nothing*/}
1129             position = start80;
1130             goto mismatch89;
1131         match90:
1132             clearErrors();
1133             goto match88;
1134         }
1135     match88:
1136         debug Stdout.formatln("parse_GroupExpr() PASS");
1137         ResultT!(GroupExpr) passed = ResultT!(GroupExpr)(new GroupExpr(bind_expr,bind_binding));
1138         return passed;
1139     mismatch89:
1140         position = start79;
1141         ResultT!(GroupExpr) failed = ResultT!(GroupExpr)();
1142         return failed;
1143     }
1144
1145     /*
1146     
1147 OptionalExpr
1148     = new OptionalExpr(Expression expr,Binding binding)
1149     ::=  "["  WS  Expression:expr  WS  "]"  WS [  Binding:binding];
1150
1151     */
1152     public ResultT!(OptionalExpr) parse_OptionalExpr(){
1153         debug Stdout.formatln("parse_OptionalExpr()");
1154         uint start83 = position;
1155         Expression bind_expr;
1156         Binding bind_binding;
1157        
1158        
1159         {//Expression
1160             uint start84 = position;
1161             if(!(terminal("[").success)){
1162                 goto mismatch95;
1163             }
1164             if(!(parse_WS().success)){
1165                 goto mismatch95;
1166             }
1167             if(!(parse_Expression().assign!(Expression)(bind_expr))){
1168                 goto mismatch95;
1169             }
1170             if(!(parse_WS().success)){
1171                 goto mismatch95;
1172             }
1173             if(!(terminal("]").success)){
1174                 goto mismatch95;
1175             }
1176             if(!(parse_WS().success)){
1177                 goto mismatch95;
1178             }
1179             {//OptionalExpr
1180                 {//Expression
1181                     uint start86 = position;
1182                     if((parse_Binding().assign!(Binding)(bind_binding))){
1183                         clearErrors();
1184                     }else{
1185                         position = start86;
1186                     }
1187                 }
1188             }
1189             goto match94;
1190         mismatch95:
1191             {/*do nothing*/}
1192             position = start84;
1193             goto mismatch93;
1194         match94:
1195             clearErrors();
1196             goto match92;
1197         }
1198     match92:
1199         debug Stdout.formatln("parse_OptionalExpr() PASS");
1200         ResultT!(OptionalExpr) passed = ResultT!(OptionalExpr)(new OptionalExpr(bind_expr,bind_binding));
1201         return passed;
1202     mismatch93:
1203         position = start83;
1204         ResultT!(OptionalExpr) failed = ResultT!(OptionalExpr)();
1205         return failed;
1206     }
1207
1208     /*
1209     
1210 ZeroOrMoreExpr
1211     = new ZeroOrMoreExpr(Expression expr,Binding binding,SubExpression term)
1212     ::=  "{"  WS  Expression:expr  WS  "}"  WS [  Binding:binding  WS] [  SubExpression:term];
1213
1214     */
1215     public ResultT!(ZeroOrMoreExpr) parse_ZeroOrMoreExpr(){
1216         debug Stdout.formatln("parse_ZeroOrMoreExpr()");
1217         uint start87 = position;
1218         Expression bind_expr;
1219         Binding bind_binding;
1220         SubExpression bind_term;
1221        
1222        
1223         {//Expression
1224             uint start88 = position;
1225             if(!(terminal("{").success)){
1226                 goto mismatch99;
1227             }
1228             if(!(parse_WS().success)){
1229                 goto mismatch99;
1230             }
1231             if(!(parse_Expression().assign!(Expression)(bind_expr))){
1232                 goto mismatch99;
1233             }
1234             if(!(parse_WS().success)){
1235                 goto mismatch99;
1236             }
1237             if(!(terminal("}").success)){
1238                 goto mismatch99;
1239             }
1240             if(!(parse_WS().success)){
1241                 goto mismatch99;
1242             }
1243             {//OptionalExpr
1244                 {//Expression
1245                     uint start90 = position;
1246                     if((parse_Binding().assign!(Binding)(bind_binding) && parse_WS().success)){
1247                         clearErrors();
1248                     }else{
1249                         position = start90;
1250                     }
1251                 }
1252             }
1253             {//OptionalExpr
1254                 {//Expression
1255                     uint start92 = position;
1256                     if((parse_SubExpression().assign!(SubExpression)(bind_term))){
1257                         clearErrors();
1258                     }else{
1259                         position = start92;
1260                     }
1261                 }
1262             }
1263             goto match98;
1264         mismatch99:
1265             {/*do nothing*/}
1266             position = start88;
1267             goto mismatch97;
1268         match98:
1269             clearErrors();
1270             goto match96;
1271         }
1272     match96:
1273         debug Stdout.formatln("parse_ZeroOrMoreExpr() PASS");
1274         ResultT!(ZeroOrMoreExpr) passed = ResultT!(ZeroOrMoreExpr)(new ZeroOrMoreExpr(bind_expr,bind_binding,bind_term));
1275         return passed;
1276     mismatch97:
1277         position = start87;
1278         ResultT!(ZeroOrMoreExpr) failed = ResultT!(ZeroOrMoreExpr)();
1279         return failed;
1280     }
1281
1282     /*
1283     
1284 Terminal
1285     = new Terminal(String text,Binding binding)
1286     ::=  String:text  WS [  Binding:binding];
1287
1288     */
1289     public ResultT!(Terminal) parse_Terminal(){
1290         debug Stdout.formatln("parse_Terminal()");
1291         uint start93 = position;
1292         String bind_text;
1293         Binding bind_binding;
1294        
1295        
1296         {//Expression
1297             uint start94 = position;
1298             if(!(parse_String().assign!(String)(bind_text))){
1299                 goto mismatch103;
1300             }
1301             if(!(parse_WS().success)){
1302                 goto mismatch103;
1303             }
1304             {//OptionalExpr
1305                 {//Expression
1306                     uint start96 = position;
1307                     if((parse_Binding().assign!(Binding)(bind_binding))){
1308                         clearErrors();
1309                     }else{
1310                         position = start96;
1311                     }
1312                 }
1313             }
1314             goto match102;
1315         mismatch103:
1316             setError("Expected String.");
1317             position = start94;
1318             goto mismatch101;
1319         match102:
1320             clearErrors();
1321             goto match100;
1322         }
1323     match100:
1324         debug Stdout.formatln("parse_Terminal() PASS");
1325         ResultT!(Terminal) passed = ResultT!(Terminal)(new Terminal(bind_text,bind_binding));
1326         return passed;
1327     mismatch101:
1328         position = start93;
1329         ResultT!(Terminal) failed = ResultT!(Terminal)();
1330         return failed;
1331     }
1332
1333     /*
1334     
1335 Range
1336     = new Range(String start,String end,Binding binding)
1337     ::=  HexExpr:start  WS [  "-"  WS  HexExpr:end  WS] [  Binding:binding];
1338
1339     */
1340     public ResultT!(Range) parse_Range(){
1341         debug Stdout.formatln("parse_Range()");
1342         uint start97 = position;
1343         String bind_start;
1344         String bind_end;
1345         Binding bind_binding;
1346        
1347        
1348         {//Expression
1349             uint start98 = position;
1350             if(!(parse_HexExpr().assign!(String)(bind_start))){
1351                 goto mismatch107;
1352             }
1353             if(!(parse_WS().success)){
1354                 goto mismatch107;
1355             }
1356             {//OptionalExpr
1357                 {//Expression
1358                     uint start100 = position;
1359                     if((terminal("-").success && parse_WS().success && parse_HexExpr().assign!(String)(bind_end) && parse_WS().success)){
1360                         clearErrors();
1361                     }else{
1362                         position = start100;
1363                     }
1364                 }
1365             }
1366             {//OptionalExpr
1367                 {//Expression
1368                     uint start102 = position;
1369                     if((parse_Binding().assign!(Binding)(bind_binding))){
1370                         clearErrors();
1371                     }else{
1372                         position = start102;
1373                     }
1374                 }
1375             }
1376             goto match106;
1377         mismatch107:
1378             setError("Expected HexExpr.");
1379             position = start98;
1380             goto mismatch105;
1381         match106:
1382             clearErrors();
1383             goto match104;
1384         }
1385     match104:
1386         debug Stdout.formatln("parse_Range() PASS");
1387         ResultT!(Range) passed = ResultT!(Range)(new Range(bind_start,bind_end,bind_binding));
1388         return passed;
1389     mismatch105:
1390         position = start97;
1391         ResultT!(Range) failed = ResultT!(Range)();
1392         return failed;
1393     }
1394
1395     /*
1396     
1397 Regexp
1398     = new Regexp(String text,Binding binding)
1399     ::= (  "r"  String:text |  "`" {  any}:text "`")  WS [  Binding:binding];
1400
1401     */
1402     public ResultT!(Regexp) parse_Regexp(){
1403         debug Stdout.formatln("parse_Regexp()");
1404         uint start103 = position;
1405         String bind_text;
1406         Binding bind_binding;
1407        
1408        
1409         {//Expression
1410             uint start104 = position;
1411             {//Expression
1412                 uint start105 = position;
1413                 if(terminal("r").success && parse_String().assign!(String)(bind_text)){
1414                     goto match112;
1415                 }
1416                 if(!(terminal("`").success)){
1417                     goto mismatch113;
1418                 }
1419                 {//ZeroOrMoreExpr
1420                     uint start106 = position;
1421                     uint termPos107;
1422                 loop114:
1423                     termPos107 = position;
1424                     if(terminal("`").success){
1425                         goto loopend115;
1426                     }else{
1427                         goto exprStart116;
1428                     }
1429                 exprStart116:
1430                     {//Expression
1431                         uint start108 = position;
1432                         if((parse_any().success)){
1433                             clearErrors();
1434                             goto loop114;
1435                         }else{
1436                             setError("Expected any.");
1437                             position = start108;
1438                             goto loopend115;
1439                         }
1440                     }
1441                 loopend115:
1442                     smartAssign!(String,String)(bind_text,sliceData(start106,termPos107));
1443                     {/*do nothing*/}
1444                 }
1445                 goto match112;
1446             mismatch113:
1447                 {/*do nothing*/}
1448                 position = start105;
1449                 goto mismatch111;
1450             match112:
1451                 clearErrors();
1452                 {/*do nothing*/}
1453             }
1454             if(!(parse_WS().success)){
1455                 goto mismatch111;
1456             }
1457             {//OptionalExpr
1458                 {//Expression
1459                     uint start110 = position;
1460                     if((parse_Binding().assign!(Binding)(bind_binding))){
1461                         clearErrors();
1462                     }else{
1463                         position = start110;
1464                     }
1465                 }
1466             }
1467             goto match110;
1468         mismatch111:
1469             {/*do nothing*/}
1470             position = start104;
1471             goto mismatch109;
1472         match110:
1473             clearErrors();
1474             goto match108;
1475         }
1476     match108:
1477         debug Stdout.formatln("parse_Regexp() PASS");
1478         ResultT!(Regexp) passed = ResultT!(Regexp)(new Regexp(bind_text,bind_binding));
1479         return passed;
1480     mismatch109:
1481         position = start103;
1482         ResultT!(Regexp) failed = ResultT!(Regexp)();
1483         return failed;
1484     }
1485
1486     /*
1487     
1488 NegateExpr
1489     = new Negate(SubExpression expr)
1490     ::=  "!"  WS  SubExpression:expr;
1491
1492     */
1493     public ResultT!(Negate) parse_NegateExpr(){
1494         debug Stdout.formatln("parse_NegateExpr()");
1495         uint start111 = position;
1496         SubExpression bind_expr;
1497        
1498        
1499         {//Expression
1500             uint start112 = position;
1501             if((terminal("!").success && parse_WS().success && parse_SubExpression().assign!(SubExpression)(bind_expr))){
1502                 clearErrors();
1503                 goto match117;
1504             }else{
1505                 position = start112;
1506                 goto mismatch118;
1507             }
1508         }
1509     match117:
1510         debug Stdout.formatln("parse_NegateExpr() PASS");
1511         ResultT!(Negate) passed = ResultT!(Negate)(new Negate(bind_expr));
1512         return passed;
1513     mismatch118:
1514         position = start111;
1515         ResultT!(Negate) failed = ResultT!(Negate)();
1516         return failed;
1517     }
1518
1519     /*
1520     
1521 TestExpr
1522     = new Test(SubExpression expr)
1523     ::=  "/"  WS  SubExpression:expr;
1524
1525     */
1526     public ResultT!(Test) parse_TestExpr(){
1527         debug Stdout.formatln("parse_TestExpr()");
1528         uint start113 = position;
1529         SubExpression bind_expr;
1530        
1531        
1532         {//Expression
1533             uint start114 = position;
1534             if((terminal("/").success && parse_WS().success && parse_SubExpression().assign!(SubExpression)(bind_expr))){
1535                 clearErrors();
1536                 goto match119;
1537             }else{
1538                 position = start114;
1539                 goto mismatch120;
1540             }
1541         }
1542     match119:
1543         debug Stdout.formatln("parse_TestExpr() PASS");
1544         ResultT!(Test) passed = ResultT!(Test)(new Test(bind_expr));
1545         return passed;
1546     mismatch120:
1547         position = start113;
1548         ResultT!(Test) failed = ResultT!(Test)();
1549         return failed;
1550     }
1551
1552     /*
1553     
1554 LiteralExpr
1555     = new LiteralExpr(String name,Binding binding,ProductionArg[] args)
1556     ::=  "@"  Identifier:name  WS [  "!("  WS  ProductionArg:~args {  WS  ","  WS  ProductionArg:~args} ")"] [  Binding:binding];
1557
1558     */
1559     public ResultT!(LiteralExpr) parse_LiteralExpr(){
1560         debug Stdout.formatln("parse_LiteralExpr()");
1561         uint start115 = position;
1562         String bind_name;
1563         Binding bind_binding;
1564         ProductionArg[] bind_args;
1565        
1566        
1567         {//Expression
1568             uint start116 = position;
1569             if(!(terminal("@").success)){
1570                 goto mismatch124;
1571             }
1572             if(!(parse_Identifier().assign!(String)(bind_name))){
1573                 goto mismatch124;
1574             }
1575             if(!(parse_WS().success)){
1576                 goto mismatch124;
1577             }
1578             {//OptionalExpr
1579                 {//Expression
1580                     uint start118 = position;
1581                     if(!(terminal("!(").success)){
1582                         goto mismatch126;
1583                     }
1584                     if(!(parse_WS().success)){
1585                         goto mismatch126;
1586                     }
1587                     if(!(parse_ProductionArg().assignCat!(ProductionArg[])(bind_args))){
1588                         goto mismatch126;
1589                     }
1590                     {//ZeroOrMoreExpr
1591                         uint start119 = position;
1592                         uint termPos120;
1593                     loop127:
1594                         termPos120 = position;
1595                         if(terminal(")").success){
1596                             goto loopend128;
1597                         }else{
1598                             goto exprStart129;
1599                         }
1600                     exprStart129:
1601                         {//Expression
1602                             uint start121 = position;
1603                             if((parse_WS().success && terminal(",").success && parse_WS().success && parse_ProductionArg().assignCat!(ProductionArg[])(bind_args))){
1604                                 clearErrors();
1605                                 goto loop127;
1606                             }else{
1607                                 setError("Expected WS.");
1608                                 position = start121;
1609                                 goto loopend128;
1610                             }
1611                         }
1612                     loopend128:
1613                         {/*do nothing*/}
1614                     }
1615                     goto match125;
1616                 mismatch126:
1617                     {/*do nothing*/}
1618                     position = start118;
1619                     {/*do nothing*/}
1620                 match125:
1621                     clearErrors();
1622                     {/*do nothing*/}
1623                 }
1624             }
1625             {//OptionalExpr
1626                 {//Expression
1627                     uint start123 = position;
1628                     if((parse_Binding().assign!(Binding)(bind_binding))){
1629                         clearErrors();
1630                     }else{
1631                         position = start123;
1632                     }
1633                 }
1634             }
1635             goto match123;
1636         mismatch124:
1637             {/*do nothing*/}
1638             position = start116;
1639             goto mismatch122;
1640         match123:
1641             clearErrors();
1642             goto match121;
1643         }
1644     match121:
1645         debug Stdout.formatln("parse_LiteralExpr() PASS");
1646         ResultT!(LiteralExpr) passed = ResultT!(LiteralExpr)(new LiteralExpr(bind_name,bind_binding,bind_args));
1647         return passed;
1648     mismatch122:
1649         position = start115;
1650         ResultT!(LiteralExpr) failed = ResultT!(LiteralExpr)();
1651         return failed;
1652     }
1653
1654     /*
1655     
1656 CustomTerminal
1657     = new CustomTerminal(String name,Binding binding)
1658     ::=  "&"  Identifier:name  WS [  Binding:binding];
1659
1660     */
1661     public ResultT!(CustomTerminal) parse_CustomTerminal(){
1662         debug Stdout.formatln("parse_CustomTerminal()");
1663         uint start124 = position;
1664         String bind_name;
1665         Binding bind_binding;
1666        
1667        
1668         {//Expression
1669             uint start125 = position;
1670             if(!(terminal("&").success)){
1671                 goto mismatch133;
1672             }
1673             if(!(parse_Identifier().assign!(String)(bind_name))){
1674                 goto mismatch133;
1675             }
1676             if(!(parse_WS().success)){
1677                 goto mismatch133;
1678             }
1679             {//OptionalExpr
1680                 {//Expression
1681                     uint start127 = position;
1682                     if((parse_Binding().assign!(Binding)(bind_binding))){
1683                         clearErrors();
1684                     }else{
1685                         position = start127;
1686                     }
1687                 }
1688             }
1689             goto match132;
1690         mismatch133:
1691             {/*do nothing*/}
1692             position = start125;
1693             goto mismatch131;
1694         match132:
1695             clearErrors();
1696             goto match130;
1697         }
1698     match130:
1699         debug Stdout.formatln("parse_CustomTerminal() PASS");
1700         ResultT!(CustomTerminal) passed = ResultT!(CustomTerminal)(new CustomTerminal(bind_name,bind_binding));
1701         return passed;
1702     mismatch131:
1703         position = start124;
1704         ResultT!(CustomTerminal) failed = ResultT!(CustomTerminal)();
1705         return failed;
1706     }
1707
1708     /*
1709     
1710 Binding
1711     = new Binding(bool isConcat,String name)
1712     ::=  ":"  WS [  "~"]:isConcat   WS  Identifier:name;
1713
1714     */
1715     public ResultT!(Binding) parse_Binding(){
1716         debug Stdout.formatln("parse_Binding()");
1717         uint start128 = position;
1718         bool bind_isConcat;
1719         String bind_name;
1720        
1721        
1722         {//Expression
1723             uint start129 = position;
1724             if(!(terminal(":").success)){
1725                 goto mismatch137;
1726             }
1727             if(!(parse_WS().success)){
1728                 goto mismatch137;
1729             }
1730             {//OptionalExpr
1731                 uint start130 = position;
1732                 {//Expression
1733                     uint start131 = position;
1734                     if((terminal("~").success)){
1735                         clearErrors();
1736                     }else{
1737                         position = start131;
1738                     }
1739                 }
1740                 smartAssign!(bool,String)(bind_isConcat,sliceData(start130,position));
1741             }
1742             if(!(parse_WS().success)){
1743                 goto mismatch137;
1744             }
1745             if(!(parse_Identifier().assign!(String)(bind_name))){
1746                 goto mismatch137;
1747             }
1748             goto match136;
1749         mismatch137:
1750             {/*do nothing*/}
1751             position = start129;
1752             goto mismatch135;
1753         match136:
1754             clearErrors();
1755             goto match134;
1756         }
1757     match134:
1758         debug Stdout.formatln("parse_Binding() PASS");
1759         ResultT!(Binding) passed = ResultT!(Binding)(new Binding(bind_isConcat,bind_name));
1760         return passed;
1761     mismatch135:
1762         position = start128;
1763         ResultT!(Binding) failed = ResultT!(Binding)();
1764         return failed;
1765     }
1766
1767     /*
1768     
1769 Identifier
1770     = String value
1771     ::= (  IdentifierStartChar {  IdentifierChar}):value ;
1772
1773     */
1774     public ResultT!(String) parse_Identifier(){
1775         debug Stdout.formatln("parse_Identifier()");
1776         uint start132 = position;
1777         String bind_value;
1778        
1779        
1780         {//Expression
1781             uint start133 = position;
1782             {//GroupExpr
1783                 uint start134 = position;
1784                 {//Expression
1785                     uint start135 = position;
1786                     if(!(parse_IdentifierStartChar().success)){
1787                         goto mismatch143;
1788                     }
1789                     {//ZeroOrMoreExpr
1790                         uint termPos137;
1791                     loop144:
1792                         termPos137 = position;
1793                     exprStart146:
1794                         {//Expression
1795                             uint start138 = position;
1796                             if((parse_IdentifierChar().success)){
1797                                 clearErrors();
1798                                 goto loop144;
1799                             }else{
1800                                 setError("Expected IdentifierChar.");
1801                                 position = start138;
1802                                 goto loopend145;
1803                             }
1804                         }
1805                     loopend145:
1806                         {/*do nothing*/}
1807                     }
1808                     goto match142;
1809                 mismatch143:
1810                     setError("Expected IdentifierStartChar.");
1811                     position = start135;
1812                     goto mismatch141;
1813                 match142:
1814                     clearErrors();
1815                     {/*do nothing*/}
1816                 }
1817                 smartAssign!(String,String)(bind_value,sliceData(start134,position));
1818             }
1819             goto match140;
1820         mismatch141:
1821             {/*do nothing*/}
1822             position = start133;
1823             goto mismatch139;
1824         match140:
1825             clearErrors();
1826             goto match138;
1827         }
1828     match138:
1829         debug Stdout.formatln("parse_Identifier() PASS");
1830         return ResultT!(String)(bind_value);
1831     mismatch139:
1832         position = start132;
1833         return ResultT!(String)();
1834     }
1835
1836     /*
1837     
1838 IdentifierStartChar
1839     = String text
1840     ::= (  letter |  "_"):text ;
1841
1842     */
1843     public ResultT!(String) parse_IdentifierStartChar(){
1844         debug Stdout.formatln("parse_IdentifierStartChar()");
1845         uint start139 = position;
1846         String bind_text;
1847        
1848        
1849         {//Expression
1850             uint start140 = position;
1851             {//GroupExpr
1852                 uint start141 = position;
1853                 {//Expression
1854                     uint start142 = position;
1855                     if((parse_letter().success) || (terminal("_").success)){
1856                         clearErrors();
1857                     }else{
1858                         setError("Expected letter.");
1859                         position = start142;
1860                         goto mismatch150;
1861                     }
1862                 }
1863                 smartAssign!(String,String)(bind_text,sliceData(start141,position));
1864             }
1865             goto match149;
1866         mismatch150:
1867             {/*do nothing*/}
1868             position = start140;
1869             goto mismatch148;
1870         match149:
1871             clearErrors();
1872             goto match147;
1873         }
1874     match147:
1875         debug Stdout.formatln("parse_IdentifierStartChar() PASS");
1876         return ResultT!(String)(bind_text);
1877     mismatch148:
1878         position = start139;
1879         return ResultT!(String)();
1880     }
1881
1882     /*
1883     
1884 IdentifierChar
1885     = String text
1886     ::= (  letter |  digit |  "_" |  "."):text ;
1887
1888     */
1889     public ResultT!(String) parse_IdentifierChar(){
1890         debug Stdout.formatln("parse_IdentifierChar()");
1891         uint start143 = position;
1892         String bind_text;
1893        
1894        
1895         {//Expression
1896             uint start144 = position;
1897             {//GroupExpr
1898                 uint start145 = position;
1899                 {//Expression
1900                     uint start146 = position;
1901                     if((parse_letter().success) || (parse_digit().success) || (terminal("_").success) || (terminal(".").success)){
1902                         clearErrors();
1903                     }else{
1904                         setError("Expected letter or digit.");
1905                         position = start146;
1906                         goto mismatch154;
1907                     }
1908                 }
1909                 smartAssign!(String,String)(bind_text,sliceData(start145,position));
1910             }
1911             goto match153;
1912         mismatch154:
1913             {/*do nothing*/}
1914             position = start144;
1915             goto mismatch152;
1916         match153:
1917             clearErrors();
1918             goto match151;
1919         }
1920     match151:
1921         debug Stdout.formatln("parse_IdentifierChar() PASS");
1922         return ResultT!(String)(bind_text);
1923     mismatch152:
1924         position = start143;
1925         return ResultT!(String)();
1926     }
1927
1928     /*
1929     
1930 String
1931     = String text
1932     ::= (  "\"" |  "\'"):~delim  {  AnyChar}:text.delim;
1933
1934     */
1935     public ResultT!(String) parse_String(){
1936         debug Stdout.formatln("parse_String()");
1937         uint start147 = position;
1938         String bind_text;
1939        
1940         String bind_delim;
1941        
1942         {//Expression
1943             uint start148 = position;
1944             {//GroupExpr
1945                 uint start149 = position;
1946                 {//Expression
1947                     uint start150 = position;
1948                     if((terminal("\"").success) || (terminal("\'").success)){
1949                         clearErrors();
1950                     }else{
1951                         position = start150;
1952                         goto mismatch158;
1953                     }
1954                 }
1955                 smartAssignCat!(String,String)(bind_delim,sliceData(start149,position));
1956             }
1957             {//ZeroOrMoreExpr
1958                 uint start151 = position;
1959                 uint termPos152;
1960             loop159:
1961                 termPos152 = position;
1962                 if(terminal(convert!(String,String)(bind_delim)).success){
1963                     goto loopend160;
1964                 }else{
1965                     goto exprStart161;
1966                 }
1967             exprStart161:
1968                 {//Expression
1969                     uint start153 = position;
1970                     if((parse_AnyChar().success)){
1971                         clearErrors();
1972                         goto loop159;
1973                     }else{
1974                         setError("Expected AnyChar.");
1975                         position = start153;
1976                         goto loopend160;
1977                     }
1978                 }
1979             loopend160:
1980                 smartAssign!(String,String)(bind_text,sliceData(start151,termPos152));
1981                 {/*do nothing*/}
1982             }
1983             goto match157;
1984         mismatch158:
1985             {/*do nothing*/}
1986             position = start148;
1987             goto mismatch156;
1988         match157:
1989             clearErrors();
1990             goto match155;
1991         }
1992     match155:
1993         debug Stdout.formatln("parse_String() PASS");
1994         return ResultT!(String)(bind_text);
1995     mismatch156:
1996         position = start147;
1997         return ResultT!(String)();
1998     }
1999
2000     /*
2001     
2002 HexExpr
2003     = String text
2004     ::=  "#" (  hexdigit  hexdigit [  hexdigit  hexdigit [  hexdigit  hexdigit  hexdigit  hexdigit [  hexdigit  hexdigit  hexdigit  hexdigit  hexdigit  hexdigit  hexdigit  hexdigit]]]):text ;
2005
2006     */
2007     public ResultT!(String) parse_HexExpr(){
2008         debug Stdout.formatln("parse_HexExpr()");
2009         uint start154 = position;
2010         String bind_text;
2011        
2012        
2013         {//Expression
2014             uint start155 = position;
2015             if(!(terminal("#").success)){
2016                 goto mismatch165;
2017             }
2018             {//GroupExpr
2019                 uint start156 = position;
2020                 {//Expression
2021                     uint start157 = position;
2022                     if(!(parse_hexdigit().success)){
2023                         goto mismatch167;
2024                     }
2025                     if(!(parse_hexdigit().success)){
2026                         goto mismatch167;
2027                     }
2028                     {//OptionalExpr
2029                         {//Expression
2030                             uint start159 = position;
2031                             if(!(parse_hexdigit().success)){
2032                                 goto mismatch169;
2033                             }
2034                             if(!(parse_hexdigit().success)){
2035                                 goto mismatch169;
2036                             }
2037                             {//OptionalExpr
2038                                 {//Expression
2039                                     uint start161 = position;
2040                                     if(!(parse_hexdigit().success)){
2041                                         goto mismatch171;
2042                                     }
2043                                     if(!(parse_hexdigit().success)){
2044                                         goto mismatch171;
2045                                     }
2046                                     if(!(parse_hexdigit().success)){
2047                                         goto mismatch171;
2048                                     }
2049                                     if(!(parse_hexdigit().success)){
2050                                         goto mismatch171;
2051                                     }
2052                                     {//OptionalExpr
2053                                         {//Expression
2054                                             uint start163 = position;
2055                                             if((parse_hexdigit().success && parse_hexdigit().success && parse_hexdigit().success && parse_hexdigit().success && parse_hexdigit().success && parse_hexdigit().success && parse_hexdigit().success && parse_hexdigit().success)){
2056                                                 clearErrors();
2057                                             }else{
2058                                                 position = start163;
2059                                             }
2060                                         }
2061                                     }
2062                                     goto match170;
2063                                 mismatch171:
2064                                     {/*do nothing*/}
2065                                     position = start161;
2066                                     {/*do nothing*/}
2067                                 match170:
2068                                     clearErrors();
2069                                     {/*do nothing*/}
2070                                 }
2071                             }
2072                             goto match168;
2073                         mismatch169:
2074                             {/*do nothing*/}
2075                             position = start159;
2076                             {/*do nothing*/}
2077                         match168:
2078                             clearErrors();
2079                             {/*do nothing*/}
2080                         }
2081                     }
2082                     goto match166;
2083                 mismatch167:
2084                     setError("Expected hexdigit.");
2085                     position = start157;
2086                     goto mismatch165;
2087                 match166:
2088                     clearErrors();
2089                     {/*do nothing*/}
2090                 }
2091                 smartAssign!(String,String)(bind_text,sliceData(start156,position));
2092             }
2093             goto match164;
2094         mismatch165:
2095             {/*do nothing*/}
2096             position = start155;
2097             goto mismatch163;
2098         match164:
2099             clearErrors();
2100             goto match162;
2101         }
2102     match162:
2103         debug Stdout.formatln("parse_HexExpr() PASS");
2104         return ResultT!(String)(bind_text);
2105     mismatch163:
2106         position = start154;
2107         return ResultT!(String)();
2108     }
2109
2110     /*
2111     
2112 AnyChar
2113     = String value
2114     ::= [  "\\":~value]  any:~value;
2115
2116     */
2117     public ResultT!(String) parse_AnyChar(){
2118         debug Stdout.formatln("parse_AnyChar()");
2119         uint start164 = position;
2120         String bind_value;
2121        
2122        
2123         {//Expression
2124             uint start165 = position;
2125             {//OptionalExpr
2126                 {//Expression
2127                     uint start167 = position;
2128                     if((terminal("\\").assignCat!(String)(bind_value))){
2129                         clearErrors();
2130                     }else{
2131                         position = start167;
2132                     }
2133                 }
2134             }
2135             if(!(parse_any().assignCat!(String)(bind_value))){
2136                 goto mismatch175;
2137             }
2138             goto match174;
2139         mismatch175:
2140             {/*do nothing*/}
2141             position = start165;
2142             goto mismatch173;
2143         match174:
2144             clearErrors();
2145             goto match172;
2146         }
2147     match172:
2148         debug Stdout.formatln("parse_AnyChar() PASS");
2149         return ResultT!(String)(bind_value);
2150     mismatch173:
2151         position = start164;
2152         return ResultT!(String)();
2153     }
2154
2155     /*
2156     
2157 Comment
2158     = new Comment(String text)
2159     ::=  PoundComment:text |  SlashSlashComment:text |  SlashStarComment:text;
2160
2161     */
2162     public ResultT!(Comment) parse_Comment(){
2163         debug Stdout.formatln("parse_Comment()");
2164         uint start168 = position;
2165         String bind_text;
2166        
2167        
2168         {//Expression
2169             uint start169 = position;
2170             if((parse_PoundComment().assign!(String)(bind_text)) || (parse_SlashSlashComment().assign!(String)(bind_text)) || (parse_SlashStarComment().assign!(String)(bind_text))){
2171                 clearErrors();
2172                 goto match176;
2173             }else{
2174                 setError("Expected PoundComment, SlashSlashComment or SlashStarComment.");
2175                 position = start169;
2176                 goto mismatch177;
2177             }
2178         }
2179     match176:
2180         debug Stdout.formatln("parse_Comment() PASS");
2181         ResultT!(Comment) passed = ResultT!(Comment)(new Comment(bind_text));
2182         return passed;
2183     mismatch177:
2184         position = start168;
2185         ResultT!(Comment) failed = ResultT!(Comment)();
2186         return failed;
2187     }
2188
2189     /*
2190     
2191 PoundComment
2192     = String text
2193     ::=  "#" {  any}:text eol;
2194
2195     */
2196     public ResultT!(String) parse_PoundComment(){
2197         debug Stdout.formatln("parse_PoundComment()");
2198         uint start170 = position;
2199         String bind_text;
2200        
2201        
2202         {//Expression
2203             uint start171 = position;
2204             if(!(terminal("#").success)){
2205                 goto mismatch181;
2206             }
2207             {//ZeroOrMoreExpr
2208                 uint start172 = position;
2209                 uint termPos173;
2210             loop182:
2211                 termPos173 = position;
2212                 if(parse_eol().success){
2213                     goto loopend183;
2214                 }else{
2215                     goto exprStart184;
2216                 }
2217             exprStart184:
2218                 {//Expression
2219                     uint start174 = position;
2220                     if((parse_any().success)){
2221                         clearErrors();
2222                         goto loop182;
2223                     }else{
2224                         setError("Expected any.");
2225                         position = start174;
2226                         goto loopend183;
2227                     }
2228                 }
2229             loopend183:
2230                 smartAssign!(String,String)(bind_text,sliceData(start172,termPos173));
2231                 {/*do nothing*/}
2232             }
2233             goto match180;
2234         mismatch181:
2235             {/*do nothing*/}
2236             position = start171;
2237             goto mismatch179;
2238         match180:
2239             clearErrors();
2240             goto match178;
2241         }
2242     match178:
2243         debug Stdout.formatln("parse_PoundComment() PASS");
2244         return ResultT!(String)(bind_text);
2245     mismatch179:
2246         position = start170;
2247         return ResultT!(String)();
2248     }
2249
2250     /*
2251     
2252 SlashSlashComment
2253     = String text
2254     ::=  "\x2F\x2F" {  any}:text eol;
2255
2256     */
2257     public ResultT!(String) parse_SlashSlashComment(){
2258         debug Stdout.formatln("parse_SlashSlashComment()");
2259         uint start175 = position;
2260         String bind_text;
2261        
2262        
2263         {//Expression
2264             uint start176 = position;
2265             if(!(terminal("\x2F\x2F").success)){
2266                 goto mismatch188;
2267             }
2268             {//ZeroOrMoreExpr
2269                 uint start177 = position;
2270                 uint termPos178;
2271             loop189:
2272                 termPos178 = position;
2273                 if(parse_eol().success){
2274                     goto loopend190;
2275                 }else{
2276                     goto exprStart191;
2277                 }
2278             exprStart191:
2279                 {//Expression
2280                     uint start179 = position;
2281                     if((parse_any().success)){
2282                         clearErrors();
2283                         goto loop189;
2284                     }else{
2285                         setError("Expected any.");
2286                         position = start179;
2287                         goto loopend190;
2288                     }
2289                 }
2290             loopend190:
2291                 smartAssign!(String,String)(bind_text,sliceData(start177,termPos178));
2292                 {/*do nothing*/}
2293             }
2294             goto match187;
2295         mismatch188:
2296             {/*do nothing*/}
2297             position = start176;
2298             goto mismatch186;
2299         match187:
2300             clearErrors();
2301             goto match185;
2302         }
2303     match185:
2304         debug Stdout.formatln("parse_SlashSlashComment() PASS");
2305         return ResultT!(String)(bind_text);
2306     mismatch186:
2307         position = start175;
2308         return ResultT!(String)();
2309     }
2310
2311     /*
2312     
2313 SlashStarComment
2314     = String text
2315     ::=  "\x2F\x2A" {  any}:text "\x2A\x2F";
2316
2317     */
2318     public ResultT!(String) parse_SlashStarComment(){
2319         debug Stdout.formatln("parse_SlashStarComment()");
2320         uint start180 = position;
2321         String bind_text;
2322        
2323        
2324         {//Expression
2325             uint start181 = position;
2326             if(!(terminal("\x2F\x2A").success)){
2327                 goto mismatch195;
2328             }
2329             {//ZeroOrMoreExpr
2330                 uint start182 = position;
2331                 uint termPos183;
2332             loop196:
2333                 termPos183 = position;
2334                 if(terminal("\x2A\x2F").success){
2335                     goto loopend197;
2336                 }else{
2337                     goto exprStart198;
2338                 }
2339             exprStart198:
2340                 {//Expression
2341                     uint start184 = position;
2342                     if((parse_any().success)){
2343                         clearErrors();
2344                         goto loop196;
2345                     }else{
2346                         setError("Expected any.");
2347                         position = start184;
2348                         goto loopend197;
2349                     }
2350                 }
2351             loopend197:
2352                 smartAssign!(String,String)(bind_text,sliceData(start182,termPos183));
2353                 {/*do nothing*/}
2354             }
2355             goto match194;
2356         mismatch195:
2357             {/*do nothing*/}
2358             position = start181;
2359             goto mismatch193;
2360         match194:
2361             clearErrors();
2362             goto match192;
2363         }
2364     match192:
2365         debug Stdout.formatln("parse_SlashStarComment() PASS");
2366         return ResultT!(String)(bind_text);
2367     mismatch193:
2368         position = start180;
2369         return ResultT!(String)();
2370     }
2371
2372     /*
2373     
2374 Directive
2375     = Directive dir
2376     ::=  "." (  ImportDirective:~dir |  BaseClassDirective:~dir |  ClassnameDirective:~dir |  DefineDirective:~dir |  IncludeDirective:~dir |  AliasDirective:~dir |  ModuleDirective:~dir |  CodeDirective:~dir |  TypelibDirective:~dir |  ParseTypeDirective:~dir |  BoilerplateDirective:~dir |  HeaderDirective:~dir |  UTFDirective:~dir);
2377
2378     */
2379     public ResultT!(Directive) parse_Directive(){
2380         debug Stdout.formatln("parse_Directive()");
2381         uint start185 = position;
2382         Directive bind_dir;
2383        
2384        
2385         {//Expression
2386             uint start186 = position;
2387             if(!(terminal(".").success)){
2388                 goto mismatch202;
2389             }
2390             {//Expression
2391                 uint start187 = position;
2392                 if((parse_ImportDirective().assignCat!(Directive)(bind_dir)) || (parse_BaseClassDirective().assignCat!(Directive)(bind_dir)) || (parse_ClassnameDirective().assignCat!(Directive)(bind_dir)) || (parse_DefineDirective().assignCat!(Directive)(bind_dir)) || (parse_IncludeDirective().assignCat!(Directive)(bind_dir)) || (parse_AliasDirective().assignCat!(Directive)(bind_dir)) || (parse_ModuleDirective().assignCat!(Directive)(bind_dir)) || (parse_CodeDirective().assignCat!(Directive)(bind_dir)) || (parse_TypelibDirective().assignCat!(Directive)(bind_dir)) || (parse_ParseTypeDirective().assignCat!(Directive)(bind_dir)) || (parse_BoilerplateDirective().assignCat!(Directive)(bind_dir)) || (parse_HeaderDirective().assignCat!(Directive)(bind_dir)) || (parse_UTFDirective().assignCat!(Directive)(bind_dir))){
2393                     clearErrors();
2394                 }else{
2395                     setError("Expected ImportDirective, BaseClassDirective, ClassnameDirective, DefineDirective, IncludeDirective, AliasDirective, ModuleDirective, CodeDirective, TypelibDirective, ParseTypeDirective, BoilerplateDirective, HeaderDirective or UTFDirective.");
2396                     position = start187;
2397                     goto mismatch202;
2398                 }
2399             }
2400             goto match201;
2401         mismatch202:
2402             {/*do nothing*/}
2403             position = start186;
2404             goto mismatch200;
2405         match201:
2406             clearErrors();
2407             goto match199;
2408         }
2409     match199:
2410         debug Stdout.formatln("parse_Directive() PASS");
2411         return ResultT!(Directive)(bind_dir);
2412     mismatch200:
2413         position = start185;
2414         return ResultT!(Directive)();
2415     }
2416
2417     /*
2418     
2419 ImportDirective
2420     = new ImportDirective(String imp)
2421     ::=  "import"  WS  "("  WS  DirectiveArg:imp  WS  ")"  WS  ";";
2422
2423     */
2424     public ResultT!(ImportDirective) parse_ImportDirective(){
2425         debug Stdout.formatln("parse_ImportDirective()");
2426         uint start188 = position;
2427         String bind_imp;
2428        
2429        
2430         {//Expression
2431             uint start189 = position;
2432             if((terminal("import").success && parse_WS().success && terminal("(").success && parse_WS().success && parse_DirectiveArg().assign!(String)(bind_imp) && parse_WS().success && terminal(")").success && parse_WS().success && terminal(";").success)){
2433                 clearErrors();
2434                 goto match203;
2435             }else{
2436                 position = start189;
2437                 goto mismatch204;
2438             }
2439         }
2440     match203:
2441         debug Stdout.formatln("parse_ImportDirective() PASS");
2442         ResultT!(ImportDirective) passed = ResultT!(ImportDirective)(new ImportDirective(bind_imp));
2443         return passed;
2444     mismatch204:
2445         position = start188;
2446         ResultT!(ImportDirective) failed = ResultT!(ImportDirective)();
2447         return failed;
2448     }
2449
2450     /*
2451     
2452 BaseClassDirective
2453     = new BaseClassDirective(String name)
2454     ::=  "baseclass"  WS  "("  WS  DirectiveArg:name  WS  ")"  WS  ";";
2455
2456     */
2457     public ResultT!(BaseClassDirective) parse_BaseClassDirective(){
2458         debug Stdout.formatln("parse_BaseClassDirective()");
2459         uint start190 = position;
2460         String bind_name;
2461        
2462        
2463         {//Expression
2464             uint start191 = position;
2465             if((terminal("baseclass").success && parse_WS().success && terminal("(").success && parse_WS().success && parse_DirectiveArg().assign!(String)(bind_name) && parse_WS().success && terminal(")").success && parse_WS().success && terminal(";").success)){
2466                 clearErrors();
2467                 goto match205;
2468             }else{
2469                 position = start191;
2470                 goto mismatch206;
2471             }
2472         }
2473     match205:
2474         debug Stdout.formatln("parse_BaseClassDirective() PASS");
2475         ResultT!(BaseClassDirective) passed = ResultT!(BaseClassDirective)(new BaseClassDirective(bind_name));
2476         return passed;
2477     mismatch206:
2478         position = start190;
2479         ResultT!(BaseClassDirective) failed = ResultT!(BaseClassDirective)();
2480         return failed;
2481     }
2482
2483     /*
2484     
2485 ClassnameDirective
2486     = new ClassnameDirective(String name)
2487     ::=  "classname"  WS  "("  WS  DirectiveArg:name  WS  ")"  WS  ";";
2488
2489     */
2490     public ResultT!(ClassnameDirective) parse_ClassnameDirective(){
2491         debug Stdout.formatln("parse_ClassnameDirective()");
2492         uint start192 = position;
2493         String bind_name;
2494        
2495        
2496         {//Expression
2497             uint start193 = position;
2498             if((terminal("classname").success && parse_WS().success && terminal("(").success && parse_WS().success && parse_DirectiveArg().assign!(String)(bind_name) && parse_WS().success && terminal(")").success && parse_WS().success && terminal(";").success)){
2499                 clearErrors();
2500                 goto match207;
2501             }else{
2502                 position = start193;
2503                 goto mismatch208;
2504             }
2505         }
2506     match207:
2507         debug Stdout.formatln("parse_ClassnameDirective() PASS");
2508         ResultT!(ClassnameDirective) passed = ResultT!(ClassnameDirective)(new ClassnameDirective(bind_name));
2509         return passed;
2510     mismatch208:
2511         position = start192;
2512         ResultT!(ClassnameDirective) failed = ResultT!(ClassnameDirective)();
2513         return failed;
2514     }
2515
2516     /*
2517     
2518 DefineDirective
2519     = new DefineDirective(String returnType,String name,bool isTerminal,String description)
2520     ::=  "define"  WS  "("  WS  DirectiveArg:returnType  WS  ","  WS  DirectiveArg:name  WS  ","  WS  DirectiveArg:isTerminal  WS [  ","  WS  DirectiveArg:description  WS]  ")"  WS  ";";
2521
2522     */
2523     public ResultT!(DefineDirective) parse_DefineDirective(){
2524         debug Stdout.formatln("parse_DefineDirective()");
2525         uint start194 = position;
2526         String bind_returnType;
2527         String bind_name;
2528         bool bind_isTerminal;
2529         String bind_description;
2530        
2531        
2532         {//Expression
2533             uint start195 = position;
2534             if(!(terminal("define").success)){
2535                 goto mismatch212;
2536             }
2537             if(!(parse_WS().success)){
2538                 goto mismatch212;
2539             }
2540             if(!(terminal("(").success)){
2541                 goto mismatch212;
2542             }
2543             if(!(parse_WS().success)){
2544                 goto mismatch212;
2545             }
2546             if(!(parse_DirectiveArg().assign!(String)(bind_returnType))){
2547                 goto mismatch212;
2548             }
2549             if(!(parse_WS().success)){
2550                 goto mismatch212;
2551             }
2552             if(!(terminal(",").success)){
2553                 goto mismatch212;
2554             }
2555             if(!(parse_WS().success)){
2556                 goto mismatch212;
2557             }
2558             if(!(parse_DirectiveArg().assign!(String)(bind_name))){
2559                 goto mismatch212;
2560             }
2561             if(!(parse_WS().success)){
2562                 goto mismatch212;
2563             }
2564             if(!(terminal(",").success)){
2565                 goto mismatch212;
2566             }
2567             if(!(parse_WS().success)){
2568                 goto mismatch212;
2569             }
2570             if(!(parse_DirectiveArg().assign!(bool)(bind_isTerminal))){
2571                 goto mismatch212;
2572             }
2573             if(!(parse_WS().success)){
2574                 goto mismatch212;
2575             }
2576             {//OptionalExpr
2577                 {//Expression
2578                     uint start197 = position;
2579                     if((terminal(",").success && parse_WS().success && parse_DirectiveArg().assign!(String)(bind_description) && parse_WS().success)){
2580                         clearErrors();
2581                     }else{
2582                         position = start197;
2583                     }
2584                 }
2585             }
2586             if(!(terminal(")").success)){
2587                 goto mismatch212;
2588             }
2589             if(!(parse_WS().success)){
2590                 goto mismatch212;
2591             }
2592             if(!(terminal(";").success)){
2593                 goto mismatch212;
2594             }
2595             goto match211;
2596         mismatch212:
2597             {/*do nothing*/}
2598             position = start195;
2599             goto mismatch210;
2600         match211:
2601             clearErrors();
2602             goto match209;
2603         }
2604     match209:
2605         debug Stdout.formatln("parse_DefineDirective() PASS");
2606         ResultT!(DefineDirective) passed = ResultT!(DefineDirective)(new DefineDirective(bind_returnType,bind_name,bind_isTerminal,bind_description));
2607         return passed;
2608     mismatch210:
2609         position = start194;
2610         ResultT!(DefineDirective) failed = ResultT!(DefineDirective)();
2611         return failed;
2612     }
2613
2614     /*
2615     
2616 IncludeDirective
2617     = new IncludeDirective(String filename)
2618     ::=  "include"  WS  "("  WS  String:filename  WS  ")"  WS  ";";
2619
2620     */
2621     public ResultT!(IncludeDirective) parse_IncludeDirective(){
2622         debug Stdout.formatln("parse_IncludeDirective()");
2623         uint start198 = position;
2624         String bind_filename;
2625        
2626        
2627         {//Expression
2628             uint start199 = position;
2629             if((terminal("include").success && parse_WS().success && terminal("(").success && parse_WS().success && parse_String().assign!(String)(bind_filename) && parse_WS().success && terminal(")").success && parse_WS().success && terminal(";").success)){
2630                 clearErrors();
2631                 goto match213;
2632             }else{
2633                 position = start199;
2634                 goto mismatch214;
2635             }
2636         }
2637     match213:
2638         debug Stdout.formatln("parse_IncludeDirective() PASS");
2639         ResultT!(IncludeDirective) passed = ResultT!(IncludeDirective)(new IncludeDirective(bind_filename));
2640         return passed;
2641     mismatch214:
2642         position = start198;
2643         ResultT!(IncludeDirective) failed = ResultT!(IncludeDirective)();
2644         return failed;
2645     }
2646
2647     /*
2648     
2649 AliasDirective
2650     = new AliasDirective(String rule,String ruleAlias)
2651     ::=  "alias"  WS  "("  WS  DirectiveArg:rule  WS  ","  WS  DirectiveArg:ruleAlias  WS  ")"  WS  ";";
2652
2653     */
2654     public ResultT!(AliasDirective) parse_AliasDirective(){
2655         debug Stdout.formatln("parse_AliasDirective()");
2656         uint start200 = position;
2657         String bind_rule;
2658         String bind_ruleAlias;
2659        
2660        
2661         {//Expression
2662             uint start201 = position;
2663             if((terminal("alias").success && parse_WS().success && terminal("(").success && parse_WS().success && parse_DirectiveArg().assign!(String)(bind_rule) && parse_WS().success && terminal(",").success && parse_WS().success && parse_DirectiveArg().assign!(String)(bind_ruleAlias) && parse_WS().success && terminal(")").success && parse_WS().success && terminal(";").success)){
2664                 clearErrors();
2665                 goto match215;
2666             }else{
2667                 position = start201;
2668                 goto mismatch216;
2669             }
2670         }
2671     match215:
2672         debug Stdout.formatln("parse_AliasDirective() PASS");
2673         ResultT!(AliasDirective) passed = ResultT!(AliasDirective)(new AliasDirective(bind_rule,bind_ruleAlias));
2674         return passed;
2675     mismatch216:
2676         position = start200;
2677         ResultT!(AliasDirective) failed = ResultT!(AliasDirective)();
2678         return failed;
2679     }
2680
2681     /*
2682     
2683 ModuleDirective
2684     = new ModuleDirective(String moduleName)
2685     ::=  "module"  WS  "("  WS  DirectiveArg:moduleName  WS  ")"  WS  ";";
2686
2687     */
2688     public ResultT!(ModuleDirective) parse_ModuleDirective(){
2689         debug Stdout.formatln("parse_ModuleDirective()");
2690         uint start202 = position;
2691         String bind_moduleName;
2692        
2693        
2694         {//Expression
2695             uint start203 = position;
2696             if((terminal("module").success && parse_WS().success && terminal("(").success && parse_WS().success && parse_DirectiveArg().assign!(String)(bind_moduleName) && parse_WS().success && terminal(")").success && parse_WS().success && terminal(";").success)){
2697                 clearErrors();
2698                 goto match217;
2699             }else{
2700                 position = start203;
2701                 goto mismatch218;
2702             }
2703         }
2704     match217:
2705         debug Stdout.formatln("parse_ModuleDirective() PASS");
2706         ResultT!(ModuleDirective) passed = ResultT!(ModuleDirective)(new ModuleDirective(bind_moduleName));
2707         return passed;
2708     mismatch218:
2709         position = start202;
2710         ResultT!(ModuleDirective) failed = ResultT!(ModuleDirective)();
2711         return failed;
2712     }
2713
2714     /*
2715     
2716 CodeDirective
2717     = new CodeDirective(String code)
2718     ::=  "code"  WS  "{{{" {  any}:code "}}}";
2719
2720     */
2721     public ResultT!(CodeDirective) parse_CodeDirective(){
2722         debug Stdout.formatln("parse_CodeDirective()");
2723         uint start204 = position;
2724         String bind_code;
2725        
2726        
2727         {//Expression
2728             uint start205 = position;
2729             if(!(terminal("code").success)){
2730                 goto mismatch222;
2731             }
2732             if(!(parse_WS().success)){
2733                 goto mismatch222;
2734             }
2735             if(!(terminal("{{{").success)){
2736                 goto mismatch222;
2737             }
2738             {//ZeroOrMoreExpr
2739                 uint start206 = position;
2740                 uint termPos207;
2741             loop223:
2742                 termPos207 = position;
2743                 if(terminal("}}}").success){
2744                     goto loopend224;
2745                 }else{
2746                     goto exprStart225;
2747                 }
2748             exprStart225:
2749                 {//Expression
2750                     uint start208 = position;
2751                     if((parse_any().success)){
2752                         clearErrors();
2753                         goto loop223;
2754                     }else{
2755                         setError("Expected any.");
2756                         position = start208;
2757                         goto loopend224;
2758                     }
2759                 }
2760             loopend224:
2761                 smartAssign!(String,String)(bind_code,sliceData(start206,termPos207));
2762                 {/*do nothing*/}
2763             }
2764             goto match221;
2765         mismatch222:
2766             {/*do nothing*/}
2767             position = start205;
2768             goto mismatch220;
2769         match221:
2770             clearErrors();
2771             goto match219;
2772         }
2773     match219:
2774         debug Stdout.formatln("parse_CodeDirective() PASS");
2775         ResultT!(CodeDirective) passed = ResultT!(CodeDirective)(new CodeDirective(bind_code));
2776         return passed;
2777     mismatch220:
2778         position = start204;
2779         ResultT!(CodeDirective) failed = ResultT!(CodeDirective)();
2780         return failed;
2781     }
2782
2783     /*
2784     
2785 TypelibDirective
2786     = new TypelibDirective(String importName)
2787     ::=  "typelib"  WS  "("  WS  DirectiveArg:importName  WS  ")"  WS  ";";
2788
2789     */
2790     public ResultT!(TypelibDirective) parse_TypelibDirective(){
2791         debug Stdout.formatln("parse_TypelibDirective()");
2792         uint start209 = position;
2793         String bind_importName;
2794        
2795        
2796         {//Expression
2797             uint start210 = position;
2798             if((terminal("typelib").success && parse_WS().success && terminal("(").success && parse_WS().success && parse_DirectiveArg().assign!(String)(bind_importName) && parse_WS().success && terminal(")").success && parse_WS().success && terminal(";").success)){
2799                 clearErrors();
2800                 goto match226;
2801             }else{
2802                 position = start210;
2803                 goto mismatch227;
2804             }
2805         }
2806     match226:
2807         debug Stdout.formatln("parse_TypelibDirective() PASS");
2808         ResultT!(TypelibDirective) passed = ResultT!(TypelibDirective)(new TypelibDirective(bind_importName));
2809         return passed;
2810     mismatch227:
2811         position = start209;
2812         ResultT!(TypelibDirective) failed = ResultT!(TypelibDirective)();
2813         return failed;
2814     }
2815
2816     /*
2817     
2818 ParseTypeDirective
2819     = new ParseTypeDirective(String typeName)
2820     ::=  "parsetype"  WS  "("  WS  DirectiveArg:typeName  WS  ")"  WS  ";";
2821
2822     */
2823     public ResultT!(ParseTypeDirective) parse_ParseTypeDirective(){
2824         debug Stdout.formatln("parse_ParseTypeDirective()");
2825         uint start211 = position;
2826         String bind_typeName;
2827        
2828        
2829         {//Expression
2830             uint start212 = position;
2831             if((terminal("parsetype").success && parse_WS().success && terminal("(").success && parse_WS().success && parse_DirectiveArg().assign!(String)(bind_typeName) && parse_WS().success && terminal(")").success && parse_WS().success && terminal(";").success)){
2832                 clearErrors();
2833                 goto match228;
2834             }else{
2835                 position = start212;
2836                 goto mismatch229;
2837             }
2838         }
2839     match228:
2840         debug Stdout.formatln("parse_ParseTypeDirective() PASS");
2841         ResultT!(ParseTypeDirective) passed = ResultT!(ParseTypeDirective)(new ParseTypeDirective(bind_typeName));
2842         return passed;
2843     mismatch229:
2844         position = start211;
2845         ResultT!(ParseTypeDirective) failed = ResultT!(ParseTypeDirective)();
2846         return failed;
2847     }
2848
2849     /*
2850     
2851 BoilerplateDirective
2852     = new BoilerplateDirective(String code)
2853     ::=  "boilerplate"  WS  "{{{" {  any}:code "}}}";
2854
2855     */
2856     public ResultT!(BoilerplateDirective) parse_BoilerplateDirective(){
2857         debug Stdout.formatln("parse_BoilerplateDirective()");
2858         uint start213 = position;
2859         String bind_code;
2860        
2861        
2862         {//Expression
2863             uint start214 = position;
2864             if(!(terminal("boilerplate").success)){
2865                 goto mismatch233;
2866             }
2867             if(!(parse_WS().success)){
2868                 goto mismatch233;
2869             }
2870             if(!(terminal("{{{").success)){
2871                 goto mismatch233;
2872             }
2873             {//ZeroOrMoreExpr
2874                 uint start215 = position;
2875                 uint termPos216;
2876             loop234:
2877                 termPos216 = position;
2878                 if(terminal("}}}").success){
2879                     goto loopend235;
2880                 }else{
2881                     goto exprStart236;
2882                 }
2883             exprStart236:
2884                 {//Expression
2885                     uint start217 = position;
2886                     if((parse_any().success)){
2887                         clearErrors();
2888                         goto loop234;
2889                     }else{
2890                         setError("Expected any.");
2891                         position = start217;
2892                         goto loopend235;
2893                     }
2894                 }
2895             loopend235:
2896                 smartAssign!(String,String)(bind_code,sliceData(start215,termPos216));
2897                 {/*do nothing*/}
2898             }
2899             goto match232;
2900         mismatch233:
2901             {/*do nothing*/}
2902             position = start214;
2903             goto mismatch231;
2904         match232:
2905             clearErrors();
2906             goto match230;
2907         }
2908     match230:
2909         debug Stdout.formatln("parse_BoilerplateDirective() PASS");
2910         ResultT!(BoilerplateDirective) passed = ResultT!(BoilerplateDirective)(new BoilerplateDirective(bind_code));
2911         return passed;
2912     mismatch231:
2913         position = start213;
2914         ResultT!(BoilerplateDirective) failed = ResultT!(BoilerplateDirective)();
2915         return failed;
2916     }
2917
2918     /*
2919     
2920 HeaderDirective
2921     = new HeaderDirective(String code)
2922     ::=  "header"  WS  "{{{" {  any}:code "}}}";
2923
2924     */
2925     public ResultT!(HeaderDirective) parse_HeaderDirective(){
2926         debug Stdout.formatln("parse_HeaderDirective()");
2927         uint start218 = position;
2928         String bind_code;
2929        
2930        
2931         {//Expression
2932             uint start219 = position;
2933             if(!(terminal("header").success)){
2934                 goto mismatch240;
2935             }
2936             if(!(parse_WS().success)){
2937                 goto mismatch240;
2938             }
2939             if(!(terminal("{{{").success)){
2940                 goto mismatch240;
2941             }
2942             {//ZeroOrMoreExpr
2943                 uint start220 = position;
2944                 uint termPos221;
2945             loop241:
2946                 termPos221 = position;
2947                 if(terminal("}}}").success){
2948                     goto loopend242;
2949                 }else{
2950                     goto exprStart243;
2951                 }
2952             exprStart243:
2953                 {//Expression
2954                     uint start222 = position;
2955                     if((parse_any().success)){
2956                         clearErrors();
2957                         goto loop241;
2958                     }else{
2959                         setError("Expected any.");
2960                         position = start222;
2961                         goto loopend242;
2962                     }
2963                 }
2964             loopend242:
2965                 smartAssign!(String,String)(bind_code,sliceData(start220,termPos221));
2966                 {/*do nothing*/}
2967             }
2968             goto match239;
2969         mismatch240:
2970             {/*do nothing*/}
2971             position = start219;
2972             goto mismatch238;
2973         match239:
2974             clearErrors();
2975             goto match237;
2976         }
2977     match237:
2978         debug Stdout.formatln("parse_HeaderDirective() PASS");
2979         ResultT!(HeaderDirective) passed = ResultT!(HeaderDirective)(new HeaderDirective(bind_code));
2980         return passed;
2981     mismatch238:
2982         position = start218;
2983         ResultT!(HeaderDirective) failed = ResultT!(HeaderDirective)();
2984         return failed;
2985     }
2986
2987     /*
2988     
2989 UTFDirective
2990     = new UTFDirective(String value)
2991     ::=  "utf"  WS  "("  WS  DirectiveArg:value  WS  ")"  WS  ";";
2992
2993     */
2994     public ResultT!(UTFDirective) parse_UTFDirective(){
2995         debug Stdout.formatln("parse_UTFDirective()");
2996         uint start223 = position;
2997         String bind_value;
2998        
2999        
3000         {//Expression
3001             uint start224 = position;
3002             if((terminal("utf").success && parse_WS().success && terminal("(").success && parse_WS().success && parse_DirectiveArg().assign!(String)(bind_value) && parse_WS().success && terminal(")").success && parse_WS().success && terminal(";").success)){
3003                 clearErrors();
3004                 goto match244;
3005             }else{
3006                 position = start224;
3007                 goto mismatch245;
3008             }
3009         }
3010     match244:
3011         debug Stdout.formatln("parse_UTFDirective() PASS");
3012         ResultT!(UTFDirective) passed = ResultT!(UTFDirective)(new UTFDirective(bind_value));
3013         return passed;
3014     mismatch245:
3015         position = start223;
3016         ResultT!(UTFDirective) failed = ResultT!(UTFDirective)();
3017         return failed;
3018     }
3019
3020     /*
3021     
3022 DirectiveArg
3023     = String arg
3024     ::=  Identifier:arg |  String:arg;
3025
3026     */
3027     public ResultT!(String) parse_DirectiveArg(){
3028         debug Stdout.formatln("parse_DirectiveArg()");
3029         uint start225 = position;
3030         String bind_arg;
3031        
3032        
3033         {//Expression
3034             uint start226 = position;
3035             if((parse_Identifier().assign!(String)(bind_arg)) || (parse_String().assign!(String)(bind_arg))){
3036                 clearErrors();
3037                 goto match246;
3038             }else{
3039                 setError("Expected Identifier or String.");
3040                 position = start226;
3041                 goto mismatch247;
3042             }
3043         }
3044     match246:
3045         debug Stdout.formatln("parse_DirectiveArg() PASS");
3046         return ResultT!(String)(bind_arg);
3047     mismatch247:
3048         position = start225;
3049         return ResultT!(String)();
3050     }
3051
3052 }
Note: See TracBrowser for help on using the browser.