Hello,
I am
interested in the grammars supporting SQL. However, I found out that grammar
has issues with the join clause. The simple statement "select * from tab_a
inner join tab_b" is interpreted in the way that inner is an alias.
It seems to me that the solution can be to define INNER_JOIN in the lexer.
But this would lead to something like:
SPACES: [ \t\r\n]+ -> channel(HIDDEN);
SINGLE_LINE_COMMENT: '--' ~('\r' | '\n')* NEWLINE_EOF
-> channel(HIDDEN);
MULTI_LINE_COMMENT: '/*' .*? '*/'
-> channel(HIDDEN);
WASTE: (SPACES | SINGLE_LINE_COMMENT | MULTI_LINE_COMMENT)+;
fragment NEWLINE_EOF : NEWLINE | EOF;
fragment QUESTION_MARK : '?';
fragment SIMPLE_LETTER : [A-Z];
fragment FLOAT_FRAGMENT : UNSIGNED_INTEGER* '.'? UNSIGNED_INTEGER+;
fragment NEWLINE : '\r'? '\n';
fragment SPACE : [ \t];
INNER:
'INNER';
JOIN:
'JOIN';
INNER_JOIN: INNER (WASTE)? JOIN;
I don't know if this lexer rule is the proper way to define something like
this. To be honest, I wonder how multi-token commands are parsed in general.
Thank you.
Best regards
Mura.
--
You received this message because you are subscribed to the Google Groups "antlr-discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to antlr-discussi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/antlr-discussion/451ed906-14c9-4db1-8823-0b834f4d30f6n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/antlr-discussion/CAKXLdDAXCOKXXR6Bu12JEheubx-anRuds7AgWStPUS-jx3sZ3w%40mail.gmail.com.