Fix and simplify identifier character grammar

- remove some of the "minus" syntax: it is only
    used in this part of the grammar AFAIK, and
    from my own experience, it can be confusing
  - add \x00-\x20 to the list of non-identifier chars
This commit is contained in:
Lars Willighagen 2021-09-21 22:48:20 +02:00 committed by GitHub
parent 24faa6b75c
commit 17458be6d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -427,8 +427,9 @@ 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
identifier-char := unicode - linespace - [\/(){}<>;[]=,"]
bare-identifier := (identifier-initial identifier-char* | sign ((identifier-initial | sign) identifier-char*)?) - keyword
identifier-char := identifier-initial | digit | sign
identifier-initial := [A-Za-z] | [\x80-\u{10FFFF}] | [!#$%&'*.:?@^_`|~]
keyword := boolean | 'null'
prop := identifier '=' value
value := type? (string | number | keyword)