There's more than one way to do things | |
PerlMonks |
Parse::RecDescent and AUTOSTUBby hagus (Monk) |
on Jan 29, 2004 at 08:57 UTC ( [id://324900]=perlquestion: print w/replies, xml ) | Need Help?? |
hagus has asked for the wisdom of the Perl Monks concerning the following question:
I've been playing with a little grammar here to parse SQL "CREATE TABLE" syntax:
At the moment I'm experimenting with AUTOSTUB to get the key_or_not_null bit working. In BNF it looks like: As I understand it, the square braces around PRIMARY indicate that it can be matched "zero or one" times. So I tried "primary"(?) in PRD grammar and that bombed. Now I'm trying primary(?) with AUTOSTUB turned on and that's bombing too. I really don't want to have to make a subrule that just says: But I don't really like the idea of using AUTOSTUB either - it seems kludgy. Ideally I want to be able to say "match this literal string zero or one times". Should I use a regex? Or is there some PRD grammar wisdom that I'm missing?
-- Ash OS durbatulk, ash OS gimbatul, Ash OS thrakatulk, agh burzum-ishi krimpatul! Uzg-Microsoft-ishi amal fauthut burguuli.
Back to
Seekers of Perl Wisdom
|
|