diff --git a/CHANGELOG.md b/CHANGELOG.md index a3bc032..cd30307 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ * Single line comments (`//`) can now be immediately followed by a newline. * All literal whitespace following a `\` in a string is now discarded. * Vertical tabs (`U+000B`) are now considered to be whitespace. +* Identifiers can't start with `r#`, so they're easy to distinguish from raw strings. (They already similarly can't start with a digit, or a sign+digit, so they're easy to distinguish from numbers.) ### KQL diff --git a/SPEC.md b/SPEC.md index 55a4d1a..cbd90c7 100644 --- a/SPEC.md +++ b/SPEC.md @@ -482,7 +482,10 @@ node-space := ws* escline ws* | ws+ 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 +bare-identifier := (unambiguous-ident | numberish-ident | stringish-ident) - keyword +unambiguous-ident := (identifier-char - digit - sign - "r") identifier-char* +numberish-ident := sign ((identifier-char - digit) identifier-char*)? +stringish-ident := "r" ((identifier-char - "#") identifier-char*)? identifier-char := unicode - linespace - [\/(){}<>;[]=,"] keyword := boolean | 'null' prop := identifier '=' value