Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion contributors.txt
Original file line number Diff line number Diff line change
Expand Up @@ -280,4 +280,5 @@ YYYY/MM/DD, github id, Full name, email
2020/10/16, adarshbhat, Adarsh Bhat, [email protected]
2020/10/20, adamwojs, Adam Wójs, adam[at]wojs.pl
2020/10/24, cliid, Jiwu Jang, [email protected]
2020/11/05, MichelHartmann, Michel Hartmann, [email protected]
2020/11/05, MichelHartmann, Michel Hartmann, [email protected]
2023/10/26, br0nstein, Aaron Braunstein, aa(last name)@gmail.com
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@ TestTemplates ::= [
"NoViableAltAvoidance": [],
"TokenMismatch2": [],
"TokenMismatch3": [],
"TokenMismatch4": [],
"ExtraneousInput": []
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
TestType() ::= "Parser"

Options ::= [
"Debug": false
]

Grammar ::= [
"T": {<grammar("T")>}
]

Input() ::= "SELECT CONCAT() FROM tbl"

Rule() ::= "s"

Output() ::= <<
(selectStatement (selectQuery SELECT (expr (func CONCAT ( (expr )))) (fromClause FROM tbl)) limitOpt)
Error encountered: [@3,14:14=')',\<7>,1:14]<\n>
>>

Errors() ::= <<
line 1:14 mismatched input ')' expecting {IDENTIFIER, NUMBER}<\n>
>>

grammar(grammarName) ::= <<
grammar <grammarName>;

<ImportVisitor("T")>
<ErrorVisitor("T")>

s
@init {
<BuildParseTrees()>
}
@after {
<ToStringTree("$r.ctx"):writeln()>
<WalkVisitor("$ctx")>
}
: r=selectStatement ;
selectStatement : selectQuery limitOpt ;
selectQuery : 'SELECT' (expr | '*') fromClause? ;
limitOpt : ('LIMIT' NUMBER)? ;
expr : func | IDENTIFIER | NUMBER ;
fromClause : 'FROM' IDENTIFIER ;
func : IDENTIFIER '(' expr ',' expr (',' expr)* ')' ;
parenthesizedSelectQueryOrExpr : '(' (selectQuery limitOpt | expr) ')' ;
IDENTIFIER : [a-zA-Z]+ ;
NUMBER : [1-9][0-9]* ;
WS : [ \r\t\n]+ -> skip ;
>>
3 changes: 3 additions & 0 deletions runtime/Java/src/org/antlr/v4/runtime/atn/LL1Analyzer.java
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,9 @@ protected void _LOOK(@NotNull ATNState s,
calledRuleStack.set(s.ruleIndex);
}
}
if (!PredictionContext.isEmptyLocal(ctx)) {
return;
}
}

int n = s.getNumberOfTransitions();
Expand Down