Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re^2: Parse::RecDescent

by ikegami (Patriarch)
on Mar 19, 2009 at 17:20 UTC ( [id://751798]=note: print w/replies, xml ) Need Help??

in reply to Re: Parse::RecDescent
in thread Parse::RecDescent

No, you're right. What's in the top-level curlies ends up being top-level code in the package. My parsers always look like:

use strict; use warnings; my $grammar = <<'__EOI__'; { use strict; use warnings; } ... __EOI__

Note the use of heredocs. Much better than q{} since you don't have to escape some backslashes and some curlies. For example, to have a production match a single backslash,

Single quote heredoc: rule: /\\/
Single quote literal: rule: /\\\/ or rule: /\\\\/

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://751798]
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (6)
As of 2024-04-17 12:44 GMT
Find Nodes?
    Voting Booth?

    No recent polls found