To summarize a phone call today, the more intelligent defaults we add to differently named rule keywords the more comfortable I am with having different names. So, here's what we have so far (posted both as an FYI and to confirm that we have the coherent solution I think we have):

rule:
- Has :ratchet and :skip turned on by default

- May only be used inside a grammar

- Takes default modifiers (a.k.a. traits) from the grammar in which it is defined

- Is inherited by subclasses of a grammar

- The default modifiers can be turned off by :!ratchet and :!skip both for individual rules and for an entire grammar (I'd like to see some syntax for this)


regex:
- Has no modifiers turned on by default

- May be used inside and outside a grammar

- Inside a grammar, it is not inherited by subclasses of the grammar

- Inside a grammar, it does not take default modifiers from the grammar

- Individual regexen can turn on the :ratchet or :skip modifiers


token:
- Has :ratchet turned on by default

- Is inherited by subclasses of a grammar

- Does not take default modifiers from the grammar

- Individual token rules can turn off the :ratchet modifier with :!ratchet, and can turn on :skip

- (I'd still like to see more for token, perhaps some optimizations that are possible when you're certain you have a terminal, like "cannot call subrules")


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

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

- To change skipping behavior: a) override <skip> in your grammar, b) set :skip(/.../) on an individual rule, or c) set 'is skip(/.../)' on a grammar

- <ws> is optional whitespace, following skippy behavior (and it always behaves the same no matter what the current :skip pattern is)

- <sp> is a single character of obligatory whitespace

Allison
--
"E pur si muove!"
    -- apocryphally attributed to Galileo Galilei

Reply via email to