Update formal grammar

This commit is contained in:
Christopher Durham 2022-08-21 13:34:05 -05:00 committed by GitHub
parent d9459f67c0
commit 850703a84d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 8 deletions

16
SPEC.md
View File

@ -442,17 +442,19 @@ Note that for the purpose of new lines, CRLF is considered _a single newline_.
## Full Grammar
```
nodes := linespace* (node nodes?)? linespace*
nodes := (line-space* node)* line-space*
node := ('/-' node-space*)? type? identifier (node-space+ node-prop-or-arg)* (node-space* node-children ws*)? node-space* node-terminator
node-prop-or-arg := ('/-' node-space*)? (prop | value)
node-children := ('/-' node-space*)? '{' nodes '}'
node-space := ws* escline ws* | ws+
line-space := newline | ws | single-line-comment | '/-' node-space* node
node-space := ws* escline ws* | ws+ | '/-' node-space* (node-prop-or-arg | node-children)
node := type? identifier (node-space+ node-prop-or-arg)* (node-space* node-children)? node-space* node-terminator
node-prop-or-arg := prop | value
node-children := '{' nodes '}'
node-terminator := single-line-comment | newline | ';' | eof
identifier := string | bare-identifier
bare-identifier := ((identifier-char - digit - sign) identifier-char* | sign ((identifier-char - digit) identifier-char*)?) - keyword
identifier-char := unicode - linespace - [\/(){}<>;[]=,"]
identifier-char := unicode - line-space - [\/(){}<>;[]=,"]
keyword := boolean | 'null'
prop := identifier '=' value
value := type? (string | number | keyword)
@ -484,8 +486,6 @@ boolean := 'true' | 'false'
escline := '\\' ws* (single-line-comment | newline)
linespace := newline | ws | single-line-comment
newline := See Table (All line-break white_space)
ws := bom | unicode-space | multi-line-comment