aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2016-01-10 11:48:54 -0700
committerAndrew Kelley <superjoe30@gmail.com>2016-01-10 11:48:54 -0700
commitd4b8852d784b6f180e5329efa8d418397ee7f1ef (patch)
treed281a93575cd30dcf4c30339a8c5cfa312fa3828 /doc
parent75d57866035a5e27a7e62f7cfabbc899affd3e8b (diff)
downloadzig-d4b8852d784b6f180e5329efa8d418397ee7f1ef.tar.gz
zig-d4b8852d784b6f180e5329efa8d418397ee7f1ef.zip
parsing enum declarations
Diffstat (limited to 'doc')
-rw-r--r--doc/langref.md16
1 files changed, 13 insertions, 3 deletions
diff --git a/doc/langref.md b/doc/langref.md
index c8cc3c588b..e6eca3005e 100644
--- a/doc/langref.md
+++ b/doc/langref.md
@@ -32,16 +32,24 @@ zig | C equivalent | Description
```
Root : many(TopLevelDecl) token(EOF)
-TopLevelDecl : FnDef | ExternBlock | RootExportDecl | Use | StructDecl | VariableDeclaration
+TopLevelDecl : FnDef | ExternBlock | RootExportDecl | Use | StructDecl | VariableDeclaration | EnumDecl
VariableDeclaration : option(FnVisibleMod) (token(Var) | token(Const)) token(Symbol) (token(Eq) Expression | token(Colon) Type option(token(Eq) Expression))
-StructDecl : many(Directive) option(FnVisibleMod) token(Struct) token(Symbol) token(LBrace) many(StructMember) token(RBrace)
+StructDecl : many(Directive) option(FnVisibleMod) token(Struct) StructPayload
+
+StructPayload: token(Symbol) token(LBrace) many(StructMember) token(RBrace)
+
+EnumDecl : many(Directive) option(FnVisibleMod) token(Enum) token(Symbol) token(LBrace) many(EnumField) token(RBrace)
StructMember: StructField | FnDecl
StructField : token(Symbol) token(Colon) Type token(Comma)
+EnumField : (EnumDiscriminant | StructPayload) token(Comma)
+
+EnumDiscriminant : token(Symbol) option(token(Eq) Expression)
+
Use : many(Directive) token(Use) token(String) token(Semicolon)
RootExportDecl : many(Directive) token(Export) token(Symbol) token(String) token(Semicolon)
@@ -160,7 +168,9 @@ SliceExpression : token(LBracket) Expression token(Ellipsis) option(Expression)
PrefixOp : token(Not) | token(Dash) | token(Tilde) | token(Star) | (token(Ampersand) option(token(Const)))
-PrimaryExpression : token(Number) | token(String) | token(CharLiteral) | KeywordLiteral | GroupedExpression | Goto | token(Break) | token(Continue) | BlockExpression | token(Symbol) | StructValueExpression | CompilerFnType | (token(AtSign) token(Symbol) FnCallExpression)
+PrimaryExpression : token(Number) | token(String) | token(CharLiteral) | KeywordLiteral | GroupedExpression | Goto | token(Break) | token(Continue) | BlockExpression | token(Symbol) | StructValueExpression | CompilerFnType | (token(AtSign) token(Symbol) FnCallExpression) | NamespaceSymbol
+
+NamespaceSymbol : token(Symbol) token(ColonColon) token(Symbol)
StructValueExpression : token(Type) token(LBrace) list(StructValueExpressionField, token(Comma)) token(RBrace)