mirror of https://github.com/kdl-org/kdl.git
Update SPEC.md (#57)
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:
parent
f60ba7edc1
commit
3da011acbc
12
SPEC.md
12
SPEC.md
|
|
@ -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 `0x20` or below.
|
||||||
* Any codepoint with hexadecimal value higher than `0x10FFFF`.
|
* Any codepoint with hexadecimal value higher than `0x10FFFF`.
|
||||||
* Any of "\\<>{};[]=,"
|
* Any of "\\<>{};[]=,\""
|
||||||
|
|
||||||
### Line Continuation
|
### Line Continuation
|
||||||
|
|
||||||
|
|
@ -308,12 +308,14 @@ node-children := ('/-' ws*)? '{' nodes '}'
|
||||||
node-space := ws* escline ws* | ws+
|
node-space := ws* escline ws* | ws+
|
||||||
node-terminator := single-line-comment | newline | ';' | eof
|
node-terminator := single-line-comment | newline | ';' | eof
|
||||||
|
|
||||||
identifier := (identifier-char - digit - [<>]) identifier-char* | string
|
identifier := string | bare-identifier
|
||||||
identifier-char := unicode - digit - linespace - [\{}<>;[]=,]
|
bare-identifier := (identifier-char - digit) identifier-char*
|
||||||
|
identifier-char := unicode - linespace - [\{}<>;[]=,"]
|
||||||
prop := identifier '=' value
|
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 | [^\"]
|
character := '\' escape | [^\"]
|
||||||
escape := ["\\/bfnrt] | 'u{' hex-digit{1, 6} '}'
|
escape := ["\\/bfnrt] | 'u{' hex-digit{1, 6} '}'
|
||||||
hex-digit := [0-9a-fA-F]
|
hex-digit := [0-9a-fA-F]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue