fix: a digit-led right sheet name is read as a sheet range end, not a range operand - #63
Open
gthb wants to merge 1 commit into
Open
fix: a digit-led right sheet name is read as a sheet range end, not a range operand#63gthb wants to merge 1 commit into
gthb wants to merge 1 commit into
Conversation
… range operand Sheet1:1!A1 was read as the sheet range Sheet1..1, and fixRanges wrote it back as 'Sheet1:1'!A1. Excel reads the unquoted pair as a range operation joining the name Sheet1 to '1'!A1, and stores it as Sheet1:'1'!A1. The two name different sheets, so the normalization changed the reference. A digit-led right name now makes the colon a range operator, unless the left name is an integer, which cannot be the range operator's left operand: 1:5!A1 is still a sheet range. Quoting the whole prefix, 'Sheet1:1'!A1, is a sheet range whatever the right name is. Both lexing paths needed the rule, mergeRefTokens for tokenize and pExtendedContext for parseA1Ref, which had disagreed about Jan:2020plan!A1. Two existing tests asserted the old reading on the premise that Excel "will parse and convert them to quoted"; Excel quotes only the endpoint. The A:8 and B:8 cases were dropped as duplicates of X:1. Pinned as a known failure: Jan:2020plan!A1 still lexes 2020plan as the number 2020 followed by the name plan, so fixRanges cannot quote an endpoint it never sees as a prefix.
gthb
added a commit
to gthb/fx
that referenced
this pull request
Sep 3, 2026
borgar#63 rewrites the body of the digit-leading test and appends a new block right after it. Keeping master's title on that test, and putting this branch's new test next to the quoted-RHS test it belongs with, lets the two branches merge without conflict. No change to what is asserted.
gthb
commented
Sep 3, 2026
Comment on lines
+145
to
+146
| test.fails('a digit-leading second sheet name goes to the range operator even when not all digits', () => { | ||
| // Fails today because 2020plan is lexed as the number 2020 followed by the name plan. |
Contributor
Author
There was a problem hiding this comment.
Flips to passing when #62 is merged.
Suggested change
| test.fails('a digit-leading second sheet name goes to the range operator even when not all digits', () => { | |
| // Fails today because 2020plan is lexed as the number 2020 followed by the name plan. | |
| test('a digit-leading second sheet name goes to the range operator even when not all digits', () => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Sheet1:1!A1is read as the sheet rangeSheet1..1, andfixRangeswrites it back as'Sheet1:1'!A1. This differs from Excel, which reads the unquoted pair as a range operation joining the defined nameSheet1to'1'!A1, and stores it asSheet1:'1'!A1.Fix this so a digit-led right name makes the colon a range operator, with two exceptions that keep the sheet range:
1:5!A1'Sheet1:1'!A1Both lexing paths get the rule,
mergeRefTokensfortokenizeandpExtendedContextforparseA1Ref, which had disagreed aboutJan:2020plan!A1.Test changes:
A:8andB:8were dropped as duplicates ofX:1.Jan:2020plan!A1is pinned as a known failure: until fix: a sheet name that begins with digits is lexed as a number and a name #62 lands,2020planlexes as the number2020and the nameplan, sofixRangesnever sees the endpoint as a prefix.