Skip to content

Allow newlines and tabs as whitespace (#8) - #9

Merged
tonyroberts merged 1 commit into
pyxll:masterfrom
phrrngtn:fix/issue-8-newline-whitespace
Jul 20, 2026
Merged

Allow newlines and tabs as whitespace (#8)#9
tonyroberts merged 1 commit into
pyxll:masterfrom
phrrngtn:fix/issue-8-newline-whitespace

Conversation

@phrrngtn

Copy link
Copy Markdown
Contributor

Fixes #8.

Multi-line formulas (e.g. entered with Alt+Enter) contain \n, \r, and \t characters that the tokenizer previously rejected with an "Unexpected token" error.

Change

  • Add an _is_whitespace() helper recognizing space, \t, \n, and \r, and use it in place of the single-space check in the tokenizer's whitespace-trimming loop.
  • Because whitespace-vs-intersection is decided later in _fix_whitespace_tokens purely from neighbor token types, newlines are handled identically to spaces: dropped when insignificant, promoted to an intersection operator when between two operands.

Tests

  • =SUM(\n\t1,\n\t2\n) tokenizes the same as its single-line form.
  • A newline between two ranges (=A1:A10\nB1:B10) becomes an intersection operator.

🤖 Generated with Claude Code

@tonyroberts
tonyroberts merged commit d742842 into pyxll:master Jul 20, 2026
3 checks passed
@tonyroberts

Copy link
Copy Markdown
Member

@phrrngtn Thanks for the PR!

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.

allow newlines as whitespace in formulas

2 participants