Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (7)
As of 2024-04-19 06:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found