Skip to content

Commit

Permalink
Strings are only Single quote, Database stuff is Double quote
Browse files Browse the repository at this point in the history
  • Loading branch information
mariusandra committed Feb 7, 2023
1 parent f33cad9 commit 670d1f5
Show file tree
Hide file tree
Showing 6 changed files with 714 additions and 724 deletions.
9 changes: 2 additions & 7 deletions posthog/hogql/grammar/HogQLLexer.g4
Original file line number Diff line number Diff line change
Expand Up @@ -212,12 +212,10 @@ ESCAPE_CHAR
| BACKSLASH BACKSLASH
| BACKSLASH QUOTE_SINGLE;

// ClickHouse supports identifier with double quotes and back quotes (select from "table"; select from `table`)
// HogQL only uses backquotes. Double quotes and single quotes are used in strings.
// This is to make query editing in the UI nicer by supporting intuitive syntax like: event == "$pageview"
IDENTIFIER
: (LETTER | UNDERSCORE | DOLLAR) (LETTER | UNDERSCORE | DEC_DIGIT | DOLLAR)*
| BACKQUOTE ( ~([\\`]) | ESCAPE_CHAR | (BACKQUOTE BACKQUOTE) )* BACKQUOTE
| QUOTE_DOUBLE ( ~([\\"]) | ESCAPE_CHAR | (QUOTE_DOUBLE QUOTE_DOUBLE) )* QUOTE_DOUBLE
;
FLOATING_LITERAL
: HEXADECIMAL_LITERAL DOT HEX_DIGIT* (P | E) (PLUS | DASH)? DEC_DIGIT+
Expand All @@ -231,10 +229,7 @@ DECIMAL_LITERAL: DEC_DIGIT+;
HEXADECIMAL_LITERAL: '0' X HEX_DIGIT+;
// It's important that quote-symbol is a single character.
STRING_LITERAL
: QUOTE_SINGLE ( ~([\\']) | ESCAPE_CHAR | (QUOTE_SINGLE QUOTE_SINGLE) )* QUOTE_SINGLE
| QUOTE_DOUBLE ( ~([\\"]) | ESCAPE_CHAR | (QUOTE_DOUBLE QUOTE_DOUBLE) )* QUOTE_DOUBLE
;
STRING_LITERAL: QUOTE_SINGLE ( ~([\\']) | ESCAPE_CHAR | (QUOTE_SINGLE QUOTE_SINGLE) )* QUOTE_SINGLE;
// Alphabet and allowed symbols
Expand Down
2 changes: 1 addition & 1 deletion posthog/hogql/grammar/HogQLLexer.interp

Large diffs are not rendered by default.

Loading

0 comments on commit 670d1f5

Please sign in to comment.