V3 semantic predicate gate (=>) can only appear after a predicate {...}?, not an action {...}

This commit is contained in:
Sam Harwell 2012-11-18 18:00:19 -06:00
parent 3e91065824
commit aace1ce399
1 changed files with 10 additions and 9 deletions

View File

@ -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);
}
)?
)?
;