Google Groups Home
Help | Sign in
Zero-day rules implementation status in Pugs
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Autrijus Tang  
View profile  
 More options May 9 2005, 1:36 pm
Newsgroups: perl.perl6.compiler
From: autri...@autrijus.org (Autrijus Tang)
Date: Tue, 10 May 2005 01:36:39 +0800
Local: Mon, May 9 2005 1:36 pm
Subject: Zero-day rules implementation status in Pugs

On Mon, May 09, 2005 at 10:51:53PM +1000, Damian Conway wrote:
> Autrijus wrote:

> >/me eagerly awaits new revelation from Damian...

> Be careful what you wish for. Here's draft zero. ;-)

...and here is my status report of the Zero-Day exploit, err,
implementation, in Pugs. :-)

Note that the output from Pugs's interactive command line is in
.perl format.  Patrick++ for designing a nicely designed PGE API!

> =head2 Match objects

~~ returns match object:

    pugs> true(1 ~~ /1/)
    bool::true
    pugs> true(1 ~~ /2/)
    bool::false

$/ gets assigned:

    pugs> 1 ~~ /1/; true $/
    bool::true
    pugs> 1 ~~ /2/; true $/
    bool::false

Match object can take .from, .to and .matches methods:

    pugs> 1 ~~ /1/; ($/.from, $/.to, $/.matches)
    (0, 1, ())

> =head2 Match results

Failed match:

    pugs> "bard" ~~ /food/; (?$/, +$/, ~$/)
    (bool::false, 0.0, '')

Successful match:

    pugs> "bard" ~~ /(ba) $<x> := (rd)/; (?$/, +$/, ~$/, ~$/[0], ~$/<x>)
    (bool::true, 1.0, 'bard', 'ba', 'rd')

> =head2 Subpattern captures

Positional captures:

    pugs> 42 ~~ /(.)/; (~$/[0], ~$1, ~$/<1>, ~$<1>)
    ('4', '4', '4', '4')

Optional captures:

    pugs> 42 ~~ /(50)?/; (?$/[0], ?$1, ?$/<1>, ?$<1>)
    (bool::false, bool::false, bool::false, bool::false)

> =head2 Nested subpattern captures

    pugs> 42 ~~ /(.(.))/; ~$/[0][0]
    '2'

> =head2 Quantified subpattern captures

    pugs> 42 ~~ /(.)*/; ~$/[0][0]
    '4'

> =head2 Indirectly quantified subpattern captures

    pugs> 42 ~~ /[4 (.)]*/; ~$/[0][0]
    '2'

> =head2 Subpattern numbering

    pugs> 42 ~~ /(50) | (42)/; ~$1
    '42'

> =head2 Subrule captures

This should work -- but PGE does not yet have any built-in subrules,
and only the <ident> is given in examples.  Is there a list for all
builtin (global) subrules?

> =head2 Aliasing

    pugs> 42 ~~ /$<match> := (..)/; ~$<match>
    '42'

    pugs> 42 ~~ /$99 := (..)/; ~$99
    '42'

Thanks,
/Autrijus/

  application_pgp-signature_part
< 1K Download

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "Nested captures" by Patrick R. Michaud
Patrick R. Michaud  
View profile  
 More options May 11 2005, 12:10 pm
Newsgroups: perl.perl6.compiler
From: pmich...@pobox.com (Patrick R. Michaud)
Date: Wed, 11 May 2005 11:10:48 -0500
Local: Wed, May 11 2005 12:10 pm
Subject: Re: Nested captures

On Wed, May 11, 2005 at 08:30:42AM -0700, Larry Wall wrote:

> Let's go 0-based and make $0 =:= $/[0] so that $/[] is all the parens.

As Decreed on perl6-language, henceforth PGE shall be using
$0, $1, $2, ... for subpattern captures and aliases into the
match object's array.

Thus It has been Made So (r8062), and there is Great Rejoicing and
Celebration throughout the Lands.

Pm


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google