|
17 | 17 |
|
18 | 18 | ## 2. Lexical structure |
19 | 19 |
|
20 | | -Source files MUST consist of ASCII characters. Non-ASCII characters MUST not appear in syntactic elements that enter the program namespace, such as identifiers. |
| 20 | +Source files MUST consist of ASCII characters. Non-ASCII characters MUST NOT appear in syntactic elements that enter the program namespace, such as identifiers. |
21 | 21 |
|
22 | 22 | --- |
23 | 23 |
|
|
35 | 35 |
|
36 | 36 | ### 2.2 Tokens and reserved words |
37 | 37 |
|
38 | | -The lexer MUST distinguish at least the following token classes: numeric literals, string literals, identifiers, keywords and built-ins, and delimiters. The base delimiters of the language are `(`, `)`, `{`, `}`, `[`, `]`, `<`, `>`, `,`, `:`, `=`, and `~`. The pointer marker `@` MUST be tokenized separately and MUST not be treated as part of an identifier. |
| 38 | +The lexer MUST distinguish at least the following token classes: numeric literals, string literals, identifiers, keywords and built-ins, and delimiters. The base delimiters of the language are `(`, `)`, `{`, `}`, `[`, `]`, `<`, `>`, `,`, `:`, `=`, and `~`. The pointer marker `@` MUST be tokenized separately and MUST NOT be treated as part of an identifier. |
39 | 39 |
|
40 | 40 | Keywords and built-in names MUST be matched case-sensitively and MUST be written in their canonical uppercase forms. If a reserved word is written in any other case, it MUST be tokenized as an identifier instead. |
41 | 41 |
|
42 | 42 | The character `-` MUST introduce a negative numeric literal when it is followed, optionally after horizontal whitespace, by a `0`-prefixed numeric base marker. The exact spelling `-INF` MUST remain reserved for negative infinity, and the exact spelling `-NaN` MUST remain invalid. In all other cases, `-` MAY participate in identifiers subject to [2.3](#23-identifiers). |
43 | 43 |
|
44 | | -The character `~` MUST be reserved for coerced function parameters and MUST not appear inside identifiers. |
| 44 | +The character `~` MUST be reserved for coerced function parameters and MUST NOT appear inside identifiers. |
45 | 45 |
|
46 | 46 | --- |
47 | 47 |
|
48 | 48 | ### 2.3 Identifiers |
49 | 49 |
|
50 | | -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. |
| 50 | +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. |
51 | 51 |
|
52 | | -Identifiers MUST not contain non-ASCII characters or any of the following characters: `{`, `}`, `[`, `]`, `(`, `)`, `=`, `,`, `!`, `~`, or `@`. The first character of an identifier MUST not be a decimal digit (`0`-`9`), and the first two characters of an identifier MUST not be `-0`. |
| 52 | +Identifiers MUST NOT contain non-ASCII characters or any of the following characters: `{`, `}`, `[`, `]`, `(`, `)`, `=`, `,`, `!`, `~`, or `@`. The first character of an identifier MUST NOT be a decimal digit (`0`-`9`), and the first two characters of an identifier MUST NOT be `-0`. |
53 | 53 |
|
54 | 54 | The first identifier character MAY be a letter `A-Z` or `a-z`, `*`, or one of `/`, `$`, `%`, `&`, `_`, `+`, `|`, `?`, or `-`. If the first identifier character is `-`, the second character MUST be valid as an opening character. Subsequent identifier characters MAY additionally include the decimal digits `0-9`, `*`, and `-`. The exact spelling `-INF` is reserved by [4.3.2](#4-types.html#432-special-values). This permissive ASCII-only character set preserves an unambiguous distinction between identifiers and numeric literals, which MUST begin with a decimal digit. |
55 | 55 |
|
56 | 56 | --- |
57 | 57 |
|
58 | 58 | ### 2.4 Pointer token |
59 | 59 |
|
60 | | -The syntax `@name` MUST form a pointer literal, where `@` is a dedicated lexical token and `name` is an identifier resolved in the current lexical environment. Because `@` is a separate token, it MUST not appear inside identifier names. |
| 60 | +The syntax `@name` MUST form a pointer literal, where `@` is a dedicated lexical token and `name` is an identifier resolved in the current lexical environment. Because `@` is a separate token, it MUST NOT appear inside identifier names. |
61 | 61 |
|
62 | 62 | --- |
63 | 63 |
|
|
0 commit comments