Skip to content

Fix SELECT tokenization before parenthesis - #891

Open
RamiNoodle733 wants to merge 2 commits into
andialbrecht:masterfrom
RamiNoodle733:knightwatch-fix-select-parenthesis-775
Open

Fix SELECT tokenization before parenthesis#891
RamiNoodle733 wants to merge 2 commits into
andialbrecht:masterfrom
RamiNoodle733:knightwatch-fix-select-parenthesis-775

Conversation

@RamiNoodle733

Copy link
Copy Markdown

Fixes #775.

SELECT followed immediately by ( is currently caught by the lexer rule that treats a word before a parenthesis as a function name. That means select(select 1) is grouped like a function instead of being parsed equivalently to select (select 1).

This change preserves SELECT as Keyword.DML when that function-name lookahead matches, allowing the following parenthesis to be grouped normally. Other function-like names keep the existing behavior.

A regression test verifies that the no-space form reports statement type SELECT, retains the DML token, and groups the nested query as a Parenthesis.

Validation: the automation environment could not obtain a runnable repository checkout because outbound git access is unavailable, so I did not claim a local pytest run. The branch is based directly on current upstream master (60cdc649) and the diff is limited to the targeted lexer guard and regression test.

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.

Select not recognized if followed by a parenthesis

1 participant