ww source: align UTF-8 BOM placement

This commit is contained in:
2026-08-21 20:34:10 +09:00
parent ee4573bf55
commit 9381f8fb8e
11 changed files with 764 additions and 5 deletions

View File

@@ -52,8 +52,13 @@ classes from §2 (`ident`, `int_lit`, …).
### 2.1 Source representation
Source is UTF-8. The lexer operates on bytes; non-ASCII bytes are legal
only inside string and rune literals and comments.
Source is UTF-8. One UTF-8-encoded byte order mark (U+FEFF, bytes
`EF BB BF`) is ignored when it is the first code point of a physical source
file. Its three encoded bytes still count in source positions, so a following
token on the first line begins at column 4. U+FEFF is invalid at
every other source position, including inside string and rune literals and
comments. Apart from that marker rule, the lexer operates on bytes and
non-ASCII bytes are legal only inside string and rune literals and comments.
### 2.2 Comments