Skip to content

fix: unquoted name with non-first high character#50

Open
gthb wants to merge 2 commits into
borgar:masterfrom
gthb:fix-non-ascii-sheet-or-name
Open

fix: unquoted name with non-first high character#50
gthb wants to merge 2 commits into
borgar:masterfrom
gthb:fix-non-ascii-sheet-or-name

Conversation

@gthb

@gthb gthb commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Fix bug: fræði!A1 tokenizes as fr + æði!A1 instead of one reference. Likewise fræði (as a name reference) tokenizes as fr + æði.

Cause: in lexNameFuncCntx the loop checks the token's first character s against the high-char range (s > 180) but indexes ALLOWED with the current character c.

Names that start with a high character (æði) are unaffected, because s > 180 is true for them. That is why existing tests did not catch this.

For a name that starts with an ASCII character, s > 180 is false, so a later high character (e.g. æ, code 230) indexes ALLOWED out of bounds, resulting in undefined, which is falsy, so the name splits at that character.

Fix: correct the loop to check the current character c, not the initial character s, against the high-char range.

gthb added 2 commits July 16, 2026 08:17
Reproduce bug: `fræði!A1` tokenizes as `fr` + `æði!A1` instead of one
reference. Likewise `fræði` (as a name reference) tokenized as `fr` + `æði`.

Cause: in `lexNameFuncCntx` the loop tests the token's _first_ character `s`
against the high-char range (`s > 180`) but indexes `ALLOWED` with the
_current_ character `c`.

Names that _start_ with a high character (`æði`) are OK, because `s > 180` is
true for them.

For a name that starts with an ASCII character, `s > 180` is false, so a later
high character (e.g. æ, code 230) indexes `ALLOWED` out of bounds, resulting in
`undefined`, treated as invalid, and the name splits at that character.
Correct the loop to check the current character `c`, not the initial character
`s`, against the high-char range.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant