|Perl: the Markov chain saw|
Dynamic expansion of tokens with Parse::RecDescentby jaldhar (Vicar)
|on Aug 18, 2004 at 20:31 UTC||Need Help??|
jaldhar has asked for the
wisdom of the Perl Monks concerning the following question:
assume I had a Parse::RecDescent grammar that looked in part like this:
now assume in one script that uses this grammar, there was:
while in another script there was:
How would I write the definition for color in the grammer so it would match only valid @colors? There may be many other scripts with different color combinations, and as the second example shows, they can be arbitrary strings with embedded spaces.
I suspect the answer involves having a function in each script like this:
but for some reason I just can't make the connection.