Skip to content

Commit b56843d

Browse files
eernstgCommit Queue
authored and
Commit Queue
committed
Spec parse null aware elements
Change-Id: Ib61fea3bec110c0a2c560c965912c51a1c4e22cf Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/368569 Reviewed-by: Lasse Nielsen <[email protected]> Commit-Queue: Erik Ernst <[email protected]>
1 parent 3c85d34 commit b56843d

File tree

2 files changed

+34
-2
lines changed

2 files changed

+34
-2
lines changed

tools/spec_parser/Dart.g

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
// CHANGES:
66
//
7+
// v0.44 Support null-aware elements.
8+
//
79
// v0.43 Change rule structure such that the association of metadata
810
// with non-terminals can be explained in a simple and consistent way.
911
// The derivable terms do not change. Remove `metadata` from the kind
@@ -732,13 +734,24 @@ elements
732734
;
733735
734736
element
735-
: expressionElement
737+
: nullAwareExpressionElement
738+
| nullAwareMapElement
739+
| expressionElement
736740
| mapElement
737741
| spreadElement
738742
| ifElement
739743
| forElement
740744
;
741745
746+
nullAwareExpressionElement
747+
: '?' expression
748+
;
749+
750+
nullAwareMapElement
751+
: '?' expression ':' '?'? expression
752+
| expression ':' '?' expression
753+
;
754+
742755
expressionElement
743756
: expression
744757
;

tools/spec_parser/dart_spec_parser/Dart.g4

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@
1010
// of `forLoopParts` where the iteration variable is an existing variable
1111
// in scope (this is not implemented, is inconsistent anyway).
1212
//
13+
// v0.45 Support null-aware elements.
14+
//
15+
// v0.44 Change rule structure such that the association of metadata
16+
// with non-terminals can be explained in a simple and consistent way.
17+
// The derivable terms do not change. Remove `metadata` from the kind
18+
// of `forLoopParts` where the iteration variable is an existing variable
19+
// in scope (this is not implemented, is inconsistent anyway).
20+
//
1321
// v0.43 Support updated augmented `extensionDeclaration`.
1422
//
1523
// v0.42 Add missing `enumEntry` update for augmentations.
@@ -738,13 +746,24 @@ elements
738746
;
739747

740748
element
741-
: expressionElement
749+
: nullAwareExpressionElement
750+
| nullAwareMapElement
751+
| expressionElement
742752
| mapElement
743753
| spreadElement
744754
| ifElement
745755
| forElement
746756
;
747757

758+
nullAwareExpressionElement
759+
: '?' expression
760+
;
761+
762+
nullAwareMapElement
763+
: '?' expression ':' '?'? expression
764+
| expression ':' '?' expression
765+
;
766+
748767
expressionElement
749768
: expression
750769
;

0 commit comments

Comments
 (0)