From aace1ce399e74e964c57f58522c4a961edd4fa56 Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Sun, 18 Nov 2012 18:00:19 -0600 Subject: [PATCH] V3 semantic predicate gate (=>) can only appear after a predicate {...}?, not an action {...} --- tool/src/org/antlr/v4/parse/ANTLRLexer.g | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) 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); + } + )? )? ;