From ea652962ea772407f939be625b5ab2de3855cca7 Mon Sep 17 00:00:00 2001 From: Terence Parr Date: Fri, 28 Sep 2012 16:39:36 -0700 Subject: [PATCH] allow "tokens {}" --- CHANGES.txt | 6 +++++- tool/playground/T.g | 6 +----- tool/src/org/antlr/v4/parse/ANTLRParser.g | 1 + 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index f668f7297..8fe733165 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,9 +1,13 @@ ANTLR v4 Honey Badger +September 28, 2012 + +* empty "tokens {}" is ok now. + September 22, 2012 * Rule exception handlers weren't passed to the generated code * $ruleattribute.foo weren't handled properly * Added -package option -September 18, 2012 -- 4.0b1 release \ No newline at end of file +September 18, 2012 -- 4.0b1 release diff --git a/tool/playground/T.g b/tool/playground/T.g index 6a1ef9b5b..345155ff1 100644 --- a/tool/playground/T.g +++ b/tool/playground/T.g @@ -1,12 +1,8 @@ grammar T; -<<<<<<< .merge_file_0gRgFB -s : A ; -A : 'a'; -======= +tokens {} s : INT+ ; ID : [a-z]+ ; INT : [0-9]+ ; WS : [ \t\n]+ -> skip ; ->>>>>>> .merge_file_bd3U11 diff --git a/tool/src/org/antlr/v4/parse/ANTLRParser.g b/tool/src/org/antlr/v4/parse/ANTLRParser.g index 7c10ae500..401baba2c 100644 --- a/tool/src/org/antlr/v4/parse/ANTLRParser.g +++ b/tool/src/org/antlr/v4/parse/ANTLRParser.g @@ -284,6 +284,7 @@ delegateGrammar */ tokensSpec : TOKENS_SPEC id (COMMA id)* RBRACE -> ^(TOKENS_SPEC id+) + | TOKENS_SPEC RBRACE -> ; // A declaration of a language target specifc section,