develooper Front page | perl.perl6.language | Postings from May 2005

Re: comprehensive list of perl6 rule tokens

Thread Previous | Thread Next
From:
Patrick R. Michaud
Date:
May 31, 2005 16:17
Subject:
Re: comprehensive list of perl6 rule tokens
Message ID:
20050531231709.GC26658@pmichaud.com
On Thu, May 26, 2005 at 11:19:42AM -0500, Patrick R. Michaud wrote:
> 	<$rule>		N	indirect rule 
> 	<::$rulename>	N	indirect symbolic rule 
> 	<@rules>	N	like '@rules'
> 	<%rules>	N	like '%rules'
> 	<{ code }>	N	code produces a rule
> 	<&foo()>	N	subroutine returns rule
> 	<( code )>	N	code must return true or backtracking ensues
> 
> Here the leading tokens are actually "<$", "<::$", "<@", "<%", "<{", "<&", 
> and "<(", and I suspect we have "<?$", "<?::$", "<?@", and "<!$", "<!::$",
> "<!@", etc. counterparts.  

Oops.  After re-reading A05 I would now assume we don't have
non-capturing counterparts for <$rule>, <@rules>, <%rules>, ... --
they're already non capturing.  From A05:

    [Update: Only rules of the form <ident> are captured by 
    default. You can use := to force capture of anything else, 
    or the :keepall adverb to capture everything else.]

Somewhere I thought I read that <$rule> captures to $/{'$rule'},
but I don't find it now, so if A05 holds here, then we don't
need "<?$", "<?@", "<?::$", etc.  (Whew!)  Somehow I much prefer
A05's formulation, in that only rules of the form <ident>
capture, and we use aliases or parentheses to capture anything
else.

Thus one can say that <+alpha>, <-alpha>, <[aeiou]>, <!alpha>, <?alpha>, 
<$alpha>, <@alpha>, etc. are all non-capturing constructs.

Pm

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About