diff --git a/tool/src/org/antlr/v4/parse/ANTLRLexer.g b/tool/src/org/antlr/v4/parse/ANTLRLexer.g index 6e01ae71f..7c89ae2c1 100644 --- a/tool/src/org/antlr/v4/parse/ANTLRLexer.g +++ b/tool/src/org/antlr/v4/parse/ANTLRLexer.g @@ -298,15 +298,16 @@ ARG_ACTION // ACTION : NESTED_ACTION - ('?' {$type = SEMPRED;} )? - ( '=>' // v3 gated sempred - { - Token t = new CommonToken(input, state.type, state.channel, state.tokenStartCharIndex, getCharIndex()-1); - t.setLine(state.tokenStartLine); - t.setText(state.text); - t.setCharPositionInLine(state.tokenStartCharPositionInLine); - grammarError(ErrorType.V3_GATED_SEMPRED, t); - } + ( '?' {$type = SEMPRED;} + ( '=>' // v3 gated sempred + { + Token t = new CommonToken(input, state.type, state.channel, state.tokenStartCharIndex, getCharIndex()-1); + t.setLine(state.tokenStartLine); + t.setText(state.text); + t.setCharPositionInLine(state.tokenStartCharPositionInLine); + grammarError(ErrorType.V3_GATED_SEMPRED, t); + } + )? )? ;