diff --git a/tools/spec_parser/Dart.g b/tools/spec_parser/Dart.g index 6605bd9b57f..248d74debdd 100644 --- a/tools/spec_parser/Dart.g +++ b/tools/spec_parser/Dart.g @@ -4,6 +4,8 @@ // CHANGES: // +// v0.34 Add support for inline classes. +// // v0.33 This commit does not change the derived language at all. It just // changes several rules to use the regexp-like grammar operators to simplify // onParts, recordLiteralNoConst, functionTypeTails, and functionType. @@ -244,6 +246,7 @@ libraryDefinition topLevelDefinition : classDeclaration | mixinDeclaration + | inlineClassDeclaration | extensionDeclaration | enumType | typeAlias @@ -431,6 +434,16 @@ mixinMemberDeclaration : classMemberDeclaration ; +inlineClassDeclaration + : FINAL? INLINE CLASS typeWithParameters interfaces? + LBRACE (metadata inlineMemberDeclaration)* RBRACE + ; + +// TODO: We might want to make this more strict. +inlineMemberDeclaration + : classMemberDeclaration + ; + extensionDeclaration : EXTENSION identifier? typeParameters? ON type LBRACE (metadata extensionMemberDefinition)* RBRACE @@ -1613,6 +1626,7 @@ otherIdentifier : ASYNC | BASE | HIDE + | INLINE | OF | ON | SEALED @@ -1898,6 +1912,10 @@ HIDE : 'hide' ; +INLINE + : 'inline' + ; + OF : 'of' ;