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

Stefan Rank e9725431 at student.tuwien.ac.at
Sun Nov 27 10:34:58 PST 2005


on 27.11.2005 18:07 Terence Parr said the following:
> 
> On Nov 26, 2005, at 4:04 PM, Ric Klaren wrote:
> 
>> 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?

This may be heretic, but what about allowing both variants?
(just as python does)
Then you don't need to escape double quotes inside the string when using 
single quotes and vice versa.

This makes parsing harder, but everyone can choose what looks best, a 
source of error (using the wrong quotes) is eliminated, and the need to 
escape is reduced to the cases where you have both ' and " inside the 
string.

stefan






More information about the antlr-interest mailing list