On Tue, Mar 13, 2012 at 18:05, Alex Rønne Petersen <xtzgzo...@gmail.com> wrote:

>>> lowerCase <- [a-z]
>>> upperCase <- [A-Z]
>>> Identifier <- (lowerCase / upperCase) (lowerCase / upperCase)*
>>
>>
>> Why not:
>> Identifier <- [a-zA-Z]+
>
>
> That was an illustrative example from the Pegged docs. But yeah, you should
> just use a range; reads nicer.

The docs are for teaching PEG :) (btw, it's the docs describe C-like
identifiers, that's why I chose a longer approach)
It's always this 'tension', between inlining and refactoring.
[a-zA-Z]+ is shorter and more readable. But If you decide to extend
your grammar to UTF-32, it'd be easier to just change the 'letter'
rule.

Reply via email to