File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -869,7 +869,7 @@ export const allTokens: TokenType[] = [
869869// Lexer Instance
870870// =============================================================================
871871
872- export const QuestDBLexer = new Lexer ( allTokens )
872+ export const QuestDBLexer = new Lexer ( allTokens , { positionTracking : "full" } )
873873
874874export function tokenize ( input : string ) {
875875 const result = QuestDBLexer . tokenize ( input )
Original file line number Diff line number Diff line change @@ -1403,10 +1403,7 @@ class QuestDBParser extends CstParser {
14031403 private declareAssignment = this . RULE ( "declareAssignment" , ( ) => {
14041404 this . OPTION ( ( ) => this . CONSUME ( Overridable ) )
14051405 this . CONSUME ( VariableReference )
1406- this . OR ( [
1407- { ALT : ( ) => this . CONSUME ( ColonEquals ) } ,
1408- { ALT : ( ) => this . CONSUME ( Equals ) } ,
1409- ] )
1406+ this . CONSUME ( ColonEquals )
14101407 this . SUBRULE ( this . expression )
14111408 } )
14121409
Original file line number Diff line number Diff line change @@ -4720,16 +4720,11 @@ orders PIVOT (sum(amount) FOR status IN ('open'))`
47204720
47214721 // --- Fix 8-10: DECLARE, PARTITION BY WEEK ---
47224722
4723- it ( "should parse DECLARE with variable assignment using equals " , ( ) => {
4723+ it ( "should REJECT DECLARE assignments using `=` (server requires `:=`) " , ( ) => {
47244724 const result = parseToAst (
47254725 "DECLARE @cutoff = '2024-01-01' SELECT * FROM t WHERE ts < @cutoff" ,
47264726 )
4727- expect ( result . errors ) . toHaveLength ( 0 )
4728- const stmt = result . ast [ 0 ] as AST . SelectStatement
4729- expect ( stmt . type ) . toBe ( "select" )
4730- expect ( stmt . declare ) . toBeDefined ( )
4731- expect ( stmt . declare ?. assignments ) . toHaveLength ( 1 )
4732- expect ( stmt . declare ?. assignments [ 0 ] . name ) . toBe ( "cutoff" )
4727+ expect ( result . errors . length ) . toBeGreaterThan ( 0 )
47334728 } )
47344729
47354730 it ( "should parse CREATE MATERIALIZED VIEW with PARTITION BY WEEK" , ( ) => {
You can’t perform that action at this time.
0 commit comments