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 previous
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) =
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. It
On Wed, Aug 28, 2002 at 10:36:54AM -0700, Larry Wall wrote:
That is a worthy consideration, but expressiveness takes precedence
over it in this case. DFAs are really only good for telling you
*whether* and *where* a pattern matches as a whole. They are
relatively useless for telling you
A question: Do rules matched in a { code } block set backtrack points for
the outer rule? For example, are these rules equivalent?
rule expr1 {
term { /operators/ or fail } term
}
rule expr2 {
term operators term
}
And a comment: It would be nice to have procedural control over
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
agree
On Thu, 2002-08-29 at 08:05, Ken Fox wrote:
A question: Do rules matched in a { code } block set backtrack points for
the outer rule? For example, are these rules equivalent?
rule expr1 {
term { /operators/ or fail } term
}
rule expr2 {
term operators term
}
And a
Aaron Sherman wrote:
rule { term { /operators/.commit(1) or fail } term }
The hypothetical commit() method being one that would take a number and
That would only be useful if the outer rule can backtrack into the
inner /operators/ rule. Can it?
I agree with you that a commit method
From: Dan Sugalski [EMAIL PROTECTED]
I actually had something a bit more subversive
in mind, where the assignment operator for the
Date class did some magic the same way we do
now when we do math on strings.
I was thinking a simple general purpose rule. If the variable is
typed, and its class
On Thu, 2002-08-29 at 10:28, Ken Fox wrote:
Aaron Sherman wrote:
rule { term { /operators/.commit(1) or fail } term }
The hypothetical commit() method being one that would take a number and
That would only be useful if the outer rule can backtrack into the
inner /operators/
On Thu, Aug 29, 2002 at 07:52:42AM -0700, Steve Canfield wrote:
From: Dan Sugalski [EMAIL PROTECTED]
I actually had something a bit more subversive
in mind, where the assignment operator for the
Date class did some magic the same way we do
now when we do math on strings.
I was thinking a
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 idea. I'm
Don't forget you can parameterize rules with subrules. I don't see
any reason you couldn't write a
pick (.*?) | (\S+)
kind of rule and do whatever you like with the submatched bits.
Larry
On Thu, 29 Aug 2002, Thomas A. Boyer wrote:
: Am I getting this straight?
As straight as any of us are getting it thus far. :-)
The process is intended to be convergent. That doesn't guarantee it
will converge, but that's the intention.
When I'm playing golf, I always expect to knock the
14 matches
Mail list logo