Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
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 chilling in the Monastery: (10)
As of 2014-08-28 11:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (259 votes), past polls