[antlr-interest] changed 'x' to "x" for v3

Prashant Deva prashant.deva at gmail.com
Sun Nov 27 05:33:58 PST 2005


Also to type a double quote you need to press the shift key+quote key while
for the single quote you just press the quote key ;-)

On 11/27/05, Ric Klaren <ric.klaren at gmail.com> wrote:
>
> On 11/26/05, Terence Parr <parrt at cs.usfca.edu> wrote:
> > Next time you grab a release of ANTLR v3, you'll note that all char
> > literals must be string literals.  All unit tests and examples have
> > changed.  So, you'll now do
> >
> > INT : "0".."9"+ ;
> >
> > instead of
> >
> > INT : '0'..'9'+ ;
> >
> > I thought a lot about this and I just can't justify wasting single
> > quotes on char literals; it's actually easier to say that all
> > literals matched are in double quotes.   Made a number of routines
> > easier in ANTLR.
> >
> > The only negative so far is that all the unit tests have grammars
> > that are String literals in the Java program and so the grammars have
> > to have the double quote escaped.  This is hideous, but I'm not sure
> > we have a choice.  Here's a taste:
> >
> >         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.
>
> Ric
>



--
Prashant Deva
Creator, ANTLR Studio,www.antlrstudio.com
Founder, Placid Systems, www.placidsystems.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20051127/ca39e23d/attachment.html


More information about the antlr-interest mailing list