in reply to Parse::RecDescent greedy matches
"I'm working on a grammar to parse SQL"
Any particular reason? Is this just a learning exercise, or are you doing it because you actually need to parse some SQL? If the latter, stop doing what you're doing, and use SQL::Statement instead.
If you're just trying to learn PRD, then here's a hint... alias is probably defined something like this:
alias: identifier identifier: /.../ # some regex
To the production for identifier you need to add an action which rejects illegal identifiers:
alias: identifier identifier: /.../ # some regex { if ($item{identifier} =~ /^(?:select|insert|from|as)$/i) { undef } else { 1 } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Parse::RecDescent greedy matches
by zuma53 (Beadle) on Jul 25, 2012 at 18:15 UTC | |
by zuma53 (Beadle) on Jul 31, 2012 at 05:20 UTC |