develooper Front page | perl.perl5.porters | Postings from January 2001

Re: Announce : Tokener reporting patch

Thread Previous | Thread Next
From:
Jarkko Hietaniemi
Date:
January 17, 2001 06:51
Subject:
Re: Announce : Tokener reporting patch
Message ID:
20010117085020.I21462@chaos.wustl.edu
> Why is this humungous version of cat interesting? Because of the way it does

So let's call this B::Sabertooth :-)

> it. The C file creates an interpeter, and passes your input to Perl; Perl
> parses it, and the hacked version of toke.c will put information about the
> tokenisation of that file into an array. mangle.c then exports that array to
> @main::toke, and parses and runs mangle.pl, which looks like this:
> 
>     my $oldline = "x";
>     for (@toke) {
>         my ($type, $line, $flags, $text) = split /:/, $_, 4;
>         if ($line ne $oldline) { print "\n"; $oldline=$line; }
>         print $text;
>     }

Nifty.  Could this be turned into a backend?  Say,
perl -MB::Toke -eblah foo.pl would spit out foo.pl as tokens.

-- 
$jhi++; # http://www.iki.fi/jhi/
        # There is this special biologist word we use for 'stable'.
        # It is 'dead'. -- Jack Cohen

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