in reply to using two Parse::RecDescent parsers together

Can you write a light weight pre-parser that spits stuff to one parser or the other as appropriate? Your sample makes it look like that could be done with a little finessing of the output from the query parser to make it palatable to the template parser.


Perl is Huffman encoded by design.
  • Comment on Re: using two Parse::RecDescent parsers together

Replies are listed 'Best First'.
Re^2: using two Parse::RecDescent parsers together
by halley (Prior) on Aug 12, 2005 at 14:17 UTC
    Aye, I was thinking that if the "template" knew that there was a construct like "query:[ stuffstuffsstuff ]" that it could just absorb it and try to parse it separately in the perl block for that rule.

    However, I'm concerned that "stuffstuffstuff" may need to deal with matching up square brackets and string literals that include brackets, to accurately find the end of the stuff and the close of the query.

    It's much like the magic that Perl must use to identify the proper beginnings and endings of regular expressions in code, all while allowing weirdities like s###. (I hope my case ends up being simpler.)

    --
    [ e d @ h a l l e y . c c ]