fix(bigquery): support @@ system variables in lexer#2529
Conversation
|
Hey 👋 Thank you for the contribution! While this is correct, it would be better to distinguish between In BigQuery, SQLFluff introduced this in sqlfluff/sqlfluff#5307, where they define two separate lexer matchers: RegexLexer(
"at_sign_literal",
r"@[a-zA-Z_][\w]*",
...
),
RegexLexer(
"double_at_sign_literal",
r"@@[a-zA-Z_][\w\.]*",
...
),Along with a dedicated It would be great to follow this pattern here — adding a separate |
BigQuery supports both @param and @@system_variable syntax. The lexer regex only matched single @ prefixes, causing @@var to be split into two tokens. This produced unwanted line breaks during formatting (e.g. `SET foo = \n@@bar;`) and parse errors in CALL statements using system variables like @@error.message. Widen the at_sign_literal regex from `@[a-zA-Z_][\w]*` to `@{1,2}[a-zA-Z_][\w.]*` to match both forms in a single token, with dot support for qualified names like @@error.message.
5bdca04 to
16c8e01
Compare
|
@benfdking thanks for the feedback. Let me know if I got the |
BigQuery supports both @param and @@system_variable syntax. The lexer regex only matched single @ prefixes, causing @@var to be split into two tokens. This produced unwanted line breaks during formatting (e.g.
SET foo = \n@@bar;) and parse errors in CALL statements using system variables like @@error.message.Widen the at_sign_literal regex from
@[a-zA-Z_][\w]*to@{1,2}[a-zA-Z_][\w.]*to match both forms in a single token, with dot support for qualified names like @@error.message.