Skip to content

Deal with unsupported special case ranges #71

Description

@borgar

From PR #65:

'Alpha':[Book.xlsx]Gamma!A1 and 'Alpha:Beta':Gamma!A1 fail to parse: "Unexpected context_quote token". Their first name is lexed as a quoted scope but has no ! after it, so it is an operand rather than a scope, and parse has no production for a scope in that position.

These are not really valid expressions, so if we do want to support parsing them we should really fix them under the fixRanges or introduce a new fix function with a broader scope before trying to run them.

'Alpha':[Book.xlsx]Gamma!A1

Excel fixes this to this Alpha:[Book.xlsx]Gamma!A1 (saves it in xlsx mode as Alpha:'[1]Gamma'!A1), meaning that the stray/extra quoted context is converted to a name. This feels like a valid thing to fix, if the name is valid. I do think we should be doing it at the tokenizer level. Fixing these cases seems like something fixRanges could reasonably also do.

'Alpha:Beta':Gamma!A1

This expression is left as-is in Excel (saved in xlsx mode as 'Alpha:Beta':'Gamma'!A1). Excel leaves the 'Alpha:Beta' part just sitting there and at runtime seems to treat it as a name. But this name cannot exist, as names may not contain a quote or a colon, so the expression is meaningless and should be syntactically invalid. It would not surprise me if this were fixed to a syntax error in a future version of Excel. I don't see a good reason for fx to support it.

The best thing we could do to this would be to correct it to Alpha:Beta:Gamma!A1. This seems like a stretch, but would at least make the expression valid/parsable.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions