0

Add feature to bnf-ish mojo grammar docs

Missed adding this when adding the keyword - this section of the
docs helps people write highlighters without having to read a
python ply file. Code implementing `feature` is fully landed.

Bug: 1278253
Change-Id: Ieb1ad7a7287a506b67f046ad12ca880d132246b7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5133049
Commit-Queue: Oksana Zhuravlova <oksamyt@chromium.org>
Reviewed-by: Oksana Zhuravlova <oksamyt@chromium.org>
Auto-Submit: Alex Gough <ajgo@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1238719}
This commit is contained in:
Alex Gough
2023-12-18 20:42:45 +00:00
committed by Chromium LUCI CQ
parent 018fa4d95a
commit 1c5473dc9d

@ -908,7 +908,7 @@ Statement = ModuleStatement | ImportStatement | Definition
ModuleStatement = AttributeSection "module" Identifier ";"
ImportStatement = "import" StringLiteral ";"
Definition = Struct Union Interface Enum Const
Definition = Struct Union Interface Enum Feature Const
AttributeSection = <empty> | "[" AttributeList "]"
AttributeList = <empty> | NonEmptyAttributeList
@ -973,6 +973,13 @@ EnumValue = AttributeSection Name
| AttributeSection Name "=" Integer
| AttributeSection Name "=" Identifier
; Note: `feature` is a weak keyword and can appear as, say, a struct field name.
Feature = AttributeSection "feature" Name "{" FeatureBody "}" ";"
| AttributeSection "feature" Name ";"
FeatureBody = <empty>
| FeatureBody FeatureField
FeatureField = AttributeSection TypeSpec Name Default ";"
Const = "const" TypeSpec Name "=" Constant ";"
Constant = Literal | Identifier ";"