Ken Fox wrote:
> The thing I'd like to do right now is turn on :w
> for all rules. A Fortran grammar might want to turn
> on :i for all rules.
>
> Maybe add modifiers to the grammar declaration?
>
> grammar Fortran :i { ... }
Maybe. Or a property:
grammar Fortran is modified(:i) { ... }
> It would also be convenient to allow the :w
> modifier to have lexically scoped behavior so a
> grammar can change the definition of a word. For
> example, a C grammar might want to skip comments.
>
> Would it be better to create a new (user-defined)
> modifier instead of changing the meaning of :w?
Probably.
> BTW, how do we create user-defined modifiers?
That's yet to be decided. One possibility is that a modifier is
implemented via a special class:
my class Decomment is RULE::Modifier
is invoked(:decomment) {
method SETUP ($data, $rule) {
...
}
# etc.
}
But, as I said, the details aren't worked out.
Or, at least, Larry hasn't revealed them, if they are. ;-)
Damian