Update SPEC.md

this does a few things with identifiers and strings:

- removes `"` from the set of identifier characters, to prevent ambiguity with string
- adds `bare-identifier` and `escaped-string` non-terminals (i think less mixing of terminal/non-terminal is easier to read?)
- moves string ahead of bare-identifier in identifier, for easier implementation with ordered-choice parsers
- moves raw-string into string, so you can have raw-string identifiers
This commit is contained in:
hclarke 2020-12-26 20:38:15 -04:00 committed by GitHub
parent f60ba7edc1
commit 9e80eb11e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 5 deletions

12
SPEC.md
View File

@ -99,7 +99,7 @@ The following characters cannot be used anywhere in a bare
* Any codepoint with hexadecimal value `0x20` or below.
* Any codepoint with hexadecimal value higher than `0x10FFFF`.
* Any of "\\<>{};[]=,"
* Any of "\\<>{};[]=,\""
### Line Continuation
@ -308,12 +308,14 @@ node-children := ('/-' ws*)? '{' nodes '}'
node-space := ws* escline ws* | ws+
node-terminator := single-line-comment | newline | ';' | eof
identifier := (identifier-char - digit - [<>]) identifier-char* | string
identifier-char := unicode - digit - linespace - [\{}<>;[]=,]
identifier := string | bare-identifier
bare-identifier := (identifier-char - digit) identifier-char*
identifier-char := unicode - linespace - [\{}<>;[]=,"]
prop := identifier '=' value
value := string | raw_string | number | boolean | 'null'
value := string | number | boolean | 'null'
string := '"' character* '"'
string := raw-string | escaped-string
escaped-string := '"' character* '"'
character := '\' escape | [^\"]
escape := ["\\/bfnrt] | 'u{' hex-digit{1, 6} '}'
hex-digit := [0-9a-fA-F]