Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^2: Parse::RecDescent

by ikegami (Pope)
on Mar 19, 2009 at 17:20 UTC ( #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
Node Status?
node history
Node Type: note [id://751798]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2019-09-21 09:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The room is dark, and your next move is ...












    Results (271 votes). Check out past polls.

    Notices?