Skip to content

Commit 4595ee2

Browse files
gh-183: Allow 1 at ident start.
1 parent 085a8cd commit 4595ee2

4 files changed

Lines changed: 4 additions & 4 deletions

File tree

docs/SPECIFICATION.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@
6464

6565
Identifiers MUST be non-empty and case-sensitive. Variables and user-defined functions share a single flat namespace, so one name MUST NOT denote both a variable and a function. A user-defined function name MUST NOT conflict with any built-in operator or function name.
6666

67-
Identifiers MUST NOT contain non-ASCII characters or any of the following characters: `{`, `}`, `[`, `]`, `(`, `)`, `=`, `,`, `!`, `~`, or `@`. The first character of an identifier MUST NOT be `0` or `1`.
67+
Identifiers MUST NOT contain non-ASCII characters or any of the following characters: `{`, `}`, `[`, `]`, `(`, `)`, `=`, `,`, `!`, `~`, or `@`. The first character of an identifier MUST NOT be `0`.
6868

69-
The first identifier character MAY be a letter `A-Z` or `a-z`, a decimal digit `2-9`, or one of `/`, `$`, `%`, `&`, `_`, `+`, `|`, or `?`. Subsequent identifier characters MAY additionally include the digits `0` and `1`. This permissive ASCII-only character set preserves an unambiguous distinction between identifiers and numeric literals, which MUST begin with a `0`-prefixed base marker.
69+
The first identifier character MAY be a letter `A-Z` or `a-z`, a decimal digit `1-9`, or one of `/`, `$`, `%`, `&`, `_`, `+`, `|`, or `?`. Subsequent identifier characters MAY additionally include the digit `0`. This permissive ASCII-only character set preserves an unambiguous distinction between identifiers and numeric literals, which MUST begin with a `0`-prefixed base marker.
7070

7171
---
7272

src/lexer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ Token lexer_next_token(Lexer* lexer) {
313313
return number_token(lexer, false);
314314
}
315315

316-
if (strchr("abcdefghijklmnopqrstuvwxyz23456789/ABCDEFGHIJKLMNOPQRSTUVWXYZ$%&_+|?", c)) {
316+
if (strchr("abcdefghijklmnopqrstuvwxyz123456789/ABCDEFGHIJKLMNOPQRSTUVWXYZ$%&_+|?", c)) {
317317
return identifier_token(lexer);
318318
}
319319

tests/cases/failing/one-starts-ident.pre

Lines changed: 0 additions & 1 deletion
This file was deleted.

tests/cases/passing/ident-includes-chars.pre

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ BOOL 6 = TRUE
5858
BOOL 7 = TRUE
5959
BOOL 8 = TRUE
6060
BOOL 9 = TRUE
61+
BOOL 1 = TRUE
6162
BOOL / = TRUE
6263
BOOL $ = TRUE
6364
BOOL % = TRUE

0 commit comments

Comments
 (0)