clarity20 / tql

Terse Query Language
1 stars 0 forks source link

Allow column-name aliasing ("foo AS bar") in the SELECT clause #32

Open clarity20 opened 5 years ago

clarity20 commented 5 years ago

Choose a punctuation character to follow the column name and introduce the alias name. The colon (:) seems good as an early choice. Modify the parser to accept this new syntax in SELECT mode only, and encode the entire sequence as one expandable. The smart expander should operate on the column name only, leaving the overall construct intact. The SQL generator should notice ":bar" and render it as " AS bar".

clarity20 commented 5 years ago

Aliasing should be allowed for all possible selections, not just simple column names. In parsing, treat the suffix ":bar" as an alternative selection-terminator to the comma and to input termination ("$") that needs to be appended as-is to the last token.