develooper Front page | perl.perl6.language | Postings from April 2003

Re: alphabet-blind pattern matching (was Ruminating on RFC 93..)

Thread Previous | Thread Next
From:
Jonathan Scott Duff
Date:
April 10, 2003 07:48
Subject:
Re: alphabet-blind pattern matching (was Ruminating on RFC 93..)
Message ID:
20030410094814.C21682@cbi.tamucc.edu
On Wed, Apr 09, 2003 at 06:04:38PM -0600, Luke Palmer wrote:
> So, how does this relate to the discussion at hand?  Well, maybe
> parsers are implemented policy-wise.  Then you could replace the
> default character atom with a Colorific atom.
> 
>     my $colorific_parser = new Parser::RecursiveDescent(
>                                   atom => Colorific );
> 
>     $colorific_parser.parse(@skysamples, /./); # Matches one Colorific
> 
> The method by which is specified probably has to be more powerful than
> that. 

A "Colorific atom" doesn't make sense to me.  It seems to conflate the
thing you want to match against with the criteria you've chosen for
matching.  It's equivalent to saying

	my $p = new Parser::RecursiveDescent( atom => "a" );
	$p.parse(@things, /./);			# matches one "a"

Atoms are things to which you can apply a matching criterion.  "Is it
Colorific?" sounds like a matching criterion and "it" sounds like an
object, so your atoms would be objects, not Colorifics.

> I hope this whet somebody's appetite for abstract thinking.  Patterns
> are just too powerful for text.

Nah, just first pass your object stream through a routine that maps
each object to a string representation of the thing you want to match
against on each object, then apply regular text rules to the string.
:-)

-Scott
-- 
Jonathan Scott Duff
duff@cbi.tamucc.edu

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