Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

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"..


It's ok to use

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

Replies are listed 'Best First'.
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?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1032842]
Front-paged by Corion
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2018-03-19 18:48 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (246 votes). Check out past polls.