Re: Hypothetical synonyms

2002-08-29 Thread Janek Schleicher
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

Capturing alternations (was Re: Hypothetical synonyms)

2002-08-29 Thread Trey Harris
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) =

Re: Capturing alternations (was Re: Hypothetical synonyms)

2002-08-29 Thread Damian Conway
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

Re: Does ::: constrain the pattern engine implementation?

2002-08-29 Thread Jerome Vouillon
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

backtracking into { code }

2002-08-29 Thread Ken Fox
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

Re: Hypothetical synonyms

2002-08-29 Thread Luke Palmer
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

Re: backtracking into { code }

2002-08-29 Thread Aaron Sherman
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

Re: backtracking into { code }

2002-08-29 Thread Ken Fox
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

Re: auto deserialization

2002-08-29 Thread Steve Canfield
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

Re: backtracking into { code }

2002-08-29 Thread Aaron Sherman
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/

Re: auto deserialization

2002-08-29 Thread Nicholas Clark
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

Re: Hypothetical synonyms

2002-08-29 Thread Janek Schleicher
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

Re: Hypothetical synonyms

2002-08-29 Thread Larry Wall
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

Re: declaring if and while (was: rule, rx and sub)

2002-08-29 Thread Larry Wall
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