From bc2a160b0eb0e46061e02524b2bbcbd0dae31714 Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Thu, 8 Apr 2021 13:10:21 -0400 Subject: =?UTF-8?q?Explicitly=20disallow=20=E2=80=A2=E2=80=A2=20in=20the?= =?UTF-8?q?=20spec?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/spec/token.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/spec/token.html') diff --git a/docs/spec/token.html b/docs/spec/token.html index 5a258422..aee04486 100644 --- a/docs/spec/token.html +++ b/docs/spec/token.html @@ -10,7 +10,7 @@

A BQN character literal consists of a single character between single quotes, such as 'a', and a string literal consists of any number of characters between double quotes, such as "" or "abc". Character and string literals take precedence with comments over other tokenization rules, so that # between quotes does not start a comment and whitespace between quotes is not removed, but a quote within a comment does not start a character literal. Almost any character can be included directly in a character or string literal without escaping. The only exception is the double quote character ", which must be written twice to include it in a string, as otherwise it would end the string instead. Character literals require no escaping at all, as the length is fixed. In particular, literals for the double and single quote characters are written ''' and '"', while length-1 strings containing these characters are "'" and """".

A comment consists of the hash character # and any following text until (not including) the next newline character. The initial # must not be part of a string literal started earlier. Comments are ignored entirely and do not form tokens.

Identifiers and numeric literals share the same token formation rule. These tokens are formed from the numeric characters ¯∞π0123456789 and alphabetic characters _abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ and the oddball 𝕣. Additionally, . is considered a numeric character if it is followed immediately by a digit (0123456789); otherwise it forms its own token. Any sequence of these characters adjacent to each other forms a single token, which is a numeric literal if it begins with a numeric character and an identifier if it begins with an alphabetic character. If a token begins with an underscore then its first non-underscore character must be alphabetic: for example, _99 is not a valid token. Numeric literals are also subject to numeric literal rules, which specify which numeric literals are valid and which numbers they represent. If the token contains 𝕣 it must be either 𝕣, _𝕣, or _𝕣_ and is considered a special name (see below). As the value taken by this identifier can only be a modifier, the uppercase character is not allowed.

-

The system dot always attaches to the token containing the next character, which must not be a whitespace character or #. This combined token is valid only if its name matches a defined system value, ignoring underscores and letter case as with identifiers (but in the unlikely case that system values with numeric names are defined, they need not follow the numeric literal rules). Its role is the same as the role the remainder of the token would have if not preceded by , and it is considered a literal for grammar purposes.

+

The system dot always attaches to the token containing the next character, which must not be a whitespace character, #, or . This combined token is valid only if its name matches a defined system value, ignoring underscores and letter case as with identifiers (but in the unlikely case that system values with numeric names are defined, they need not follow the numeric literal rules). Its role is the same as the role the remainder of the token would have if not preceded by , and it is considered a literal for grammar purposes.

Following these steps, the whitespace characters space and tab are ignored, and do not form tokens. Only these whitespace characters, and the newline character, which does form a token, are allowed.

Otherwise, a single character forms a token. Only the specified set of characters can be used; others result in an error. The classes of characters are given below.

-- cgit v1.2.3