Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Regexp::Grammars parser from scalar

by nyaapa (Novice)
on May 09, 2013 at 20:44 UTC ( #1032842=perlquestion: print w/ replies, xml ) Need Help??
nyaapa has asked for the wisdom of the Perl Monks concerning the following question:

Hi, monks

How can i generate a Regexp::Grammars parser from file/scalar?

I use

my $str = " ^ <$start_rule> \$ $rules "; my $link = bless(\$str, 'Regexp::Grammars::Precursor'); $parser = qr{$link}ixs;
but i dont like this "hack"..

Update

It's ok to use

my $str = " ^ <$start_rule> \$ $rules "; $parser = qr{$link }ixs;

Comment on Regexp::Grammars parser from scalar
Select or Download Code
Re: Regexp::Grammars parser from scalar
by jakeease (Friar) on May 10, 2013 at 04:01 UTC

    There's lots of example code and explanation on CPAN: Regexp::Grammars

    Perhaps a little more about what you want to do?

      yep, it's true, but
      1. i cant use my $regexp = qr{$pattern}ixs, i need to write my $regexp = qr{$pattern }ixs because of caching
      2. there was a bug before version 1.028 with caching of post-translated regexes and because of it i thought that i cant use form like
        $regexp = qr{ ^ <$rule> $ $rules }ixs;
      thanks however )
Re: Regexp::Grammars parser from scalar
by Anonymous Monk on May 11, 2013 at 08:44 UTC
      thanks, i found that i couldn't use form like
      my $str = " ^ <$start_rule> \$ $rules "; $parser = qr{$link }ixs;
      because of a bug :)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1032842]
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2015-07-04 05:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (57 votes), past polls