From 9e80eb11e15b69c16e3be762debd24a190939253 Mon Sep 17 00:00:00 2001 From: hclarke <0@hclarke.ca> Date: Sat, 26 Dec 2020 20:38:15 -0400 Subject: [PATCH] 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 --- SPEC.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/SPEC.md b/SPEC.md index 695ad3d..46c510d 100644 --- a/SPEC.md +++ b/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 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]