Don't forget you can parameterize rules with subrules. I don't see
any reason you couldn't write a
kind of rule and do whatever you like with the submatched bits.
Larry
Luke Palmer wrote at Thu, 29 Aug 2002 15:21:57 +0200:
>> The ° character doesn't have any special meaning,
>> that's why I choosed it in the above example.
>> However, it also symbolizes a little capturing
>> and as it isn't filled,
>> it could really symbolize an uncapturing.
>
> Interesting id
> The ° character doesn't have any special meaning,
> that's why I choosed it in the above example.
> However, it also symbolizes a little capturing
> and as it isn't filled,
> it could really symbolize an uncapturing.
Interesting idea. I'm not sure if I agree with it yet. However, I don't
agr
Piers wrote:
> Not exactly DWIM, but how about:
>
> my $stuff = /^\s* [ "(.*?)" | (\S+) ] : { $foo := $+ }/;
>
> Assuming $+ means 'the last capture group matched' as it does now.
>
Or just:
my $stuff = /^\s* [ "$foo:=(.*?)" | $foo:=(\S+) ]/;
BTW, that doesn't actually *do* the match
In a message dated Thu, 29 Aug 2002, Janek Schleicher writes:
> Aaron Sherman wrote at Wed, 28 Aug 2002 00:34:15 +0200:
>
> > $stuff = (defined($1)?$1:$2) if /^\s*(?:"(.*?)"|(\S+))/;
>
> It gives me the idea of a missing feature:
>
> What really should be expressed is:
>
> my ($stuff) = /^\s*
Aaron Sherman wrote at Wed, 28 Aug 2002 00:34:15 +0200:
> $stuff = (defined($1)?$1:$2) if /^\s*(?:"(.*?)"|(\S+))/;
It gives me the idea of a missing feature:
What really should be expressed is:
my ($stuff) = /^\s*("°.*?"°|\S+)/;
where the ° character would mean,
"Don't capture the previou
On Thu, 29 Aug 2002, Steffen Mueller wrote:
> Nicholas Clark wrote:
> > On Thu, Aug 29, 2002 at 12:00:55AM +0300, Markus Laire wrote:
> >> And I'm definitely going to try any future PerlGolf challenges also
> >> in perl6.
> >
> > Is it considered better if perl6 use more characters than perl5? (i
On Thu, 29 Aug 2002, Markus Laire wrote:
> (only 32bit numbers, modulo not fully working, no capturing regexps,
> )
Where does modulo break?
/s
Nicholas Clark wrote:
> On Thu, Aug 29, 2002 at 12:00:55AM +0300, Markus Laire wrote:
>> And I'm definitely going to try any future PerlGolf challenges also
>> in perl6.
>
> Is it considered better if perl6 use more characters than perl5? (ie
> implying probably less line noise)
> or less (getting
On Thu, Aug 29, 2002 at 12:00:55AM +0300, Markus Laire wrote:
> And I'm definitely going to try any future PerlGolf challenges also
> in perl6.
Is it considered better if perl6 use more characters than perl5? (ie
implying probably less line noise)
or less (getting your job done more tersely?)
I
On Tue, Aug 27, 2002 at 08:59:09PM -0400, Uri Guttman wrote:
> > "LW" == Larry Wall <[EMAIL PROTECTED]> writes:
>
> LW> On 27 Aug 2002, Uri Guttman wrote: : and quoteline might even
> LW> default to " for its delim which would make : that line:
> LW> :
> LW> : my ($fields) = /(|\S+)/
On 28 Aug 2002 at 16:04, Steffen Mueller wrote:
> Piers Cawley wrote:
> > Uri Guttman <[EMAIL PROTECTED]> writes:
> >> ... regex code ...
> >
> > Hmm... is this the first Perl 6 golf post?
>
> Well, no, for two reasons:
> a) There's whitespace.
> b) The time's not quite ready for Perl6 golf beca
Piers Cawley wrote:
> Uri Guttman <[EMAIL PROTECTED]> writes:
{...]
>> couldn't that be reduced to:
>>
>> m{^\s* $stuff := [ "(.*?)" | (\S+) ] };
>>
>> the | will only return one of the grabbed chunks and the result of
>> the [] group would be assigned to $stuff.
>
> Hmm... is this the first P
In a message dated 28 Aug 2002, Aaron Sherman writes:
> Ok, just to be certain:
>
> $_ = "0";
> my $zilch = /0/ || 1;
>
> Is $zilch C<"0"> or 8?
8? How do you get 8? You'd get a result object which stringified was "0"
and booleanfied was true. So here, you'd get a result object vag
On Wed, 2002-08-28 at 03:23, Trey Harris wrote:
> Note--no parens around $field. We're not "capturing" here, not in the
> Perl 5 sense, anyway.
>
> When a pattern consisting of only a named rule invokation (possibly
> quantified) matches, it returns the result object, which in boolean
> context
In a message dated 27 Aug 2002, Uri Guttman writes:
> > "LW" == Larry Wall <[EMAIL PROTECTED]> writes:
>
> LW> On 27 Aug 2002, Uri Guttman wrote: : and quoteline might even
> LW> default to " for its delim which would make : that line:
> LW> :
> LW> : my ($fields) = /(|\S+)/;
>
> LW
> "LW" == Larry Wall <[EMAIL PROTECTED]> writes:
LW> On 27 Aug 2002, Uri Guttman wrote: : and quoteline might even
LW> default to " for its delim which would make : that line:
LW> :
LW> : my ($fields) = /(|\S+)/;
LW> That just looks like:
LW> my $field = //;
where is the grabb
On 27 Aug 2002, Uri Guttman wrote:
: and quoteline might even default to " for its delim which would make
: that line:
:
: my ($fields) = /(|\S+)/;
That just looks like:
my $field = //;
Larry
On 27 Aug 2002, Uri Guttman wrote:
: > "LW" == Larry Wall <[EMAIL PROTECTED]> writes:
: LW> m{^\s*[
: LW> "$stuff:=(.*?)" |
: LW> $stuff:=(\S+)
: LW> ]};
:
: couldn't that be reduced to:
:
: m{^\s* $stuff := [ "(.*?)" | (\S+) ] };
:
: the | will only ret
> "TH" == Trey Harris <[EMAIL PROTECTED]> writes:
TH> In a message dated 27 Aug 2002, Uri Guttman writes:
>> m{^\s* $stuff := [ "(.*?)" | (\S+) ] };
TH> Or, how about
TH> my ($fields) = /( '"')>|\S+)/;
wouldn't quotelike automatically be inherited from the CORE:: rules like
UNIVE
In a message dated 27 Aug 2002, Uri Guttman writes:
> m{^\s* $stuff := [ "(.*?)" | (\S+) ] };
Or, how about
my ($fields) = /( '"')>|\S+)/;
? :-)
Trey
> "LW" == Larry Wall <[EMAIL PROTECTED]> writes:
LW> That seems like a lot of extra work. I'd prefer to see something like:
LW> my stuff;
LW> m{^\s*[
LW> "$stuff:=(.*?)" |
LW>$stuff:=(\S+)
LW> ]};
couldn't that be reduced to:
m{^\s* $stu
On 27 Aug 2002, Aaron Sherman wrote:
: I just wrote this code in Perl5:
:
: $stuff = (defined($1)?$1:$2) if /^\s*(?:"(.*?)"|(\S+))/;
:
: This is a common practice for me when I parse configuration and data
: files whose formats I define. It's nice to be able to quote fields that
: have space
23 matches
Mail list logo