-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtree-sitter-dart.ebnf
1238 lines (894 loc) · 28.1 KB
/
tree-sitter-dart.ebnf
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
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
//
// From tree-sitter-dart/src/grammar.json
//
//
// EBNF to generate railroad diagram at
// (IPV6) https://www.bottlecaps.de/rr/ui
// (IPV4) https://rr.red-dove.com/ui
//
program ::=
script_tag? library_name? import_or_export* part_directive* part_of_directive* _top_level_definition*
_top_level_definition ::=
class_definition
| mixin_declaration
| extension_declaration
| enum_declaration
| type_alias
| _metadata? _external_builtin? function_signature _semicolon
| _metadata? _external_builtin? getter_signature _semicolon
| _metadata? _external_builtin? setter_signature _semicolon
| _metadata? getter_signature function_body
| _metadata? setter_signature function_body
| _metadata? function_signature function_body
| _metadata? ( final_builtin | const_builtin ) _type? static_final_declaration_list _semicolon
| _metadata? _late_builtin final_builtin _type? initialized_identifier_list _semicolon
| _metadata? _late_builtin? ( _type | inferred_type ) initialized_identifier_list _semicolon
_bool_literal ::=
true
| false
_numeric_literal ::=
decimal_integer_literal
| decimal_floating_point_literal
| hex_integer_literal
_literal ::=
null_literal
| _bool_literal
| _numeric_literal
| string_literal
| symbol_literal
| set_or_map_literal
| list_literal
| record_literal
symbol_literal ::=
'#' identifier
decimal_integer_literal ::=
( [0-9]+ ( '_'+ [0-9]+ )* )
hex_integer_literal ::=
( ( '0x' | '0X' ) ( [A-Fa-f0-9]+ ( '_' [A-Fa-f0-9]+ )* ) )
decimal_floating_point_literal ::=
( ( [0-9]+ ( '_'+ [0-9]+ )* ) '.' ( [0-9]+ ( '_'+ [0-9]+ )* ) ( [eE] ( '-' | '+' )? ( [0-9]+ ( '_'+ [0-9]+ )* ) )? | '.' ( [0-9]+ ( '_'+ [0-9]+ )* ) ( [eE] ( '-' | '+' )? ( [0-9]+ ( '_'+ [0-9]+ )* ) )? | ( [0-9]+ ( '_'+ [0-9]+ )* ) [eE] ( '-' | '+' )? ( [0-9]+ ( '_'+ [0-9]+ )* ) | ( [0-9]+ ( '_'+ [0-9]+ )* ) ( [eE] ( '-' | '+' )? ( [0-9]+ ( '_'+ [0-9]+ )* ) )? )
true ::=
'true'
false ::=
'false'
string_literal ::=
( _string_literal_double_quotes | _string_literal_single_quotes | _string_literal_double_quotes_multiple | _string_literal_single_quotes_multiple | _raw_string_literal_double_quotes | _raw_string_literal_single_quotes | _raw_string_literal_double_quotes_multiple | _raw_string_literal_single_quotes_multiple )+
_string_literal_double_quotes ::=
'"' ( _template_chars_double_single | "'" | escape_sequence | _sub_string_test | template_substitution )* '"'
_string_literal_single_quotes ::=
"'" ( _template_chars_single_single | '"' | escape_sequence | _sub_string_test | template_substitution )* "'"
_string_literal_double_quotes_multiple ::=
'"""' ( _template_chars_double | "'" | '"' | escape_sequence | _sub_string_test | template_substitution )* '"""'
_string_literal_single_quotes_multiple ::=
"'''" ( _template_chars_single | '"' | "'" | escape_sequence | _sub_string_test | template_substitution )* "'''"
_raw_string_literal_double_quotes ::=
'r"' ( _template_chars_double_single | "'" | _template_chars_raw_slash | _unused_escape_sequence | _sub_string_test | '$' )* '"'
_raw_string_literal_single_quotes ::=
"r'" ( _template_chars_single_single | '"' | _template_chars_raw_slash | _unused_escape_sequence | _sub_string_test | '$' )* "'"
_raw_string_literal_double_quotes_multiple ::=
'r"""' ( _template_chars_double | "'" | _template_chars_raw_slash | '"' | _unused_escape_sequence | _sub_string_test | '$' )* '"""'
_raw_string_literal_single_quotes_multiple ::=
"r'''" ( _template_chars_single | '"' | "'" | _template_chars_raw_slash | _unused_escape_sequence | _sub_string_test | '$' )* "'''"
_triple_quote_end ::=
"'''"
_triple_double_quote_end ::=
'"""'
template_substitution ::=
'$' ( '{' _expression '}' | identifier_dollar_escaped )
_sub_string_test ::=
'$' [^a-zA-Z_{]
_string_interp ::=
'\$'(([a-zA-Z_]+)|'\{'([^{}]+)'\}')
_unused_escape_sequence ::=
( '\\' ( [^xu0-7] | [0-7]'{1,3}' | 'x'[0-9a-fA-F]'{2}' | 'u'[0-9a-fA-F]'{4}' | 'u{'[0-9a-fA-F]+'}' ) )
escape_sequence ::=
_unused_escape_sequence
list_literal ::=
const_builtin? type_arguments? '[' ( _element ( ',' _element )* ','? )? ']'
set_or_map_literal ::=
const_builtin? type_arguments? '{' ( _element ( ',' _element )* ','? )? '}'
pair ::=
_expression ':' _expression
_element ::=
_expression
| pair
| spread_element
| if_element
| for_element
null_literal ::=
'null'
record_literal ::=
const_builtin? _record_literal_no_const
_record_literal_no_const ::=
'(' ( label _expression | _expression ',' | record_field ( ',' record_field )+ ','? ) ')'
record_field ::=
label? _expression
_expression ::=
pattern_assignment
| assignment_expression
| throw_expression
| _real_expression cascade_section*
_expression_without_cascade ::=
assignment_expression_without_cascade
| _real_expression
| throw_expression_without_cascade
_real_expression ::=
conditional_expression
| logical_or_expression
| if_null_expression
| additive_expression
| multiplicative_expression
| relational_expression
| equality_expression
| logical_and_expression
| bitwise_and_expression
| bitwise_or_expression
| bitwise_xor_expression
| shift_expression
| type_cast_expression
| type_test_expression
| _unary_expression
throw_expression ::=
'throw' _expression
throw_expression_without_cascade ::=
'throw' _expression_without_cascade
assignment_expression ::=
assignable_expression _assignment_operator _expression
assignment_expression_without_cascade ::=
assignable_expression _assignment_operator _expression_without_cascade
assignable_expression ::=
_primary _assignable_selector_part
| super unconditional_assignable_selector
| constructor_invocation _assignable_selector_part
| identifier
_assignable_selector_part ::=
selector* _assignable_selector
_assignment_operator ::=
'='
| '+='
| '-='
| '*='
| '/='
| '%='
| '~/='
| '<<='
| '>>='
| '>>>='
| '&='
| '^='
| '|='
| '??='
lambda_expression ::=
function_signature function_body
function_expression ::=
_formal_parameter_part function_expression_body
inferred_parameters ::=
'(' identifier ( ',' identifier )* ')'
if_null_expression ::=
_real_expression _if_null_expression
_if_null_expression ::=
( '??' _real_expression )+
conditional_expression ::=
_real_expression '?' _expression_without_cascade ':' _expression_without_cascade
logical_or_expression ::=
_real_expression ( logical_or_operator _real_expression )+
logical_and_expression ::=
_real_expression ( logical_and_operator _real_expression )+
equality_expression ::=
_real_expression equality_operator _real_expression | super equality_operator _real_expression
equality_operator ::=
( '==' | '!=' )
type_cast_expression ::=
_real_expression type_cast
type_test_expression ::=
_real_expression type_test
relational_expression ::=
_real_expression relational_operator _real_expression | super relational_operator _real_expression
relational_operator ::=
'<'
| '>'
| '<='
| '>='
bitwise_or_expression ::=
_real_expression ( '|' _real_expression )+ | super ( '|' _real_expression )+
bitwise_xor_expression ::=
_real_expression ( '^' _real_expression )+ | super ( '^' _real_expression )+
bitwise_and_expression ::=
_real_expression ( '&' _real_expression )+ | super ( '&' _real_expression )+
shift_expression ::=
_real_expression ( shift_operator _real_expression )+ | super ( shift_operator _real_expression )+
additive_expression ::=
_real_expression ( additive_operator _real_expression )+ | super ( additive_operator _real_expression )+
multiplicative_expression ::=
_unary_expression ( multiplicative_operator _unary_expression )+ | super ( multiplicative_operator _unary_expression )+
bitwise_operator ::=
_bitwise_operator
_bitwise_operator ::=
'&'
| '^'
| '|'
shift_operator ::=
_shift_operator
_shift_operator ::=
'<<'
| '>>'
| '>>>'
additive_operator ::=
_additive_operator
_additive_operator ::=
( '+' | '-' )
multiplicative_operator ::=
_multiplicative_operator
_multiplicative_operator ::=
'*'
| '/'
| '%'
| '~/'
_unary_expression ::=
_postfix_expression | unary_expression
unary_expression ::=
prefix_operator _unary_expression | await_expression | ( minus_operator | tilde_operator ) super | increment_operator assignable_expression
_postfix_expression ::=
_primary selector*
| postfix_expression
postfix_expression ::=
assignable_expression postfix_operator | constructor_invocation selector*
postfix_operator ::=
increment_operator
increment_operator ::=
( '++' | '--' )
spread_element ::=
'...' '?'? _expression
selector ::=
_exclamation_operator | _assignable_selector | argument_part | type_arguments
prefix_operator ::=
minus_operator
| negation_operator
| tilde_operator
minus_operator ::=
'-'
negation_operator ::=
_exclamation_operator
_exclamation_operator ::=
'!'
tilde_operator ::=
'~'
await_expression ::=
'await' _unary_expression
type_test ::=
is_operator _type_not_void
is_operator ::=
'is' _exclamation_operator?
type_cast ::=
as_operator _type_not_void
as_operator ::=
'as'
new_expression ::=
_new_builtin _type_not_void _dot_identifier? arguments
_dot_identifier ::=
'.' identifier
const_object_expression ::=
const_builtin _type_not_void _dot_identifier? arguments
_primary ::=
_literal
| identifier
| function_expression
| new_expression
| const_object_expression
| parenthesized_expression
| this
| super unconditional_assignable_selector
| constructor_tearoff
| switch_expression
parenthesized_expression ::=
'(' _expression ')'
_compound_access ::=
'.'
| '?.'
constructor_invocation ::=
_type_name type_arguments '.' identifier arguments | _type_name '.' _new_builtin arguments
constructor_tearoff ::=
_type_name type_arguments? '.' _new_builtin
arguments ::=
'(' _argument_list? ')'
_argument_list ::=
_any_argument ( ',' _any_argument )* ','?
_any_argument ::=
argument
| named_argument
argument ::=
_expression
named_argument ::=
label _expression
cascade_section ::=
( '..' | '?..' ) cascade_selector argument_part* _cascade_subsection* _cascade_assignment_section?
_cascade_subsection ::=
_assignable_selector argument_part*
_cascade_assignment_section ::=
_assignment_operator _expression_without_cascade
index_selector ::=
'[' _expression ']'
cascade_selector ::=
nullable_selector? index_selector
| identifier
argument_part ::=
type_arguments? arguments
unconditional_assignable_selector ::=
index_selector
| '.' identifier
conditional_assignable_selector ::=
'?.' identifier
| '?' index_selector
_assignable_selector ::=
unconditional_assignable_selector
| conditional_assignable_selector
type_arguments ::=
'<' ( _type ( ',' _type )* )? '>'
wildcard ::=
_metadata? '?' _wildcard_bounds?
_wildcard_bounds ::=
'extends' _type
| super _type
dimensions ::=
( _metadata? '[' ']' )+
_statement ::=
block
| local_function_declaration
| local_variable_declaration
| for_statement
| while_statement
| do_statement
| switch_statement
| if_statement
| try_statement
| break_statement
| continue_statement
| return_statement
| yield_statement
| yield_each_statement
| expression_statement
| assert_statement
local_function_declaration ::=
_metadata? lambda_expression
block ::=
'{' _statement* '}'
expression_statement ::=
_expression _semicolon
labeled_statement ::=
identifier ':' _statement
assert_statement ::=
assertion ';'
assertion ::=
_assert_builtin assertion_arguments
assertion_arguments ::=
'(' _expression ( ',' _expression )? ','? ')'
switch_statement ::=
'switch' parenthesized_expression switch_block
switch_expression ::=
'switch' parenthesized_expression ( '{' switch_expression_case ( ',' switch_expression_case )* ','? '}' )
switch_expression_case ::=
_guarded_pattern '=>' _expression
_guarded_pattern ::=
_pattern ( 'when' _expression )?
_pattern ::=
_logical_or_pattern
_logical_or_pattern ::=
_logical_and_pattern ( logical_or_operator _logical_and_pattern )*
_logical_and_pattern ::=
_relational_pattern ( logical_and_operator _relational_pattern )*
_relational_pattern ::=
( relational_operator | equality_operator ) _real_expression | _unary_pattern
_unary_pattern ::=
cast_pattern
| null_check_pattern
| null_assert_pattern
| _primary_pattern
_primary_pattern ::=
constant_pattern
| variable_pattern
| _parenthesized_pattern
| list_pattern
| map_pattern
| record_pattern
| object_pattern
cast_pattern ::=
_primary_pattern 'as' _type
null_check_pattern ::=
_primary_pattern '?'
null_assert_pattern ::=
_primary_pattern '!'
constant_pattern ::=
_bool_literal
| null_literal
| minus_operator? _numeric_literal
| string_literal
| symbol_literal
| identifier
| qualified
| const_object_expression
| const_builtin type_arguments? '[' _element ( ',' _element )* ','? ']'
| const_builtin type_arguments? '{' _element ( ',' _element )* ','? '}'
| const_builtin '(' _expression ')'
variable_pattern ::=
_final_var_or_type identifier
_parenthesized_pattern ::=
'(' _pattern ')'
list_pattern ::=
type_arguments? '[' ( _list_pattern_element ( ',' _list_pattern_element )* ','? )? ']'
_list_pattern_element ::=
_pattern
| rest_pattern
rest_pattern ::=
'...' _pattern?
map_pattern ::=
type_arguments? '{' ( _map_pattern_entry ( ',' _map_pattern_entry )* ','? )? '}'
_map_pattern_entry ::=
_expression ':' _pattern
| '...'
record_pattern ::=
'(' _pattern_field ( ',' _pattern_field )* ','? ')'
_pattern_field ::=
( identifier? ':' )? _pattern
object_pattern ::=
_type_name type_arguments? '(' _pattern_field ( ',' _pattern_field )* ','? ')'
pattern_variable_declaration ::=
( final_builtin | inferred_type ) _outer_pattern '=' _expression
_outer_pattern ::=
_parenthesized_pattern
| list_pattern
| map_pattern
| record_pattern
| object_pattern
pattern_assignment ::=
_outer_pattern '=' _expression
switch_block ::=
'{' switch_statement_case* switch_statement_default? '}'
switch_statement_case ::=
label* case_builtin _guarded_pattern ':' _statement*
switch_statement_default ::=
label* 'default' ':' _statement*
switch_case ::=
label* case_builtin _guarded_pattern ':' _statement+
default_case ::=
label* 'default' ':' _statement+
switch_label ::=
label* ( case_builtin _expression ':' | 'default' ':' )
do_statement ::=
'do' _statement 'while' parenthesized_expression _semicolon
break_statement ::=
_break_builtin identifier? _semicolon
continue_statement ::=
'continue' identifier? _semicolon
yield_statement ::=
'yield' _expression _semicolon
yield_each_statement ::=
'yield' '*' _expression _semicolon
return_statement ::=
'return' _expression? _semicolon
throw_statement ::=
'throw' _expression _semicolon
try_statement ::=
_try_head ( finally_clause | _on_part+ finally_clause? )?
_on_part ::=
catch_clause block
| 'on' _type_not_void catch_clause? block
_try_head ::=
'try' block
catch_clause ::=
'catch' catch_parameters
catch_parameters ::=
'(' identifier ( ',' identifier )? ')'
catch_type ::=
_type ( '|' _type )*
finally_clause ::=
'finally' block
if_element ::=
'if' '(' _expression ( 'case' _guarded_pattern )? ')' _element ( 'else' _element )?
if_statement ::=
'if' '(' _expression ( 'case' _guarded_pattern )? ')' _statement ( 'else' _statement )?
while_statement ::=
'while' parenthesized_expression _statement
for_statement ::=
'await'? 'for' for_loop_parts _statement
for_loop_parts ::=
'(' _for_loop_parts ')'
_for_loop_parts ::=
( _declared_identifier | identifier ) 'in' _expression
| ( local_variable_declaration | ( _expression ( ',' _expression )* )? _semicolon )? _expression? _semicolon ( _expression ( ',' _expression )* )?
| ( final_builtin | inferred_type ) _outer_pattern 'in' _expression
for_element ::=
'await'? 'for' for_loop_parts _element
annotation ::=
'@' ( identifier | scoped_identifier ) ( type_arguments arguments | arguments )
_declaration ::=
import_specification | class_definition | enum_declaration
import_or_export ::=
library_import | library_export
library_import ::=
_metadata? import_specification
library_export ::=
_metadata? _export configurable_uri combinator* _semicolon
import_specification ::=
_import configurable_uri ( _as identifier )? combinator* _semicolon
| _import uri _deferred _as identifier combinator* _semicolon
part_directive ::=
_metadata? 'part' uri _semicolon
part_of_directive ::=
_metadata? 'part' 'of' ( dotted_identifier_list | uri ) _semicolon
uri ::=
string_literal
configurable_uri ::=
uri configuration_uri*
configuration_uri ::=
'if' configuration_uri_condition uri
configuration_uri_condition ::=
'(' uri_test ')'
uri_test ::=
dotted_identifier_list ( '==' string_literal )?
combinator ::=
'show' _identifier_list
| 'hide' _identifier_list
_identifier_list ::=
identifier ( ',' identifier )*
asterisk ::=
'*'
enum_declaration ::=
_metadata? 'enum' identifier type_parameters? mixins? interfaces? enum_body
enum_body ::=
'{' enum_constant ( ',' enum_constant )* ','? ( ';' ( _metadata? _class_member_definition )* )? '}'
enum_constant ::=
_metadata? identifier argument_part?
| _metadata? identifier type_arguments? '.' ( identifier | _new_builtin ) arguments
type_alias ::=
_metadata? _typedef _type? _type_name _formal_parameter_part ';'
| _metadata? _typedef _type_name type_parameters? '=' _type ';'
_class_modifiers ::=
( sealed | abstract? ( base | interface | 'final' | 'inline' )? ) 'class'
_mixin_class_modifiers ::=
abstract? base? mixin 'class'
class_definition ::=
_metadata? ( _class_modifiers | _mixin_class_modifiers ) identifier type_parameters? superclass? interfaces? class_body
| _metadata? _class_modifiers mixin_application_class
extension_declaration ::=
_metadata? 'extension' identifier? type_parameters? 'on' _type extension_body
_metadata ::=
annotation+
type_parameters ::=
'<' type_parameter ( ',' type_parameter )* '>'
type_parameter ::=
_metadata? ( identifier | nullable_type ) nullable_type? type_bound?
type_bound ::=
'extends' _type_not_void
superclass ::=
'extends' _type_not_void mixins?
| mixins
mixins ::=
'with' _type_not_void_list
mixin_application_class ::=
identifier type_parameters? '=' mixin_application _semicolon
mixin_application ::=
_type_not_void mixins interfaces?
mixin_declaration ::=
_metadata? base? mixin identifier type_parameters? ( 'on' _type_not_void_list )? interfaces? class_body
interfaces ::=
_implements _type_not_void_list
interface_type_list ::=
_type ( ',' _type )*
class_body ::=
'{' ( _metadata? _class_member_definition )* '}'
extension_body ::=
'{' ( _metadata? declaration _semicolon | _metadata? method_signature function_body )* '}'
_class_member_definition ::=
declaration _semicolon
| method_signature function_body
getter_signature ::=
_type? _get identifier _native?
setter_signature ::=
_type? _set identifier _formal_parameter_part _native?
method_signature ::=
constructor_signature initializers?
| factory_constructor_signature
| _static? ( function_signature | getter_signature | setter_signature )
| operator_signature
declaration ::=
constant_constructor_signature ( redirection | initializers )?
| constructor_signature ( redirection | initializers )?
| _external const_builtin? factory_constructor_signature
| const_builtin? factory_constructor_signature _native
| _external constant_constructor_signature
| redirecting_factory_constructor_signature
| _external constructor_signature
| _external_builtin? _static? getter_signature
| _external_and_static? setter_signature
| _external? operator_signature
| _external_and_static? function_signature
| _static function_signature
| _static ( _final_or_const _type? static_final_declaration_list | _late_builtin ( final_builtin _type? initialized_identifier_list | ( _type | inferred_type ) initialized_identifier_list ) | ( _type | inferred_type ) initialized_identifier_list )
| _covariant ( _late_builtin ( final_builtin _type? identifier_list | ( _type | inferred_type ) initialized_identifier_list ) | ( _type | inferred_type ) initialized_identifier_list )
| _late_builtin? final_builtin _type? initialized_identifier_list
| _late_builtin? _var_or_type initialized_identifier_list
identifier_list ::=
identifier ( ',' identifier )*
initialized_identifier_list ::=
initialized_identifier ( ',' initialized_identifier )*
initialized_identifier ::=
identifier ( '=' _expression )?
static_final_declaration_list ::=
static_final_declaration ( ',' static_final_declaration )*
binary_operator ::=
multiplicative_operator
| additive_operator
| shift_operator
| relational_operator
| '=='
| bitwise_operator
operator_signature ::=
_type? _operator ( '~' | binary_operator | '[]' | '[]=' ) formal_parameter_list _native?
static_final_declaration ::=
identifier '=' _expression
_external_and_static ::=
_external _static?
_static_or_covariant ::=
_covariant
| _static
_final_or_const ::=
final_builtin
| const_builtin
static_initializer ::=
_static block
initializers ::=
':' initializer_list_entry ( ',' initializer_list_entry )*
initializer_list_entry ::=
super arguments
| super '.' ( identifier | _new_builtin ) arguments
| field_initializer
| assertion
field_initializer ::=
( this '.' )? identifier '=' _real_expression cascade_section*
factory_constructor_signature ::=
_factory identifier ( '.' identifier )* formal_parameter_list
redirecting_factory_constructor_signature ::=
const_builtin? _factory identifier ( '.' identifier )* formal_parameter_list '=' _type_not_void ( '.' identifier )?
redirection ::=
':' this ( '.' _identifier_or_new )? arguments
constructor_signature ::=
( identifier ( '.' _identifier_or_new )? ) formal_parameter_list
constant_constructor_signature ::=
const_builtin identifier ( '.' _identifier_or_new )? formal_parameter_list
constructor_body ::=
'{' explicit_constructor_invocation? _statement* '}'
explicit_constructor_invocation ::=
( type_arguments? ( this | super ) | ( _ambiguous_name | _primary ) '.' type_arguments? super ) arguments _semicolon
_ambiguous_name ::=
identifier
| scoped_identifier
scoped_identifier ::=
( identifier | scoped_identifier ) '.' identifier
variable_declaration ::=
_declared_identifier ( ',' identifier ( ',' identifier )* )?
initialized_variable_definition ::=
_declared_identifier ( '=' _expression )? ( ',' initialized_identifier )*
_declared_identifier ::=
_metadata? _covariant? _final_const_var_or_type identifier
_final_const_var_or_type ::=
_late_builtin? final_builtin _type?
| const_builtin _type?
| _late_builtin? _var_or_type
_type ::=
function_type nullable_type?
| _type_not_function
_type_not_function ::=
_type_not_void_not_function
| record_type nullable_type?
| void_type
_type_not_void_not_function ::=
_type_name type_arguments? nullable_type?
| _function_builtin_identifier nullable_type?
function_type ::=
_function_type_tails
| _type_not_function _function_type_tails
_function_type_tails ::=
_function_type_tail+
_function_type_tail ::=
_function_builtin_identifier type_parameters? nullable_type? parameter_type_list? nullable_type?
parameter_type_list ::=
'(' ( normal_parameter_type ( ',' normal_parameter_type )* ','? | normal_parameter_type ( ',' normal_parameter_type )* ',' optional_parameter_types | optional_parameter_types )? ')'
normal_parameter_type ::=
_metadata? ( typed_identifier | _type )
optional_parameter_types ::=
optional_positional_parameter_types
| named_parameter_types
optional_positional_parameter_types ::=
'[' normal_parameter_type ( ',' normal_parameter_type )* ','? ']'
named_parameter_types ::=
'{' _named_parameter_type ( ',' _named_parameter_type )* ','? '}'
_named_parameter_type ::=
_metadata? _required? typed_identifier
_type_not_void ::=
function_type nullable_type?
| record_type nullable_type?
| _type_not_void_not_function
record_type ::=
'(' ')'
| '(' record_type_field ( ',' record_type_field )* ',' '{' record_type_named_field ( ',' record_type_named_field )* ','? '}' ')'
| '(' record_type_field ( ',' record_type_field )* ','? ')'
| '(' '{' record_type_named_field ( ',' record_type_named_field )* ','? '}' ')'
record_type_field ::=
_metadata? _type identifier?
record_type_named_field ::=
_metadata? typed_identifier
_type_not_void_list ::=
_type_not_void ( ',' _type_not_void )*
_type_name ::=
identifier _type_dot_identifier?
_type_dot_identifier ::=
'.' identifier
typed_identifier ::=
_type identifier
nullable_type ::=
'?'
nullable_selector ::=