Damian Conway wrote:

skip:
- We keep :words as shorthand for :skip(/<ws>/)

- And :skip is shorthand for :skip(/<skip>/)

...where <skip> defaults to <ws>, but is distinct from it (i.e. it can be redefined independently).

It also has the benefit that developers redefining <skip> can call <ws> as one of the alternates in their skip rule.

I'm tempted to make <skip> default to [\# \N*|<ws>], considering the number of languages and non-languages that use that commenting form. It provides a useful distinction between the default forms of :words and :skip, and an intelligent default. But, there's potential for confusion if someone is parsing say, a file of phone numbers each pre-pended with "#". (Of course, it could be argued that if they really only want whitespace skipped, they should use :words.)

- <ws> is optional whitespace,

Not quite. <ws> is semi-optional whitespace. More precisely, it's not optional between two identifier characters:

    token ws { <after \w>  \s+  <before \w>
             | <after \w>  \s*  <before \W>
             | <after \W>  \s*
             }

Right, that's "skippy behavior".

 > following skippy behavior (and it always behaves the same no matter
 > what the current :skip pattern is)

Allison

Reply via email to