allows " in [] char set now.

[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9923]
This commit is contained in:
parrt 2012-01-28 10:46:08 -08:00
parent 043afd3767
commit f4ecc75df5
2 changed files with 10 additions and 5 deletions

View File

@ -370,7 +370,7 @@ lexerElements
lexerElement
: labeledLexerElement
| lexerAtom
| subrule
| lexerSubrule
| ACTION {actionInAlt((ActionAST)$ACTION);}
| SEMPRED {sempredInAlt((PredAST)$SEMPRED);}
| ^(ACTION elementOptions) {actionInAlt((ActionAST)$ACTION);}
@ -392,6 +392,7 @@ lexerAtom
| ^(WILDCARD elementOptions)
| WILDCARD
| LEXER_CHAR_SET
| range
;
actionElement
@ -452,6 +453,11 @@ subrule
| block
;
lexerSubrule
: ^(blockSuffix lexerBlock)
| lexerBlock
;
blockSuffix
: ebnfSuffix
;
@ -462,8 +468,7 @@ ebnfSuffix
| POSITIVE_CLOSURE
;
atom: range
| ^(DOT ID terminal)
atom: ^(DOT ID terminal)
| ^(DOT ID ruleref)
| ^(WILDCARD elementOptions) {wildcardRef($WILDCARD);}
| WILDCARD {wildcardRef($WILDCARD);}

View File

@ -310,8 +310,8 @@ public class TestLexerExec extends BaseTest {
String found = execLexer("L.g", grammar, "L", "b\"a");
String expecting =
"A\n" +
"[@0,0:0='9',<3>,1:0]\n" +
"[@1,1:0='<EOF>',<-1>,1:1]\n";
"[@0,0:2='b\"a',<3>,1:0]\n" +
"[@1,3:2='<EOF>',<-1>,1:3]\n";
assertEquals(expecting, found);
}