revert tokens{} ids to id not just TOKEN_REF. semantic error comes later.

This commit is contained in:
Terence Parr 2012-11-22 10:57:18 -08:00
parent be3a95e8a7
commit 7eaccbc757
2 changed files with 7 additions and 7 deletions

View File

@ -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
;

View File

@ -442,7 +442,7 @@ tokenSpec
@after {
exitTokenSpec($start);
}
: TOKEN_REF {defineToken($TOKEN_REF);}
: ID {defineToken($ID);}
;
action