root/toys/v3d/parsed.g

Revision 16, 23.2 kB (checked in by eachainn, 3 years ago)

--

Line 
1 // BSD license
2 /*
3 Copyright (c) 2009 Ellery Newcomer
4 All rights reserved.
5
6 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions
8 are met:
9 1. Redistributions of source code must retain the above copyright
10    notice, this list of conditions and the following disclaimer.
11 2. Redistributions in binary form must reproduce the above copyright
12    notice, this list of conditions and the following disclaimer in the
13    documentation and/or other materials provided with the distribution.
14 3. The name of the author may not be used to endorse or promote products
15    derived from this software without specific prior written permission.
16
17 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29 /**
30   * Alright people, stop looking at this and thinking it actually works.
31   * It doesn't. It never did because ANLTR3 is a heck of a lot more neurotic
32   * than ANTLR2.
33   * The ANLTR2 grammars, on the other hand, work pretty well.
34   * Have a peek at https://bitbucket.org/ariovistus/d-jvm-cc/src/
35   * for them and lots of unfinished cruft
36   */
37
38 parser grammar parsed;
39 // manually converted from a v2 grammar. (I might make this one pretty)
40 options{
41     tokenVocab = lexd;
42     output=AST;
43 }
44 @members{
45     boolean catch_ambig = false;
46 }
47 module_:
48     (moduleDeclaration)? declDefs
49     ;
50 moduleDeclaration:
51     Module moduleName Semicolon
52     ;
53 moduleName:
54     Identifier (Dot Identifier )*
55     ;
56 declDefs :
57     ((( alignmentAttribute
58     |protection
59         |pragma_
60     |versionCondition
61     |debugCondition
62     //note seeing else else is erroneous
63     |Else
64     |staticIfCondition)
65    
66     (Lcurly declDefs Rcurly
67     | Colon)?)
68     | (attributes
69     (autoDeclaration
70     |Lcurly declDefs Rcurly
71     |Colon)?)
72     |declDef
73     )*
74     ;
75 declDef:
76     enumDeclaration
77     |classDeclaration
78     |interfaceDeclaration
79     |structDecl
80     |unionDecl
81     |importDeclaration //need to bind static for static import
82     |templateDeclaration
83     |mixinDeclaration
84     |templateMixin
85     //|staticConstructor
86     //|staticDestructor
87     |staticAssert
88     //|staticIfDeclaration
89     |declaration
90     |constructor //need to bind static for static ctor (and check params)
91     |destructor //need to bind static for static dtor
92     |invariant_
93     |unitTest
94     |classAllocator
95     |classDeallocator
96     |debugSpecification
97     //|debugDeclaration
98     |versionSpecification
99     //|versionDeclaration
100     //|pragma_ Semicolon
101     |Semicolon
102     ;
103 atrAuto:
104     attributes autoDeclaration
105     ;
106 mixinDeclaration:
107     Mixin Lparth asgExp Rparth Semicolon
108     ;
109 attributes:
110     (attribute )+
111     ;
112
113 attribute:
114     Extern Lparth linkageType Rparth
115     |storageClass
116     ;
117 storageClass:
118     Abstract
119     |Deprecated
120     |Override
121     |Synchronized
122     |sStorageClass
123     ;
124 sStorageClass:
125     Auto
126     |Const
127     |Extern
128     |Final
129     | Static
130     |Scope
131     ;
132 linkageType:
133     Identifier (Plusplus )?
134     ;
135 alignmentAttribute:
136     Align (Lparth IntegerLiteral Rparth )?
137     ;
138 pragma_:
139     Pragma Lparth Identifier (Comma expressionList )? Rparth
140     ;
141 importDeclaration:
142     /*(Static )?*/ Import importSegment (Comma importSegment )* (Colon importBindList )? Semicolon
143     ;
144 importSegment:
145     (Identifier Assign moduleName
146         |moduleName )
147     ;
148 importBindList:
149     importBind (Comma importBind )*
150     ;
151 importBind:
152     Identifier (Assign Identifier )?
153     ;
154 enumDeclaration :
155     Enum (
156     Identifier (Colon enumBaseType)?  (enumBody|Semicolon)
157     |(Colon enumBaseType)? enumBody)
158     ;
159 enumBaseType:
160     type
161     ;
162 enumBody:
163     Lcurly (enumMembers )? Rcurly
164     ;
165 enumMembers:
166     enumMember ((Comma Rcurly )=> Comma
167         |Comma enumMember )*
168     ;
169 enumMember:
170     Identifier (Assign asgExp )?
171     ;
172 atrClassDecl:
173     storageClasses classDeclaration
174     ;
175 classDeclaration:
176     Class Identifier (templateParameterList )? (baseClassList )? (classBody
177         |Semicolon )
178     ;
179 baseClassList:
180     Colon baseClass (Comma baseClass )*
181     ;
182 baseClass:
183     (protection )? identifierList
184     ;
185 protection:
186     (Private
187         |Package
188         |Public
189         |Protected
190         |Export )
191     ;
192 classBody:
193     Lcurly declDefs Rcurly
194     ;
195 declaration:
196     typedefDecl
197     |aliasDecl
198     |decl
199     ;
200 typedefDecl:
201     Typedef (storageClasses )? basicType declarator declaratorSuffix Semicolon
202     ;
203 aliasDecl:
204     Alias (storageClasses )? basicType declarator (aliasDeclList )? Semicolon
205     ;
206 aliasDeclList:
207     (Comma Identifier )+
208     ;
209 decl:
210     (basicType declarator ( functionBody 
211             |declaratorSuffix Semicolon ) )
212     ;
213 storageClasses:
214     (storageClass )+
215     ;
216 declaratorSuffix:
217     (declaratorInitializer )? (Comma declaratorIdentifierList )?
218     ;
219 declaratorInitializer:
220     Assign initializer
221     ;
222 declaratorIdentifierList:
223     declaratorIdentifier (Comma declaratorIdentifier )*
224     ;
225 declaratorIdentifier:
226     Identifier (Assign initializer )?
227     ;
228 /*
229 staticIfDeclaration:
230     staticIfCondition ccThenBlock ((Else)=> Else ccElseBlock )?
231     ;
232 versionDeclaration:
233     versionCondition ccThenBlock ((Else)=> Else ccElseBlock )?
234     ;
235 debugDeclaration:
236     debugCondition ccThenBlock ((Else)=> Else ccElseBlock )?
237     ;
238 ccThenBlock:
239     block
240     ;
241 ccElseBlock:
242     block
243     ;
244 block:
245     ((Semicolon)=>Semicolon //error consumption
246     |Colon (declDefs )?
247         | Lcurly declDefs Rcurly
248         declDef
249         )
250     ;
251     */
252 basicType:
253     (baseType
254         |userType )
255     ;
256 userType:
257     Dot identifierList
258     |identifierList
259     |typeof_ ((Dot)=> Dot identifierList )?
260     ;
261 baseType:
262     Bool
263     |Byte
264     |Ubyte
265     |Short
266     |Ushort
267     |Int
268     |Uint
269     |Long
270     |Ulong
271     |Char
272     |Wchar
273     |Dchar
274     |Float
275     |Double
276     |Real
277     |Ifloat
278     |Idouble
279     |Ireal
280     |Cfloat
281     |Cdouble
282     |Creal
283     |Void
284     ;
285 basicType2:
286     (basicType2_x )+
287     ;
288 basicType2_x:
289     (Mul
290         |Delegate parameters2
291         |Function parameters2
292         |(Lbracket Rbracket )=> Lbracket Rbracket
293         |(Lbracket type Rbracket )=> Lbracket type Rbracket
294         |Lbracket exp (Slice exp )? Rbracket )
295     ;
296 declarator:
297     (basicType2 )?  (Identifier
298     |Lparth declarator Rparth)
299     ((Lparth |Lbracket )=> declaratorSuffixes )?
300    
301     ;
302 declaratorSuffixes:
303     (declaratorSuffixes_bracket ((Lparth)=> declaratorSuffixes_parenth )?
304         |declaratorSuffixes_parenth )
305     ;
306 declaratorSuffixes_bracket:
307     (basicType2_bracket )+
308     ;
309 basicType2_bracket:
310     Lbracket (Rbracket
311         |(type Rbracket )=> type Rbracket
312         |exp Rbracket )
313     ;
314 declaratorSuffixes_parenth:
315     ((templateParameterList Lparth )=> templateParameterList parameters
316         |parameters )
317     ;
318 identifierList:
319     identifier ((Dot)=> Dot identifier )*
320     ;
321 identifier:
322     (Identifier Not )=> templateInstance
323     |Identifier
324     ;
325 typeof_:
326     Typeof Lparth (exp
327         |Return ) Rparth
328     ;
329
330 type:
331     basicType declarator2
332     ;
333 declarator2:
334     (basicType2 )?
335     (((Lparth Rparth)=> Lparth Rparth
336     |Lparth declarator2 Rparth)
337     (declaratorSuffixes)?)?
338     ;
339 parameters:
340         Lparth (parameter (Comma parameter )*)? Rparth
341     ;
342 parameters2:
343     parameters
344     ;
345 parameter:
346     Vararg
347     |(inOut )? basicType ((declarator )=> (declarator (Assign asgExp
348                 |Vararg )? )
349         |declarator2 (Vararg )? )
350     ;
351 inOut:
352     (In
353         |Out
354         |Inout
355         |Lazy
356         |Ref )
357     ;
358 initializer:
359     ((Void )=> Void
360         |nonVoidInitializer )
361     ;
362 nonVoidInitializer:
363     (asgExp )=> asgExp
364     |arrayInitializer
365     |structInitializer
366     ;
367 arrayInitializer:
368     (Lbracket ((asgExp Colon )=> assocMemInits
369             |arrayMemInits )? Rbracket )
370     ;
371 arrayMemInits:
372     arrayMemInit ((Comma Rbracket )=> Comma
373         |Comma arrayMemInit )*
374     ;
375 assocMemInits:
376     assocMemInit ((Comma Rbracket )=> Comma
377         |Comma assocMemInit )*
378     ;
379 arrayMemInit:
380     nonVoidInitializer
381     ;
382 assocMemInit:
383     asgExp Colon nonVoidInitializer
384     ;
385 structInitializer:
386     ((Lcurly Rcurly )=> Lcurly Rcurly
387         |Lcurly structMemberInitializers Rcurly )
388     ;
389 structMemberInitializers:
390     structMemberInitializer ((Comma Rcurly )=> Comma
391         |Comma structMemberInitializer )*
392     ;
393 structMemberInitializer:
394     (Identifier Colon )=> Identifier Colon nonVoidInitializer
395     |nonVoidInitializer
396     ;
397 autoDeclaration:
398     autoAsg (Comma autoAsg )* Semicolon
399     ;
400 autoAsg:
401     Identifier Assign initializer
402     ;
403 constructor:
404     This parameters (Semicolon
405         |functionBody )
406     ;
407 destructor:
408     Cat This Lparth Rparth (Semicolon
409         |functionBody )
410     ;
411 /*
412 staticConstructor:
413     Static This Lparth Rparth (Semicolon
414         |functionBody )
415     ;
416 staticDestructor:
417     Static Cat This Lparth Rparth (Semicolon
418         |functionBody )
419     ;
420     */
421 invariant_:
422     Invariant (Lparth Rparth )? blockStatement
423     ;
424 blockStatement:
425     Lcurly ((statement )* Rcurly )
426     ;
427 unitTest:
428     Unittest functionBody
429     ;
430 classAllocator:
431     New parameters functionBody
432     ;
433 classDeallocator:
434     Delete parameters functionBody
435     ;
436 interfaceDeclaration:
437     Interface Identifier (templateParameterList )? (baseClassList )? (classBody
438         |Semicolon )
439     ;
440 structDecl:
441     Struct structBody
442     ;
443 unionDecl:
444     Union structBody
445     ;
446 structBody:
447     classBody
448     |Identifier templateParameterList? (classBody|Semicolon)
449     ;
450 debugSpecification:
451     Debug Assign (IntegerLiteral
452         |Identifier ) Semicolon
453     ;
454 versionSpecification:
455     Version Assign (IntegerLiteral
456         |Identifier ) Semicolon
457     ;
458 exp:
459     asgExp (comma asgExp )*
460     ;
461 comma:
462     Comma
463     ;
464 asgExp:
465     condExp (asg condExp )*
466     ;
467 asg:
468     (Assign
469         |Add_assign
470         |Minus_assign
471         |Mul_assign
472         |Div_assign
473         |Mod_assign
474         |And_bitwise_assign
475         |Or_bitwise_assign
476         |Xor_assign
477         |Cat_assign
478         |Lshift_assign
479         |Rshift_assign
480         |Urshift_assign )
481     ;
482 condExp:
483     orExp (Ternary exp Colon condExp )?
484     ;
485 orExp:
486     andExp (Or andExp )*
487     ;
488 andExp:
489     orBitExp (And orBitExp )*
490     ;
491 orBitExp:
492     xorExp (Or_bitwise xorExp )*
493     ;
494 xorExp:
495     andBitExp (Xor andBitExp )*
496     ;
497 andBitExp:
498     cmpExp (And_bitwise cmpExp )*
499     ;
500 cmpExp:
501     shiftExp (cmp shiftExp )?
502     ;
503 cmp:
504     (Eq
505         |Ne
506         |Is
507         |(Not Is )
508         |Lt
509         |Le
510         |Gt
511         |Ge
512         |Yes_nan
513         |Eq_or_nan
514         |Ne_no_nan
515         |No_nan
516         |Le_or_nan
517         |Lt_or_nan
518         |Ge_or_nan
519         |Gt_or_nan
520         |In )
521     ;
522 shiftExp:
523     addExp (shift addExp )*
524     ;
525 shift:
526     (Lshift
527         |Rshift
528         |Urshift )
529     ;
530 addExp:
531     mulExp (add mulExp )*
532     ;
533 add:
534     (Add
535         |Minus
536         |Cat )
537     ;
538 mulExp:
539     unExp (mul unExp )*
540     ;
541 mul:
542     (Mul
543         |Div
544         |Mod )
545     ;
546 unExp:
547     unary unExp
548     |newExpression
549     |deleteExp
550     |castExp
551     |primExp
552     ;
553 unary:
554     (And_bitwise
555         |Plusplus
556         |Minusminus
557         |Mul
558         |Minus
559         |Add
560         |Not
561         |Cat )
562     ;
563 newExpression:
564     (newArguments Class )=> anonClassExp
565     |newExp
566     ;
567 newExp:
568     newArguments basicType ((basicType2_noAA)=> basicType2_noAA )? ((Lparth)=> Lparth argumentList Rparth )?
569     ;
570 anonClassExp:
571     newArguments classArguments (anonBaseClassList )? classBody
572     ;
573 anonBaseClassList:
574     baseClass (Comma baseClass )*
575     ;
576 basicType2_noAA:
577     ((basicType2_noAA_x)=> basicType2_noAA_x )+
578     ;
579 basicType2_noAA_x:
580     (Mul
581         |Lbracket (Rbracket
582             |exp (Slice exp )? Rbracket )
583         |Delegate parameters2
584         |Function parameters2 )
585     ;
586 newArguments:
587     New (Lparth argumentList Rparth )?
588     ;
589 classArguments:
590     Class (Lparth argumentList Rparth )?
591     ;
592 argumentList:
593     (arguments )?
594     ;
595 arguments:
596     asgExp (Comma asgExp )*
597     ;
598 deleteExp:
599     Delete unExp
600     ;
601 castExp:
602     Cast Lparth type Rparth unExp
603     ;
604 indexExpression:
605     Lbracket argumentList Rbracket
606     ;
607 primExp:
608     ((Identifier Not Lparth )=> templateInstanceExp
609         |(basicType Dot )=> basicType Dot identifierExp
610         |(functionLiteral )=> functionLiteral
611         |(Dot Identifier Not Lparth )=> Dot templateInstanceExp
612         |Dot identifierExp
613         |(Lparth type Rparth Dot )=> Lparth type Rparth Dot identifierExp
614         |identifierExp
615         |literal
616         |stringLiteral
617         |arrayLiteral
618         |assertExp
619         |mixinExpression
620         |importExpression
621         |typeidExp
622         |isExp
623         |typeofExp
624         |Lparth exp Rparth )
625
626      ((Dot Identifier Not Lparth )=> Dot templateInstanceExp
627         |(Dot New )=> Dot newExpression
628         |Dot identifierExp
629         |Lparth argumentList Rparth
630         |(Lbracket asgExp Slice )=> Lbracket asgExp Slice asgExp Rbracket
631         |indexExpression )*
632    
633     (post )?
634     ;
635 post:
636     (Plusplus
637         |Minusminus )
638     ;
639 identifierExp:
640     Identifier
641     ;
642 templateInstanceExp:
643     identifierExp templateArgumentList
644     ;
645 stringLiteral:
646     strLit (strLit )*
647     ;
648 strLit:
649     StringLiteral
650     ;
651 literal:
652     (This
653         |Super
654         |Null
655         |True
656         |False
657         |Dollar
658         |IntegerLiteral
659         |IntegerLiteralSuffixed
660         |FloatLiteral
661         |CharacterLiteral )
662     ;
663 typeofExp:
664     typeofp Lparth exp Rparth
665     ;
666 typeofp:
667     Typeof
668     ;
669 arrayLiteral:
670     Lbracket ((Rbracket )=> Rbracket
671         |(asgExp Colon )=> keyValuePairs Rbracket
672         |argumentList Rbracket )
673     ;
674 keyValuePairs:
675     keyValuePair (Comma keyValuePair )*
676     ;
677 keyValuePair:
678     keyExpression Colon valueExpression
679     ;
680 keyExpression:
681     asgExp
682     ;
683 valueExpression:
684     asgExp
685     ;
686 functionLiteral:
687     (Function (type )? (parameterAttributes )? functionBody
688         |Delegate (type )? (parameterAttributes )? functionBody
689         |parameterAttributes functionBody
690         |functionBody )
691     ;
692 parameterAttributes:
693     parameters
694     ;
695 assertExp:
696     Assert Lparth asgExp (Comma asgExp )? Rparth
697     ;
698 mixinExpression:
699     Mixin Lparth asgExp Rparth
700     ;
701 importExpression:
702     Import Lparth asgExp Rparth
703     ;
704 typeidExp:
705     Typeid Lparth type Rparth
706     ;
707 isExp:
708     Is Lparth type (Identifier )? (Colon typeSpec Rparth
709         |Eq typeSpec Rparth
710         |Rparth )
711     ;
712 typeSpec:
713     (type
714         |Typedef
715         |Struct
716         |Union
717         |Class
718         |Interface
719         |Enum
720         |Function
721         |Delegate
722         |Super
723         |Return )
724     ;
725 statement:
726     Semicolon
727     |(Lcurly )=> scopeBlockStatement
728     |nonEmptyStatement
729     ;
730 noScopeNonEmptyStatement:
731     (Lcurly )=> blockStatement
732     |nonEmptyStatement
733     ;
734 noScopeStatement:
735     Semicolon
736     |(Lcurly )=> blockStatement
737     |nonEmptyStatement
738     ;
739 nonEmptyOrScopeBlockStatement:
740     (Lcurly )=> scopeBlockStatement
741     |nonEmptyStatement
742     ;
743 nonEmptyStatement:
744     nonEmptyStatement_case
745     |nonEmptyStatement_nocase
746     ;
747 nonEmptyStatement_case:
748     caseStatement
749     |defaultStatement
750     ;
751 nonEmptyStatement_nocase :
752     (Identifier Colon )=> labeledStatement
753     |(Mixin ~(Lparth ) )=> templateMixin
754     |(Static Assert )=> Static staticAssert
755     |versionStatement
756     |debugStatement
757     |(Static If )=> staticIfStatement
758     |(Class )=> classDeclaration
759     |interfaceDeclaration
760     |structDecl
761     |unionDecl
762     |enumDeclaration
763     |whileStatement
764     |doStatement
765     |forStatement
766     |foreachStatement
767     |ifStatement
768     |(Scope Lparth )=> scopeGuardStatement
769     |pragmaStatement
770     |switchStatement
771     |returnStatement
772     |breakStatement
773     |continueStatement
774     |gotoStatement
775     |(Synchronized )=> synchronizedStatement
776     |withStatement
777     |tryStatement
778     |throwStatement
779     |volatileStatement
780     |asmStatement
781     |{catch_ambig}?=>declarationExpressionStatement
782     |{!catch_ambig}?=>declarationExpressionStatement_noambig
783     ;
784 declarator_ambig:
785     (basicType2 )? ((Lparth Identifier ~(Rparth ) )=> Lparth declarator_ambig Rparth declaratorSuffixes
786         |(Lparth basicType2 )=> Lparth declarator_ambig Rparth declaratorSuffixes
787         |(Identifier (Lparth
788                 |Lbracket ) )=> Identifier declaratorSuffixes
789         |Identifier )
790     ;
791 declarationExpressionStatement:
792     (storageClass)+ (autoDeclaration|declaration)
793     |(Alias |Typedef )=> declaration
794     |(mixinStatement )=> mixinStatement
795     |(Mixin Lparth )=> ambigExpression Semicolon
796     |(basicType Dot )=> exp Semicolon
797     |(baseType )=> declaration
798     |(userType declarator_ambig )=> ((exp )=> ambigDeclaration
799         |declaration )
800     |(declaration )=> ambigExpression Semicolon
801     |exp Semicolon
802     ;
803 declarationExpressionStatement_noambig:
804     (storageClass)+ (autoDeclaration|declaration)
805     |mixinStatement
806     |(declaration)=> declaration
807     |exp Semicolon
808     ;
809
810 ambigExpression:
811     exp
812     ;
813 ambigDeclaration:
814     basicType declarator declaratorSuffix Semicolon
815     ;
816 scopeStatement:
817     ((Lcurly )=> blockStatement
818         |nonEmptyStatement )
819     ;
820 scopeBlockStatement:
821     blockStatement
822     ;
823 labeledStatement:
824     Identifier Colon noScopeStatement
825     ;
826 ifStatement:
827     If Lparth ifCondition Rparth thenStatement ((Else)=> Else elseStatement )?
828     ;
829 ifCondition:
830     ((basicType declarator Assign )=> basicType declarator Assign exp
831         |Auto Identifier Assign exp
832         |exp )
833     ;
834 thenStatement:
835     ((Lcurly )=> blockStatement
836         |nonEmptyStatement )
837     ;
838 elseStatement:
839     scopeStatement
840     ;
841 whileStatement:
842     While Lparth exp Rparth scopeStatement
843     ;
844 doStatement:
845     Do scopeStatement While Lparth exp Rparth
846     ;
847 forStatement:
848     For Lparth forInitializer fortest Semicolon forincrement Rparth scopeStatement
849     ;
850 forInitializer:
851     (Semicolon
852         |noScopeNonEmptyStatement )
853     ;
854 fortest:
855     (exp )?
856     ;
857 forincrement:
858     (exp )?
859     ;
860 foreachStatement:
861     (Foreach
862         |Foreach_reverse ) Lparth foreachTypeList Semicolon aggregate Rparth noScopeNonEmptyStatement
863     ;
864 foreachTypeList:
865     foreachType (Comma foreachType )*
866     ;
867 foreachType:
868     (Inout
869         |Ref )? ((Identifier (Comma
870                 |Semicolon ) )=> Identifier
871         |basicType declarator )
872     ;
873 aggregate:
874     exp
875     ;
876 switchStatement:
877     Switch Lparth exp Rparth scopeStatement
878     ;
879 caseStatement:
880     Case expressionList Colon caseStatement_s
881     ;
882 caseStatement_s:
883     ((statement_nocase)=>statement_nocase )*
884     ;
885 statement_nocase:
886     Semicolon
887     |(Lcurly )=> scopeBlockStatement
888     |nonEmptyStatement_nocase
889     ;
890 expressionList:
891     asgExp (Comma asgExp )*
892     ;
893 defaultStatement:
894     Default Colon caseStatement_s
895     ;
896 continueStatement:
897     Continue (Identifier )? Semicolon
898     ;
899 breakStatement:
900     Break (Identifier )? Semicolon
901     ;
902 returnStatement:
903     Return (exp )? Semicolon
904     ;
905 gotoStatement:
906     (Goto Identifier )=> Goto Identifier Semicolon
907     |(Goto Default )=> Goto Default Semicolon
908     |Goto gotoCase
909     ;
910 gotoCase:
911     (Case Semicolon )=> Case Semicolon
912     |Case exp Semicolon
913     ;
914 withStatement:
915     With Lparth exp Rparth scopeStatement
916     ;
917 synchronizedStatement:
918     Synchronized ((Lparth)=> Lparth syncexpr Rparth )? scopeStatement
919     ;
920 syncexpr:
921     exp
922     ;
923 tryStatement:
924     Try scopeStatement ((Catch )=> ((catches finallySegment )=> catches finallySegment
925             |catches )
926         |finallySegment )
927     ;
928 catches:
929     (Catch Lparth )=> ((catcha Catch )=> catcha catches
930         |catcha )
931     |lastCatch
932     ;
933 lastCatch:
934     Catch noScopeNonEmptyStatement
935     ;
936 catcha:
937     Catch Lparth catchParameter Rparth noScopeNonEmptyStatement
938     ;
939 catchParameter:
940     basicType (Identifier )?
941     ;
942 finallySegment:
943     Finally noScopeNonEmptyStatement
944     ;
945 throwStatement:
946     Throw exp Semicolon
947     ;
948 scopeGuardStatement:
949     Scope Lparth Identifier Rparth nonEmptyOrScopeBlockStatement
950     ;
951 volatileStatement:
952     (Volatile Semicolon )=> Volatile Semicolon
953     |Volatile statement
954     ;
955 asmStatement:
956     Asm Lcurly (asmInstruction Semicolon )* Rcurly
957     ;
958 asmInstruction:
959     (~(Semicolon
960             |Rcurly
961             |Lcurly ) )*
962     ;
963 pragmaStatement:
964     pragma_ noScopeStatement
965     ;
966 mixinStatement:
967     Mixin Lparth asgExp Rparth Semicolon
968     ;
969 functionBody:
970     (inStatement (outStatement )? bodyStatement
971         |outStatement (inStatement )? bodyStatement
972         |bodyStatement
973         |bodyBlockStatement )
974     ;
975 inStatement:
976     In blockStatement
977     ;
978 outStatement:
979     Out (Lparth Identifier Rparth )? blockStatement
980     ;
981 bodyStatement:
982     Body blockStatement
983     ;
984 bodyBlockStatement:
985     blockStatement
986     ;
987 templateDeclaration:
988     Template Identifier templateParameterList classBody
989     ;
990 templateParameterList:
991     ((Lparth Rparth )=> Lparth Rparth
992         |Lparth templateParameter (Comma templateParameter )* Rparth )
993     ;
994 templateInstance:
995     Identifier templateArgumentList
996     ;
997 templateArgumentList:
998     Not Lparth ((Rparth )=> Rparth
999         |templateArgument (Comma templateArgument )* Rparth )
1000     ;
1001 templateArgument:
1002     ((type (Comma
1003                 |Rparth ) )=> type
1004         |asgExp )
1005     ;
1006 templateParameter:
1007     ((Identifier (Colon
1008                 |Assign
1009                 |Comma
1010                 |Rparth ) )=> templateTypeParameter
1011         |(Identifier Vararg )=> templateTupleParameter
1012         |templateValueParameter
1013         |templateAliasParameter )
1014     ;
1015 templateTypeParameter:
1016     Identifier (Colon type )? (Assign type )?
1017     ;
1018 templateValueParameter:
1019     basicType declarator (Colon condExp )? (Assign condExp )?
1020     ;
1021 templateAliasParameter:
1022     Alias Identifier (Colon type )? (Assign type )?
1023     ;
1024 templateTupleParameter:
1025     Identifier Vararg
1026     ;
1027 templateMixin:
1028     (Mixin (mixinIdentifier )+ (Identifier )? Semicolon
1029         |Mixin mixinIdentifier1 (mixinIdentifier )* (Identifier )? Semicolon )
1030     ;
1031 mixinIdentifier1:
1032     (mixinTypeof Dot Identifier (templateArgumentList )?
1033         |Identifier (templateArgumentList )? )
1034     ;
1035 mixinTypeof:
1036     Typeof Lparth exp Rparth
1037     ;
1038 mixinIdentifier:
1039     Dot Identifier (templateArgumentList )?
1040     ;
1041 versionStatement:
1042     versionCondition ccThenStatement ((Else)=> Else ccElseStatement )?
1043     ;
1044 debugStatement:
1045     debugCondition ccThenStatement ((Else)=> Else ccElseStatement )?
1046     ;
1047 staticIfStatement:
1048     staticIfCondition ccThenStatement ((Else)=> Else ccElseStatement )?
1049     ;
1050 ccThenStatement:
1051     noScopeNonEmptyStatement
1052     ;
1053 ccElseStatement:
1054     noScopeNonEmptyStatement
1055     ;
1056 versionCondition:
1057     Version Lparth (IntegerLiteral |Identifier ) Rparth
1058     ;
1059 debugCondition:
1060     Debug ((Lparth)=> Lparth (IntegerLiteral |Identifier ) Rparth )?
1061     ;
1062 staticIfCondition:
1063     Static If Lparth asgExp Rparth
1064     ;
1065 staticAssert:
1066     /*Static*/ Assert Lparth asgExp (Comma asgExp )? Rparth Semicolon
1067     ;
Note: See TracBrowser for help on using the browser.