[DGD] Search and replace with parse_string?

Krister Svanlund krister.svanlund at gmail.com
Fri Jul 23 23:29:46 CEST 2010


On Fri, Jul 23, 2010 at 11:17 PM, Felix A. Croes <felix at dworkin.nl> wrote:
> Krister Svanlund <krister.svanlund at gmail.com> wrote:
>
>> Continuing on the same theme! I've written this grammar that works for
>> a color string (such as "RED!") but not for a movement string such as
>> "<5" or "^". Movement strings only gives a nil return value and the
>> "showthis" function is never called.
>>
>> mod   = /[!_]/
>> move  = /[v<>\^]/
>> word  = /[A-Z]+/
>> nr    = /[0-9]+/
>> color : word
>> color : color mod
>> movem : move ?showthis
>> movem : movem nr
>
> The first production rule defines the start symbol for the grammar,
> which in this case is 'color'.  'movem' cannot be reached from there.
>
> Regards,
> Felix Croes

Hmm, yeah, I seem to have figured that out just a moment ago my
accident. Thanks for the help anyway :)



More information about the DGD mailing list