Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

qq? with regards to Regexp::Grammars

by Anonymous Monk
on Jul 04, 2022 at 21:06 UTC ( [id://11145279]=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Pray tell, what does the "pp?" in the following Regexp::Grammar example do/mean? Searching the docs only turns up Tracking and reporting match positions.

#! /usr/bin/perl use strict; use warnings; use 5.010; use Regexp::Grammars; my $grammar = qr{ <delimited_text> <token: delimited_text> qq? <delim> <text=(.*?)> </delim> | <matchpos> qq? <delim> <error: (?{"Unterminated string starting at index $MATCH{match +pos}"})> <token: delim> [[:punct:]]++ }x; use IO::Prompter; while (my $input = prompt) { if ($input =~ $grammar) { use Data::Show; show %/; } else { say 'Failed: '; say for @!; } }

Thanks!

Replies are listed 'Best First'.
Re: qq? with regards to Regexp::Grammars
by hv (Prior) on Jul 04, 2022 at 21:10 UTC

    That looks like a normal regexp fragment, matching a mandatory literal 'q' followed by an optional literal 'q' as part of attempting to match a perlish construct such as q{single-quoted string} or qq{double-quoted $string}.

      You're so very right --- I thought it was one of Conway's cryptic "notations" that I wasn't able to find!

      <Thanks

        Pointing this out might also help.
        <token: delim> [[:punct:]]++
Re: qq? with regards to Regexp::Grammars
by perlfan (Vicar) on Jul 04, 2022 at 21:29 UTC
    > Pray tell, what does the "pp?"
    Assuming you mean qq??

      Mea culpa! I apologize for my bad eyesight!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (7)
As of 2024-04-26 08:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found