forked from HaxeFoundation/intellij-haxe
-
Notifications
You must be signed in to change notification settings - Fork 2
/
haxe.bnf
602 lines (463 loc) · 29.6 KB
/
haxe.bnf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
{
parserClass="com.intellij.plugins.haxe.lang.parser.HaxeParser"
parserUtilClass="com.intellij.lang.parser.GeneratedParserUtilBase"
implements="com.intellij.plugins.haxe.lang.psi.HaxePsiCompositeElement"
extends="com.intellij.plugins.haxe.lang.psi.impl.HaxePsiCompositeElementImpl"
psiClassPrefix="Haxe"
psiImplClassSuffix="Impl"
psiPackage="com.intellij.plugins.haxe.lang.psi"
psiImplPackage="com.intellij.plugins.haxe.lang.psi.impl"
elementTypeHolderClass="com.intellij.plugins.haxe.lang.lexer.HaxeTokenTypes"
elementTypeClass="com.intellij.plugins.haxe.lang.lexer.HaxeElementType"
tokenTypeClass="com.intellij.plugins.haxe.lang.lexer.HaxeElementType"
generateFirstCheck=100
pLCURLY="{"
pRCURLY="}"
pLBRACK="["
pRBRACK="]"
pLPAREN="("
pRPAREN=")"
oCOLON=":"
oSEMI=";"
oCOMMA=","
oDOT="."
oEQ="=="
oASSIGN="="
oNOT_EQ="!="
oNOT="!"
oCOMPLEMENT="~"
oPLUS_PLUS="++"
oPLUS_ASSIGN="+="
oPLUS="+"
oMINUS_MINUS="--"
oMINUS_ASSIGN="-="
oMINUS="-"
oQUEST="?"
oCOND_OR="||"
oBIT_OR="|"
oBIT_OR_ASSIGN="|="
oCOND_AND="&&"
oBIT_AND_ASSIGN="&="
oBIT_AND="&"
oSHIFT_LEFT_ASSIGN="<<="
oSHIFT_LEFT="<<"
oLESS_OR_EQUAL="<="
oLESS="<"
oBIT_XOR_ASSIGN="^="
oBIT_XOR="^"
oMUL_ASSIGN="*="
oMUL="*"
oQUOTIENT_ASSIGN="/="
oQUOTIENT="/"
oREMAINDER_ASSIGN="%="
oREMAINDER="%"
oSHIFT_RIGHT_ASSIGN=">>="
oGREATER_OR_EQUAL=">="
oGREATER=">"
oTRIPLE_DOT="..."
OIN='in'
OARROW='->'
OFAT_ARROW="=>"
oNEW="new"
ppIF="#if"
ppELSE="#else"
ppELSEIF="#elseif"
ppEND="#end"
ppERROR="#error"
kBREAK="break"
kDEFAULT="default"
kPACKAGE="package"
kFUNCTION="function"
kCASE="case"
kCAST="cast"
kABSTRACT="abstract"
kFROM="from"
kTO="to"
kCLASS="class"
kENUM="enum"
kINTERFACE="interface"
kIMPLEMENTS="implements"
kEXTENDS="extends"
kNULL ="null"
kTRUE ="true"
kFALSE ="false"
kTHIS ="this"
kSUPER ="super"
kIF ="if"
kFOR ="for"
kDO ="do"
kWHILE ="while"
kRETURN="return"
kIMPORT ="import"
kUSING ="using"
kCONTINUE ="continue"
kELSE ="else"
kSWITCH ="switch"
kTHROW ="throw"
kVAR="var"
kSTATIC="static"
kPUBLIC="public"
kPRIVATE="private"
kDYNAMIC="dynamic"
kNEVER="never"
kOVERRIDE="override"
kINLINE="inline"
kMACRO2="macro"
kUNTYPED="untyped"
kTYPEDEF="typedef"
kEXTERN="extern"
kFINAL="@:final"
kHACK="@:hack"
kNATIVE="@:native"
kMACRO="@:macro"
kBUILD="@:build"
kAUTOBUILD="@:autoBuild"
kKEEP="@:keep"
kREQUIRE="@:require"
kFAKEENUM="@:fakeEnum"
kCOREAPI="@:core_api"
kJSREQUIRE="@:jsRequire"
kBIND="@:bind"
kBITMAP="@:bitmap"
kNS="@:ns"
kPROTECTED="@:protected"
kGETTER="@:getter"
kSETTER="@:setter"
kDEBUG="@:debug"
kNODEBUG="@:nodebug"
kMETA="@:meta"
kOVERLOAD="@:overload"
kTRY="try"
kCATCH="catch"
extends(".*(Expression|Literal)")="expression"
/* extends(".*Statement")="statement"
*/
implements(".*Statement")="com.intellij.plugins.haxe.lang.psi.HaxeStatementPsiMixin"
mixin(".*Statement")="com.intellij.plugins.haxe.lang.psi.impl.HaxeStatementPsiMixinImpl"
pin(".*Expression")=1
pin(".*Statement")=1
pin(".*Meta")=1
}
haxeFile ::= packageStatement? topLevelList
/*
http://haxe.org/manual/metadata
http://haxe.org/manual/tips_and_tricks
*/
finalMeta ::= '@:final'
keepMeta ::= '@:keep'
coreApiMeta ::= '@:coreApi'
bindMeta ::= '@:bind'
private macroMeta ::= '@:macro'
hackMeta ::= '@:hack'
protectedMeta ::= '@:protected'
debugMeta ::= '@:debug'
noDebugMeta ::= '@:nodebug'
unreflectiveMeta ::= '@:unreflective'
simpleMeta ::= unreflectiveMeta | finalMeta | keepMeta | coreApiMeta | bindMeta | macroMeta | hackMeta
macroClass ::= simpleMeta | requireMeta | fakeEnumMeta | nativeMeta | jsRequireMeta | bitmapMeta | nsMeta | customMeta | metaMeta | buildMacro | autoBuildMacro
macroClassList ::= macroClass (macroClass)* {mixin="com.intellij.plugins.haxe.lang.psi.impl.HaxeModifierListPsiMixinImpl" implements="com.intellij.plugins.haxe.lang.psi.HaxeModifierList"}
//','
private functionMacroMember ::= finalMeta | macroMember | overloadMeta
private macroMember ::= macroMeta | protectedMeta | debugMeta | noDebugMeta | keepMeta
| requireMeta | nsMeta | getterMeta | setterMeta | customMeta | metaMeta | buildMacro | autoBuildMacro
buildMacro ::= '@:build' '(' referenceExpression (callExpression | arrayAccessExpression | qualifiedReferenceExpression)* ')' {pin=2}
autoBuildMacro ::= '@:autoBuild' '(' referenceExpression (callExpression | arrayAccessExpression | qualifiedReferenceExpression)* ')' {pin=2}
requireMeta ::= '@:require' '(' identifier ')'
fakeEnumMeta ::= '@:fakeEnum' '(' type ')'
nativeMeta ::= '@:native' '(' stringLiteralExpression ')'
bitmapMeta ::= '@:bitmap' '(' stringLiteralExpression ')'
nsMeta ::= '@:ns' '(' stringLiteralExpression ')'
getterMeta ::= '@:getter' '(' referenceExpression ')'
setterMeta ::= '@:setter' '(' referenceExpression ')'
overloadMeta ::= '@:overload' '(' anonymousFunctionDeclaration ')'
customMeta ::= MACRO_ID ('(' expressionList ')')?
metaMeta ::= '@:meta' '(' ID '(' metaPartList? ')' ')'
private metaPartList ::= metaKeyValue (',' metaKeyValue)*
metaKeyValue ::= ID '=' stringLiteralExpression
jsRequireMeta ::= "@:jsRequire" '(' stringLiteralExpression ')'
private metaKeyWord ::= MACRO_ID | '@:final' | '@:hack' | '@:native' | '@:macro' | '@:build' | '@:autoBuild' | '@:keep' | '@:require' | '@:fakeEnum' | '@:core_api' | '@:bind' | '@:bitmap' | '@:ns' | '@:protected' | '@:getter' | '@:setter' | '@:debug' | '@:nodebug' | '@:meta' | '@:overload' | '@:jsRequire'
private ppConditionalStatement ::= CONDITIONAL_STATEMENT_ID
private ppToken ::= '#if' | "#else" | "#elseif" | "#end" | "#error" | ppConditionalStatement
assignOperation ::= '=' | '+=' | '-=' | '*=' | '/=' | '%=' | '&=' | '|=' | '^=' | '<<=' | ('>' '>' '=') | ('>' '>' '>' '=')
compareOperation ::= '==' | '!=' | '<=' | '<' | ('>' '=') | '>'
bitOperation ::= '|' | '&' | '^'
shiftOperator ::= unsignedShiftRightOperator | shiftRightOperator | '<<'
shiftRightOperator ::= '>' '>'
unsignedShiftRightOperator ::= '>' '>' '>'
packageStatement ::= 'package' simpleQualifiedReferenceExpression? ';'
{pin=1 implements="com.intellij.plugins.haxe.lang.psi.HaxePackageStatementPsiMixin" mixin="com.intellij.plugins.haxe.lang.psi.impl.HaxePackageStatementPsiMixinImpl"}
private topLevelList ::= topLevel*
private topLevel ::= importStatementAll | usingStatement | topLevelDeclaration {recoverWhile="top_level_recover"}
private top_level_recover ::= !(ppToken | metaKeyWord | 'abstract' | 'class' | 'enum' | 'extern' | 'import' | 'using' | 'interface' | 'private' | 'typedef')
importStatementRegular ::= 'import' simpleQualifiedReferenceExpression ';' {pin=1}
importStatementWithWildcard ::= 'import' simpleQualifiedReferenceExpressionWithWildcardSupport ';'
importStatementWithInSupport ::= 'import' simpleQualifiedReferenceExpression ('in' | 'as') identifier';'
private importStatementAll ::= importStatementWithWildcard | importStatementWithInSupport | importStatementRegular
usingStatement ::= 'using' simpleQualifiedReferenceExpression ';' {pin=1}
private topLevelDeclaration ::= classDeclaration
| interfaceDeclaration
| externClassDeclaration
| externInterfaceDeclaration
| abstractClassDeclaration
| enumDeclaration
| typedefDeclaration
privateKeyWord ::= 'private'
externKeyWord ::= 'extern'
private externPrivate ::= externKeyWord privateKeyWord
private privateExtern ::= privateKeyWord externKeyWord
private externOrPrivate ::= externPrivate | privateExtern | privateKeyWord | externKeyWord
private externAndMaybePrivate1 ::= privateKeyWord? externKeyWord
private externAndMaybePrivate2 ::= externKeyWord privateKeyWord?
private externAndMaybePrivate ::= externAndMaybePrivate2 | externAndMaybePrivate1
typedefDeclaration ::= macroClassList? externOrPrivate? 'typedef' componentName genericParam? '=' functionTypeWrapper ';'?
{pin=5 mixin="com.intellij.plugins.haxe.lang.psi.impl.AbstractHaxeTypeDefImpl" implements="com.intellij.plugins.haxe.lang.psi.HaxeClass"}
externClassDeclaration ::= macroClassList? externAndMaybePrivate 'class' componentName genericParam? inheritList? '{' externClassDeclarationBody '}'
{pin=3 mixin="com.intellij.plugins.haxe.lang.psi.impl.AbstractHaxePsiClass" implements="com.intellij.plugins.haxe.lang.psi.HaxeClass"}
externClassDeclarationBody ::= externClassDeclarationBodyPart*
private externClassDeclarationBodyPart ::= varDeclaration | externFunctionDeclaration {recoverWhile="extern_class_body_part_recover"}
private extern_class_body_part_recover ::= !(pptoken | metaKeyWord | 'dynamic' | 'function' | 'inline' | 'override' | 'private' | 'public' | 'static' | 'var' | '}')
externInterfaceDeclaration ::= macroClassList? externAndMaybePrivate? 'interface' componentName genericParam? inheritList? '{' interfaceBody '}'
{pin=3 mixin="com.intellij.plugins.haxe.lang.psi.impl.AbstractHaxePsiClass" implements="com.intellij.plugins.haxe.lang.psi.HaxeClass"}
classDeclaration ::= macroClassList? privateKeyWord? 'class' componentName genericParam? inheritList? '{' classBody '}'
{pin=3 mixin="com.intellij.plugins.haxe.lang.psi.impl.AbstractHaxePsiClass" implements="com.intellij.plugins.haxe.lang.psi.HaxeClass"}
//'from' | 'to'
abstractClassDeclaration ::= macroClassList? privateKeyWord? 'abstract' componentName genericParam? ('(' functionTypeWrapper ')')? ((identifier) type)* '{' classBody '}'
{pin=3 mixin="com.intellij.plugins.haxe.lang.psi.impl.AbstractHaxePsiClass" implements="com.intellij.plugins.haxe.lang.psi.HaxeClass"}
classBody ::= classBodyPart*
private classBodyPart ::= varDeclaration | functionDeclarationWithAttributes {recoverWhile="class_body_part_recover"}
private class_body_part_recover ::= !(ppToken | metaKeyWord | 'dynamic' | 'function' | 'inline' | 'override' | 'private' | 'public' | 'static' | 'var' | '}' | 'macro')
interfaceDeclaration ::= macroClassList? privateKeyWord? 'interface' componentName genericParam? inheritList? '{' interfaceBody '}'
{pin=3 mixin="com.intellij.plugins.haxe.lang.psi.impl.AbstractHaxePsiClass" implements="com.intellij.plugins.haxe.lang.psi.HaxeClass"}
interfaceBody ::= interfaceBodyPart*
private interfaceBodyPart ::= varDeclaration | functionPrototypeDeclarationWithAttributes {recoverWhile="interface_body_part_recover"}
private interface_body_part_recover ::= !(ppToken | metaKeyWord | 'dynamic' | 'function' | 'inline' | 'override' | 'private' | 'public' | 'static' | 'var' | '}')
enumDeclaration ::= macroClassList? externOrPrivate? 'enum' componentName genericParam? '{' enumBody '}'
{pin=3 mixin="com.intellij.plugins.haxe.lang.psi.impl.AbstractHaxePsiClass" implements="com.intellij.plugins.haxe.lang.psi.HaxeClass"}
enumBody ::= enumValueDeclaration*
/*
* declarations
*/
access ::= 'public' | 'private'
declarationAttribute ::= 'static' | 'inline' | 'dynamic' | 'override' | 'macro' | access
enumValueDeclaration ::= componentName enumConstructorParameters? ';'
{recoverWhile="enum_value_declaration_recovery" mixin="com.intellij.plugins.haxe.lang.psi.impl.HaxePsiFieldImpl" implements="com.intellij.plugins.haxe.lang.psi.HaxePsiField"}
private enum_value_declaration_recovery ::= !(ID | '}')
enumConstructorParameters ::= '(' parameterList ')' {pin=1}
varDeclaration ::= (macroMember | declarationAttribute)* 'var' varDeclarationPartList ';'
{pin=3 mixin="com.intellij.plugins.haxe.lang.psi.impl.HaxePsiFieldImpl" implements="com.intellij.plugins.haxe.lang.psi.HaxePsiField"}
private varDeclarationPartList ::= varDeclarationPart
varDeclarationPart ::= componentName propertyDeclaration? typeTag? varInit?
{recoverWhile="var_declaration_part_recover" mixin="com.intellij.plugins.haxe.lang.psi.impl.HaxePsiFieldImpl" implements="com.intellij.plugins.haxe.lang.psi.HaxePsiField"}
private var_declaration_part_recover ::= !(';' | ',')
localVarDeclaration ::= 'var' localVarDeclarationPartList ';'?
{pin=2 mixin="com.intellij.plugins.haxe.lang.psi.impl.HaxePsiFieldImpl" implements="com.intellij.plugins.haxe.lang.psi.HaxePsiField"}
private localVarDeclarationPartList ::= localVarDeclarationPart (',' localVarDeclarationPart)*
localVarDeclarationPart ::= componentName propertyDeclaration? typeTag? varInit?
{recoverWhile="local_var_declaration_part_recover" mixin="com.intellij.plugins.haxe.lang.psi.impl.HaxePsiFieldImpl" implements="com.intellij.plugins.haxe.lang.psi.HaxePsiField"}
private local_var_declaration_part_recover ::= !('!' | ppToken | '(' | ')' | '++' | ',' | '-' | '--' | ';' | '[' | 'break' | 'case' | 'cast' | 'continue' | 'default' | 'do' | 'else' | 'false' | 'for' | 'function' | 'if' | 'new' | 'null' | 'return' | 'super' | 'switch' | 'this' | 'throw' | 'true' | 'try' | 'untyped' | 'var' | 'while' | '{' | '}' | '~' | ID | OPEN_QUOTE | LITFLOAT | LITHEX | LITINT | LITOCT | REG_EXP)
propertyDeclaration ::= '(' propertyAccessor ',' propertyAccessor ')'
propertyAccessor ::= 'null' | 'default' | 'dynamic' | 'never' | 'get' | 'set' | referenceExpression
private functionCommonBody ::= blockStatement | returnStatement | (expression ';'?) | throwStatement | ifStatement | forStatement | whileStatement | doWhileStatement
private constructorName ::= 'new'
private localFunctionDeclarationAttribute ::= 'inline';
externFunctionDeclaration ::= (functionMacroMember| declarationAttribute)* 'function' (constructorName | componentName) genericParam? '(' parameterList ')' typeTag? 'untyped'? (functionCommonBody | ';')
{pin=3 mixin="com.intellij.plugins.haxe.lang.psi.impl.HaxeMethodImpl" implements="com.intellij.plugins.haxe.lang.psi.HaxeMethod"}
functionDeclarationWithAttributes ::= (functionMacroMember | declarationAttribute)* 'function' (constructorName | componentName) genericParam? '(' parameterList ')' typeTag? 'untyped'? functionCommonBody
{pin=3 mixin="com.intellij.plugins.haxe.lang.psi.impl.HaxeMethodImpl" implements="com.intellij.plugins.haxe.lang.psi.HaxeMethod"}
functionPrototypeDeclarationWithAttributes ::= (functionMacroMember| declarationAttribute)* 'function' (constructorName | componentName) genericParam? '(' parameterList ')' typeTag? 'untyped'? ';'
{pin=3 mixin="com.intellij.plugins.haxe.lang.psi.impl.HaxeMethodImpl" implements="com.intellij.plugins.haxe.lang.psi.HaxeMethod"}
localFunctionDeclaration ::= localFunctionDeclarationAttribute? 'function' componentName genericParam? '(' parameterList? ')' typeTag? 'untyped'? functionCommonBody
{pin=2 mixin="com.intellij.plugins.haxe.lang.psi.impl.HaxeMethodImpl" implements="com.intellij.plugins.haxe.lang.psi.HaxeMethod"}
anonymousFunctionDeclaration ::= 'function' '(' parameterList ')' typeTag? 'untyped'? '{' '}' {pin=2}
/* TODO: Should anonymousFunctionDeclaration extend and implement HaxeMethod as well?? */
/*
*
*/
varInit ::= '=' expression {pin=1}
parameter ::= '?'? componentName typeTag? varInit?
{mixin="com.intellij.plugins.haxe.lang.psi.impl.HaxeParameterPsiMixinImpl" implements="com.intellij.plugins.haxe.lang.psi.HaxeParameterPsiMixin"}
parameterList ::= parameter? (',' parameter)* {recoverWhile="parameterListRecovery" mixin="com.intellij.plugins.haxe.lang.psi.impl.HaxeParameterListPsiMixinImpl" implements="com.intellij.plugins.haxe.lang.psi.HaxeParameterListPsiMixin"}
private parameterListRecovery ::= !')' // after parameterList always ')'
functionLiteral ::= 'function' '(' parameterList ')' typeTag? 'untyped'? functionCommonBody {pin=2}
arrayLiteral ::= '[' (expressionList ','?)? ']'
{mixin="com.intellij.plugins.haxe.lang.psi.impl.HaxeReferenceImpl" implements="com.intellij.plugins.haxe.lang.psi.HaxeReference"}
private functionTypeWrapper ::= functionTypeOrWrapper functionType*
private functionTypeOrWrapper ::= typeOrAnonymous | '(' functionTypeWrapper ')'
left functionType ::= '->' '?'? typeOrAnonymous
/*
* Haxe and Java have this backward from each other.
*
* Haxe PSI type: Corresponding Java PSI Type:
* ======================= =============================
* TYPE_PARAM..........................PsiTypeParameterList
* TYPE_LIST...........................n/a
* TYPE_LIST_PART......................PsiTypeParameter
*
* There is a PsiType class but its not an element of the PSI.
* There is a PsiTypeElement class that /is/ part of the tree, though it's pretty low-level.
*
*/
typeTag ::= ':' functionTypeWrapper
typeParam ::= '<' typeList '>' {mixin="com.intellij.plugins.haxe.lang.psi.impl.HaxeTypeParamPsiMixinImpl" implements="com.intellij.plugins.haxe.lang.psi.HaxeTypeParamPsiMixin"}
typeList ::= typeListPart (',' typeListPart)*
genericParam ::= '<' genericListPart (',' genericListPart)* '>'
genericListPart ::= componentName (':' ('(' typeList ')' | typeListPart))?
{mixin="com.intellij.plugins.haxe.lang.psi.impl.AbstractHaxeNamedComponent" implements="com.intellij.plugins.haxe.lang.psi.HaxeComponent"}
typeListPart ::= functionTypeWrapper
{mixin="com.intellij.plugins.haxe.lang.psi.impl.HaxeTypeListPartPsiMixinImpl" implements="com.intellij.plugins.haxe.lang.psi.HaxeTypeListPartPsiMixin"}
type ::= referenceExpression qualifiedReferenceExpression* typeParam?
{mixin="com.intellij.plugins.haxe.lang.psi.impl.HaxeTypePsiMixinImpl" implements="com.intellij.plugins.haxe.lang.psi.HaxeTypePsiMixin"}
typeOrAnonymous ::= type | anonymousType
blockStatement ::= '{' statementList? '}' {mixin="com.intellij.plugins.haxe.lang.psi.impl.HaxeBlockStatementPsiMixinImpl" implements="com.intellij.plugins.haxe.lang.psi.HaxeBlockStatementPsiMixin" extends="com.intellij.plugins.haxe.lang.psi.HaxeBlockStatementPsiMixin"}
private statementList ::= (statement ';'?)+ {recoverWhile="statement_recovery"}
private statement_recovery ::= !('case' | 'default' | '}')
private statement ::= macroClassList? (blockStatement | notBlockStatement)
{pin=2 mixin="com.intellij.plugins.haxe.lang.psi.impl.HaxeStatementPsiMixinImpl" implements="com.intellij.plugins.haxe.lang.psi.HaxeStatementPsiMixin"}
private notBlockStatement ::= ('untyped' statement ';'?)
| ('macro' statement ';'?)
| localVarDeclaration
| localFunctionDeclaration
| ifStatement
| forStatement
| whileStatement
| doWhileStatement
| returnStatement
| breakStatement
| continueStatement
| switchStatement
| throwStatement
| tryStatement
| expression
ifStatement ::= 'if' '(' expression ')' statement ';'? ('else' statement ';'?)?
forStatement ::= 'for' '(' componentName 'in' iterable')' statement ';'?
{mixin="com.intellij.plugins.haxe.lang.psi.impl.HaxeForStatementPsiMixinImpl" implements="com.intellij.plugins.haxe.lang.psi.HaxeForStatementPsiMixin"}
// XXX: Somehow or another, forStatement must derive from AbstractHaxeNamedComponent, or variable resolution will break.
iterable ::= expression
whileStatement ::= 'while' '(' expression ')' statement ';'?
doWhileStatement ::= 'do' statement 'while' '(' expression ')' ';'
returnStatement ::= 'return' (objectLiteral | ("macro"? blockStatement) | expression )? ';'?
returnStatementWithoutSemicolon ::= 'return' expression
breakStatement ::= 'break' ';'
continueStatement ::= 'continue' ';'
throwStatement ::= 'throw' expression ';'?
switchStatement ::= 'switch' expression switchBlock
switchBlock ::= '{' switchCase* defaultCase? '}' {pin=1}
switchCaseBlock ::= (literalExpression ";") | statementList
switchCase ::= ('case' switchCaseExpression (',' switchCaseExpression)* ':')+ switchCaseBlock? {pin=1 recoverWhile="switch_case_recover"}
switchCaseExpression ::= expression ('if' '(' expression ')')? {pin=1 extends="expression"}
private switch_case_recover ::= !('case' | 'default' | '}' | ID)
defaultCase::= 'default' ':' switchCaseBlock? {pin=1}
tryStatement ::= 'try' statement ';'? catchStatement*
catchStatement ::= 'catch' '(' parameter ')' statement ';'?
/*
* expressions
*/
//mapArrayExpression ::= (expression OFAT_ARROW expression (',' expression OFAT_ARROW expression)*) {recoverWhile="expression_list_recover"}
//mapArrayExpression
expressionList ::= forStatement | whileStatement | (expression (',' expression)*) {recoverWhile="expression_list_recover"}
private expression_list_recover ::= !(')' | ']')
expression ::= fatArrowExpressionWrapper {recoverWhile="expression_recover"}
private expression_recover ::= !('!' | '!=' | '%' | '%=' | '&&' | '&' | '&=' | '(' | ')' | '*' | '*=' | '+' | '++' | '+=' | ',' | '-' | '--' | '-=' | '.' | '...' | '/' | '/=' | ':' | ';' | '<' | '<<' | '<<=' | '<=' | '=' | '==' | '>' | '?' | metaKeyWord | '[' | ']' | '^' | '^=' | 'break' | 'case' | 'cast' | 'catch' | 'continue' | 'default' | 'do' | 'dynamic' | 'else' | 'false' | 'for' | 'function' | 'if' | 'inline' | 'new' | 'null' | 'override' | 'private' | 'public' | 'return' | 'static' | 'super' | 'switch' | 'this' | 'throw' | 'true' | 'try' | 'untyped' | 'var' | 'while' | '{' | '|' | '|=' | '||' | '}' | '~' | ID | LITFLOAT | LITHEX | LITINT | LITOCT | OPEN_QUOTE | CLOSING_QUOTE | MACRO_ID | REG_EXP | LONG_TEMPLATE_ENTRY_END | '=>')
private fatArrowExpressionWrapper ::= assignExpressionWrapper fatArrowExpression*
left fatArrowExpression ::= '=>' assignExpressionWrapper {pin=1 extends="expression"}
private assignExpressionWrapper ::= iteratorExpressionWrapper assignExpression*
left assignExpression ::= assignOperation iteratorExpressionWrapper
private iteratorExpressionWrapper ::= ternaryExpressionWrapper iteratorExpression?
left iteratorExpression ::= '...' ternaryExpressionWrapper
private ternaryExpressionWrapper ::= logicOrExpressionWrapper ternaryExpression?
left ternaryExpression ::= '?' expression ':' ternaryExpressionWrapper
private logicOrExpressionWrapper ::= logicAndExpressionWrapper logicOrExpression*
left logicOrExpression ::= '||' logicAndExpressionWrapper
private logicAndExpressionWrapper ::= compareExpressionWrapper logicAndExpression*
left logicAndExpression ::= '&&' compareExpressionWrapper
private compareExpressionWrapper ::= bitwiseExpressionWrapper compareExpression*
left compareExpression ::= compareOperation bitwiseExpressionWrapper
private bitwiseExpressionWrapper ::= shiftExpressionWrapper bitwiseExpression*
left bitwiseExpression ::= bitOperation shiftExpressionWrapper
private shiftExpressionWrapper ::= additiveExpressionWrapper shiftExpression*
left shiftExpression ::= shiftOperator additiveExpressionWrapper
private additiveExpressionWrapper ::= multiplicativeExpressionWrapper additiveExpression*
left additiveExpression ::= ('+' | '-') multiplicativeExpressionWrapper
private multiplicativeExpressionWrapper ::= prefixExpression multiplicativeExpression*
left multiplicativeExpression ::= ('*' | '/' | '%') (prefixExpression | suffixExpressionWrapper)
prefixExpression ::= ('-' | '--' | '++' | '!' | '~') prefixExpression | suffixExpressionWrapper
private suffixExpressionWrapper ::= value suffixExpression*
left suffixExpression ::= ('--' | '++')
private value ::= macroClassList? ('untyped' expression
| 'macro' expression
| (literalExpression qualifiedReferenceTail?)
| ifStatement
| castExpression qualifiedReferenceTail?
| newExpressionOrCall
| parenthesizedExpressionOrCall
| callOrArrayAccess
| tryStatement
| switchStatement)
{pin=2}
literalExpression ::= LITINT | LITHEX | LITOCT | LITFLOAT
| regularExpressionLiteral
| 'null' | 'true' | 'false'
| functionLiteral
| arrayLiteral
| objectLiteral
| stringLiteralExpression
//| blockStatement
{mixin="com.intellij.plugins.haxe.lang.psi.impl.HaxeReferenceImpl" implements="com.intellij.plugins.haxe.lang.psi.HaxeReference"}
stringLiteralExpression ::= OPEN_QUOTE (REGULAR_STRING_PART | shortTemplateEntry | longTemplateEntry)* CLOSING_QUOTE
{pin=1 mixin="com.intellij.plugins.haxe.lang.psi.impl.HaxeReferenceImpl" implements="com.intellij.plugins.haxe.lang.psi.HaxeReference"}
shortTemplateEntry ::= SHORT_TEMPLATE_ENTRY_START (thisExpression | referenceExpression) {pin=1}
longTemplateEntry ::= LONG_TEMPLATE_ENTRY_START expression LONG_TEMPLATE_ENTRY_END {pin=1}
regularExpressionLiteral ::= REG_EXP
{extends="literalExpression" mixin="com.intellij.plugins.haxe.lang.psi.impl.HaxeRegularExpressionImpl" implements="com.intellij.plugins.haxe.lang.psi.HaxeRegularExpression"}
private parenthesizedExpressionOrCall ::= parenthesizedExpression qualifiedReferenceTail?
parenthesizedExpression ::= '(' (expression typeTag | expression | statement) ')'
private newExpressionOrCall ::= newExpression qualifiedReferenceTail?
private qualifiedReferenceTail ::= qualifiedReferenceExpression (callExpression | arrayAccessExpression | qualifiedReferenceExpression)*
private callOrArrayAccess ::= (referenceExpression | thisExpression | superExpression) (callExpression | arrayAccessExpression | qualifiedReferenceExpression)*
left callExpression ::= '(' expressionList? ')'
{mixin="com.intellij.plugins.haxe.lang.psi.impl.HaxeReferenceImpl" implements="com.intellij.plugins.haxe.lang.psi.HaxeReference"}
left arrayAccessExpression ::= '[' expression? ']'
{mixin="com.intellij.plugins.haxe.lang.psi.impl.HaxeReferenceImpl" implements="com.intellij.plugins.haxe.lang.psi.HaxeReference"}
referenceExpression ::= identifier
{mixin="com.intellij.plugins.haxe.lang.psi.impl.HaxeReferenceImpl" implements="com.intellij.plugins.haxe.lang.psi.HaxeReference"}
left qualifiedReferenceExpression ::= '.' referenceExpression {elementType="referenceExpression"}
simpleQualifiedReferenceExpression ::= referenceExpression qualifiedReferenceExpression * { elementType="referenceExpression"}
//import wildcard support
left qualifiedReferenceExpressionOrWildcard ::= '.' referenceExpression {elementType="referenceExpression"}
left wildcard ::= '.' '*'
simpleQualifiedReferenceExpressionWithWildcardSupport ::= referenceExpression qualifiedReferenceExpressionOrWildcard * wildcard { elementType="referenceExpression"}
componentName ::= identifier
{mixin="com.intellij.plugins.haxe.lang.psi.impl.HaxeNamedElementImpl" implements="com.intellij.plugins.haxe.lang.psi.HaxeNamedElement"}
identifier ::= ID
{mixin="com.intellij.plugins.haxe.lang.psi.impl.HaxeIdentifierPsiMixinImpl" implements="com.intellij.plugins.haxe.lang.psi.HaxeIdentifierPsiMixin"}
thisExpression ::= 'this'
{mixin="com.intellij.plugins.haxe.lang.psi.impl.HaxeReferenceImpl" implements="com.intellij.plugins.haxe.lang.psi.HaxeReference"}
superExpression ::= 'super'
{mixin="com.intellij.plugins.haxe.lang.psi.impl.HaxeReferenceImpl" implements="com.intellij.plugins.haxe.lang.psi.HaxeReference"}
newExpression ::= 'new' type '(' (expression (',' expression)*)? ')'
{pin=2 recoverWhile="expression_recover" mixin="com.intellij.plugins.haxe.lang.psi.impl.HaxeReferenceImpl" implements="com.intellij.plugins.haxe.lang.psi.HaxeReference"}
castExpression ::= 'cast' (('(' expression ',' functionTypeWrapper ')') | expression)
{mixin="com.intellij.plugins.haxe.lang.psi.impl.HaxeClassReferenceImpl" implements="com.intellij.plugins.haxe.lang.psi.HaxeReference"}
inheritList ::= inherit (','? inherit)*
private inherit ::= extendsDeclaration | implementsDeclaration
{pin=1 recoverWhile="inherit_recover" mixin="com.intellij.plugins.haxe.lang.psi.impl.HaxeInheritPsiMixinImpl" implements="com.intellij.plugins.haxe.lang.psi.HaxeInheritPsiMixin"}
private inherit_recover ::= !(',' | '{' | 'extends' | 'implements')
extendsDeclaration ::= ('extends' type)+ {mixin="com.intellij.plugins.haxe.lang.psi.impl.HaxeInheritImpl" implements="com.intellij.plugins.haxe.lang.psi.HaxeInherit"}
implementsDeclaration ::= ('implements' type)+ {mixin="com.intellij.plugins.haxe.lang.psi.impl.HaxeInheritImpl" implements="com.intellij.plugins.haxe.lang.psi.HaxeInherit"}
anonymousType ::= '{' anonymousTypeBody '}'
{pin=3 mixin="com.intellij.plugins.haxe.lang.psi.impl.AnonymousHaxeTypeImpl" implements="com.intellij.plugins.haxe.lang.psi.HaxeClass"}
anonymousTypeBody ::= extendedAnonymousTypeBody | simpleAnonymousTypeBody | interfaceBody
private extendedAnonymousTypeBody ::= typeExtends (',' anonymousTypeFieldList)? (',' interfaceBody)?
private simpleAnonymousTypeBody ::= anonymousTypeFieldList (',' interfaceBody)?
typeExtends ::= '>' type
anonymousTypeFieldList ::= anonymousTypeField (',' anonymousTypeField)*
anonymousTypeField ::= "?"? componentName typeTag
{mixin="com.intellij.plugins.haxe.lang.psi.impl.HaxePsiFieldImpl" implements="com.intellij.plugins.haxe.lang.psi.HaxePsiField"}
// Do NOT genericize objectLiteral by making objectLiteralElementList optional. Doing so
// makes blockStatement be overridden by objectLiteral in return statements.
private emptyObjectLiteral ::= '{' '}'
objectLiteral ::= ('{' objectLiteralElementList+ '}') | emptyObjectLiteral
private objectLiteralElementList ::= objectLiteralElement (',' objectLiteralElement)* {recoverWhile="object_literal_list_recover"}
private object_literal_list_recover ::= !('}')
objectLiteralElement ::= identifier ':' expression {recoverWhile="object_literal_part_recover"}
private object_literal_part_recover ::= !(',' | '}')