Align the specification parser with recent specification changes
This CL aligns Dart.g/Dart.g4 with the feature specs for augmentations and primary constructors such that they allow for all kinds of membered declaration bodies to be expressed as `;`. Change-Id: I61fe4b4fe6541fd0962f8ca39590611827c1d127 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/483340 Reviewed-by: Chloe Stefantsova <cstefantsova@google.com> Commit-Queue: Erik Ernst <eernst@google.com>
This commit is contained in:
@@ -4,6 +4,9 @@
|
||||
|
||||
// CHANGES:
|
||||
//
|
||||
// v0.59 Adjust augmentation and primary constructor related rules to match
|
||||
// recent updates.
|
||||
//
|
||||
// v0.58 Gather some occurrences of `AUGMENT` in a single location. Rename
|
||||
// `topLevelDefinition` to `topLevelDeclaration` (as in the specification).
|
||||
//
|
||||
@@ -314,7 +317,7 @@ topLevelDeclaration
|
||||
| AUGMENT? getterSignature (functionBody | ';')
|
||||
| AUGMENT? setterSignature (functionBody | ';')
|
||||
| AUGMENT? functionSignature (functionBody | ';')
|
||||
| AUGMENT? (FINAL | CONST) type? initializedIdentifierList ';'
|
||||
| AUGMENT? (FINAL | CONST) type? staticFinalDeclarationList ';'
|
||||
| AUGMENT? LATE FINAL type? initializedIdentifierList ';'
|
||||
| AUGMENT? LATE? varOrType initializedIdentifierList ';'
|
||||
;
|
||||
@@ -544,6 +547,14 @@ declaration
|
||||
| primaryConstructorBodySignature
|
||||
;
|
||||
|
||||
staticFinalDeclarationList
|
||||
: staticFinalDeclaration (',' staticFinalDeclaration)*
|
||||
;
|
||||
|
||||
staticFinalDeclaration
|
||||
: identifier '=' expression
|
||||
;
|
||||
|
||||
operatorSignature
|
||||
: type? OPERATOR operator formalParameterList
|
||||
;
|
||||
@@ -705,12 +716,14 @@ mixinApplication
|
||||
|
||||
enumType
|
||||
: AUGMENT? ENUM classNameMaybePrimary mixins? interfaces?
|
||||
LBRACE enumBody? RBRACE
|
||||
enumBody
|
||||
;
|
||||
|
||||
enumBody
|
||||
: enumEntry (',' enumEntry)* ','? (';' memberDeclarations)?
|
||||
| ';' memberDeclarations
|
||||
: LBRACE
|
||||
(enumEntry (',' enumEntry)* ','?)? (';' memberDeclarations)?
|
||||
RBRACE
|
||||
| ';'
|
||||
;
|
||||
|
||||
enumEntry
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
|
||||
// CHANGES:
|
||||
//
|
||||
// v0.60 Adjust augmentation and primary constructor related rules to match
|
||||
// recent updates.
|
||||
//
|
||||
// v0.59 Gather some occurrences of `AUGMENT` in a single location. Rename
|
||||
// `topLevelDefinition` to `topLevelDeclaration` (as in the specification).
|
||||
//
|
||||
@@ -324,11 +327,19 @@ topLevelDeclaration
|
||||
| AUGMENT? getterSignature (functionBody | ';')
|
||||
| AUGMENT? setterSignature (functionBody | ';')
|
||||
| AUGMENT? functionSignature (functionBody | ';')
|
||||
| AUGMENT? (FINAL | CONST) type? initializedIdentifierList ';'
|
||||
| AUGMENT? (FINAL | CONST) type? staticFinalDeclarationList ';'
|
||||
| AUGMENT? LATE FINAL type? initializedIdentifierList ';'
|
||||
| AUGMENT? LATE? varOrType initializedIdentifierList ';'
|
||||
;
|
||||
|
||||
staticFinalDeclarationList
|
||||
: staticFinalDeclaration (',' staticFinalDeclaration)*
|
||||
;
|
||||
|
||||
staticFinalDeclaration
|
||||
: identifier '=' expression
|
||||
;
|
||||
|
||||
declaredIdentifier
|
||||
: COVARIANT? finalConstVarOrType identifier
|
||||
;
|
||||
@@ -719,12 +730,14 @@ mixinApplication
|
||||
|
||||
enumType
|
||||
: AUGMENT? ENUM classNameMaybePrimary mixins? interfaces?
|
||||
LBRACE enumBody? RBRACE
|
||||
enumBody
|
||||
;
|
||||
|
||||
enumBody
|
||||
: enumEntry (',' enumEntry)* ','? (';' memberDeclarations)?
|
||||
| ';' memberDeclarations
|
||||
: LBRACE
|
||||
(enumEntry (',' enumEntry)* ','?)? (';' memberDeclarations)?
|
||||
RBRACE
|
||||
| ';'
|
||||
;
|
||||
|
||||
enumEntry
|
||||
|
||||
Reference in New Issue
Block a user