forked from jasder/antlr
revert tokens{} ids to id not just TOKEN_REF. semantic error comes later.
This commit is contained in:
parent
be3a95e8a7
commit
7eaccbc757
|
@ -277,21 +277,21 @@ delegateGrammar
|
|||
;
|
||||
|
||||
tokensSpec
|
||||
: TOKENS_SPEC TOKEN_REF (COMMA TOKEN_REF)* RBRACE -> ^(TOKENS_SPEC TOKEN_REF+)
|
||||
: TOKENS_SPEC id (COMMA id)* RBRACE -> ^(TOKENS_SPEC id+)
|
||||
| TOKENS_SPEC RBRACE ->
|
||||
| TOKENS_SPEC^ v3tokenSpec+ RBRACE!
|
||||
{grammarError(ErrorType.V3_TOKENS_SYNTAX, $TOKENS_SPEC);}
|
||||
;
|
||||
|
||||
v3tokenSpec
|
||||
: TOKEN_REF
|
||||
: id
|
||||
( ASSIGN lit=STRING_LITERAL
|
||||
{
|
||||
grammarError(ErrorType.V3_ASSIGN_IN_TOKENS, $TOKEN_REF,
|
||||
$TOKEN_REF.getText(), $lit.getText());
|
||||
grammarError(ErrorType.V3_ASSIGN_IN_TOKENS, $id.start,
|
||||
$id.text, $lit.getText());
|
||||
}
|
||||
-> TOKEN_REF // ignore assignment
|
||||
| -> TOKEN_REF
|
||||
-> id // ignore assignment
|
||||
| -> id
|
||||
)
|
||||
SEMI
|
||||
;
|
||||
|
|
|
@ -442,7 +442,7 @@ tokenSpec
|
|||
@after {
|
||||
exitTokenSpec($start);
|
||||
}
|
||||
: TOKEN_REF {defineToken($TOKEN_REF);}
|
||||
: ID {defineToken($ID);}
|
||||
;
|
||||
|
||||
action
|
||||
|
|
Loading…
Reference in New Issue