Skip to content
5 changes: 4 additions & 1 deletion src/alasqlparser.jison
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ SETS return 'SET'
'WHILE' return 'WHILE'
'WITH' return 'WITH'
'WORK' return 'TRANSACTION' /* Is this keyword required? */

(\d+\.?\d*|\.\d+)([eE][+-]?\d+)? return 'NUMBER'
'->' return 'ARROW'
'#' return 'SHARP'
Expand All @@ -291,7 +292,6 @@ SETS return 'SET'
'!=' return 'NE'
'(' return 'LPAR'
')' return 'RPAR'
'@' return 'AT'
'{' return 'LCUR'
'}' return 'RCUR'

Expand All @@ -313,6 +313,7 @@ SETS return 'SET'
'~' return 'TILDA'

[0-9]*[a-zA-Z_]+[a-zA-Z_0-9]* return 'LITERAL'
'@' return 'AT'
<<EOF>> return 'EOF'
. return 'INVALID'

Expand Down Expand Up @@ -1180,6 +1181,8 @@ Column
{ $$ = new yy.Column({columnid: $3, tableid: $1});}
| Literal DOT VALUE
{ $$ = new yy.Column({columnid: $3, tableid: $1});}
| Literal DOT AT Literal
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure this is the original intent? Is the point not to have @ in any part of the name?

also: how does it affect the current graph select notation?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change on line 1184 adds support for qualified column references with @ (e.g., table.@column). This allows accessing JSON columns with @ when using table aliases. For unqualified references, backticks are still required (e.g., `@version`) to avoid conflicts with SQL Server variable syntax (@variable).

Regarding graph select notation: The AT Literal syntax used in graph selectors (lines 651-658) is preserved and unaffected. This change only adds a new alternative in the Column rule for qualified column names.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if the @ is in the middle of the name?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Backticks handle @ anywhere in the column name (beginning, middle, or end). Added test in commit 9c44576 demonstrating this:

  • `col@middle` ✅ works
  • `end@` ✅ works
  • `@start@end` ✅ works

The BRALITERAL token (backticks) accepts any characters, so no grammar changes are needed for this case.

{ $$ = new yy.Column({columnid: '@'+$4, tableid: $1});}
| Literal
{ $$ = new yy.Column({columnid: $1});}
;
Expand Down
Loading
Loading