[antlr-interest] changed 'x' to "x" for v3
Terence Parr
parrt at cs.usfca.edu
Sun Nov 27 09:07:22 PST 2005
On Nov 26, 2005, at 4:04 PM, Ric Klaren wrote:
>> public void testParserCharLiteralWithEscape() throws
>> Exception {
>> Grammar g = new Grammar(
>> "grammar t;\n"+
>> "a : \"\\n\";\n");
>> Set literals = g.getStringLiterals();
>> // must store literals how they appear in the
>> antlr grammar
>> assertEqual(literals.toArray()[0], "\"\\n\"");
>> }
>
> Just a thought: Isn't it easier then to use single quotes in stead of
> double quotes for everything ? Assuming that double quotes are used
> more often.
Hi Ric. I'm willing to change it to '...' just to make those unit
tests readable again! However, we should focus on what is better for
the people that specify a grammar. Most people will be used to
seeing double quotes for strings but the double quotes around a char
(particularly in a "0".."9" situation) will seem unusual. The other
way, actually might not bother people 'int' and 'begin' actually
immediately make you say "oh, they are using single quote for string
character". Hmm...did I just convince myself to spend 4 hours
changing tests/examples/code to single quotes? Argh! Ok, we better
wait until people come back to work on Monday to decide this. I'm
all ears as we say...suggestions?
What would double quotes be useful for? I guess we reserve that for
the future.
Ter
More information about the antlr-interest
mailing list