Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Perl: porters

Perl 5.18 and Regexp::Grammars

 

 

First page Previous page 1 2 Next page Last page  View All Perl porters RSS feed   Index | Next | Previous | View Threaded


plokinom at gmail

Aug 11, 2013, 4:25 AM

Post #26 of 30 (10 views)
Permalink
Re: Perl 5.18 and Regexp::Grammars [In reply to]

On 11.08.2013 13:09, Dagfinn Ilmari Mannsåker wrote:
> Damian Conway <damian [at] conway> writes:
>
>> Of course, the right solution would be for R::G to set up a *lexical*
>> pseudo-var in each scope where it's imported, but I'm not aware of
>> any reliable way to do that...except by using source filters. :-(
>
> https://metacpan.org/module/Lexical::Var might be of interest?
>

Broken on 5.18.

--
Lukas Mai <plokinom [at] gmail>


pagaltzis at gmx

Aug 11, 2013, 11:22 AM

Post #27 of 30 (10 views)
Permalink
Re: Perl 5.18 and Regexp::Grammars [In reply to]

* Damian Conway <damian [at] conway> [2013-08-11 01:20]:
> And, ideally, the source code fragment being passed into the
> overloading sub would not just be the "contents" of each constant
> construct, but the entire syntax of the construct, including:
>
> - the delimiters used
>
> - any keyword used ('q', 'qq', 'qr', 'qx', 's', 'tr', or 'y')
>
> - any flags used (i.e. in the case of 's', 'tr', and 'y')
>
>
> That is, reworking and extending your own example […] would output:
>
> source(qr/abc(?{})def$x/i)
> source("ABC$a[$b+$c]DEF")
> source(s{foo}{bar}gxms)
> source(0xDeadCode)

Wouldn’t it be better if these paraphernalia were passed in as separate
arguments so that the Perl code won’t have to implement its own parsing
on top of perl’s?

--
Aristotle Pagaltzis // <http://plasmasturm.org/>


davem at iabyn

Aug 12, 2013, 5:44 AM

Post #28 of 30 (8 views)
Permalink
Re: Perl 5.18 and Regexp::Grammars [In reply to]

On Sun, Aug 11, 2013 at 08:22:06PM +0200, Aristotle Pagaltzis wrote:
> * Damian Conway <damian [at] conway> [2013-08-11 01:20]:
> > And, ideally, the source code fragment being passed into the
> > overloading sub would not just be the "contents" of each constant
> > construct, but the entire syntax of the construct, including:
> >
> > - the delimiters used
> >
> > - any keyword used ('q', 'qq', 'qr', 'qx', 's', 'tr', or 'y')
> >
> > - any flags used (i.e. in the case of 's', 'tr', and 'y')
> >
> >
> > That is, reworking and extending your own example […] would output:
> >
> > source(qr/abc(?{})def$x/i)
> > source("ABC$a[$b+$c]DEF")
> > source(s{foo}{bar}gxms)
> > source(0xDeadCode)
>
> Wouldn’t it be better if these paraphernalia were passed in as separate
> arguments so that the Perl code won’t have to implement its own parsing
> on top of perl’s?

Sorry, I don't understand the question.

--
Red sky at night - gerroff my land!
Red sky at morning - gerroff my land!
-- old farmers' sayings #14


demerphq at gmail

Aug 12, 2013, 6:36 AM

Post #29 of 30 (7 views)
Permalink
Re: Perl 5.18 and Regexp::Grammars [In reply to]

On 12 August 2013 14:44, Dave Mitchell <davem [at] iabyn> wrote:
> On Sun, Aug 11, 2013 at 08:22:06PM +0200, Aristotle Pagaltzis wrote:
>> * Damian Conway <damian [at] conway> [2013-08-11 01:20]:
>> > And, ideally, the source code fragment being passed into the
>> > overloading sub would not just be the "contents" of each constant
>> > construct, but the entire syntax of the construct, including:
>> >
>> > - the delimiters used
>> >
>> > - any keyword used ('q', 'qq', 'qr', 'qx', 's', 'tr', or 'y')
>> >
>> > - any flags used (i.e. in the case of 's', 'tr', and 'y')
>> >
>> >
>> > That is, reworking and extending your own example […] would output:
>> >
>> > source(qr/abc(?{})def$x/i)
>> > source("ABC$a[$b+$c]DEF")
>> > source(s{foo}{bar}gxms)
>> > source(0xDeadCode)
>>
>> Wouldn’t it be better if these paraphernalia were passed in as separate
>> arguments so that the Perl code won’t have to implement its own parsing
>> on top of perl’s?
>
> Sorry, I don't understand the question.

I think he means something like this:

source( $quote, $start_delim1, $end_delim1, $modifiers, $text1,
$start_delim2, $end_delim2, $text2 );

ie:

source('qr', '/', '/', 'x', 'abc(?{})def$', undef, undef, undef); #
qr/abc(?{})def$/
source('s', '{','}', 'gxms', 'foo', '{','}', "bar");
# s{foo}{bar}gxms
source('tr','/','/','dc','abc','/','/','def');
# tr/abc/efg/dc

I have no idea what to do with "0xDeadCode".

Also one wonders if:

qq"foo"

and

"foo"

should be treated as the same thing or not. I could see:

source('qq','"','"',undef,'foo'); # qq"foo"
source('"','"','"',undef,'foo'); # "foo"

Yves

--
perl -Mre=debug -e "/just|another|perl|hacker/"


pagaltzis at gmx

Aug 12, 2013, 11:04 AM

Post #30 of 30 (4 views)
Permalink
Re: Perl 5.18 and Regexp::Grammars [In reply to]

* demerphq <demerphq [at] gmail> [2013-08-12 15:40]:
> I think he means something like this:
>
> source( $quote, $start_delim1, $end_delim1, $modifiers, $text1,
> $start_delim2, $end_delim2, $text2 );

Yes.

First page Previous page 1 2 Next page Last page  View All Perl porters RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.