Changeset 21213 for misc/pixie/pixie

Show
Ignore:
Timestamp:
07/04/08 13:39:38 (5 months ago)
Author:
pmurias
Message:

[pixie] arrays are marked in the dumps, stranger token names work more often

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • misc/pixie/pixie

    r21126 r21213  
    2525use Encode; 
    2626require 'mangle.pl';  
     27sub ::unmangle { 
     28    local $_ = shift; 
     29    s/Grave/\`/g; 
     30    s/Tilde/\~/g; 
     31    s/Bang/\!/g; 
     32    s/At/\@/g; 
     33    s/Sharp/\#/g; 
     34    s/Dollar/\$/g; 
     35    s/Percent/\%/g; 
     36    s/Caret/\^/g; 
     37    s/Amp/\&/g; 
     38    s/Star/\*/g; 
     39    s/Paren/\(/g; 
     40    s/Thesis/\)/g; 
     41    s/Minus/\-/g; 
     42    s/Plus/\+/g; 
     43    s/Equal/\=/g; 
     44    s/Cur/\{/g; 
     45    s/Ly/\}/g; 
     46    s/Bra/\[/g; 
     47    s/Ket/\]/g; 
     48    s/Vert/\|/g; 
     49    s/Back/\\/g; 
     50    s/Colon/\:/g; 
     51    s/Semi/\;/g; 
     52    s/Single/\'/g; 
     53    s/Double/\"/g; 
     54    s/Lt/\</g; 
     55    s/Gt/\>/g; 
     56    s/Fre/\«/g; 
     57    s/Nch/\»/g; 
     58    s/Comma/\,/g; 
     59    s/Dot/\./g; 
     60    s/Question/\?/g; 
     61    s/Slash/\//g; 
     62    return $_; 
     63#       s/(\W)/sprintf("_%02x_",ord($1))/eg; 
     64} 
    2765use strict; 
    2866use warnings; 
     
    5088 
    5189while (my ($name,$code) = each %actions) { 
    52     $actions{$name} = eval("sub {package pixie_actions;".$code."}"); 
     90    my $str = qq!sub {\npackage pixie_actions;\n#line 1 "action $name"\n!.$code."}"; 
     91    print $str; 
     92    $actions{$name} = eval($str); 
    5393    die "error at pixie_action5, action $name: $@\n" if $@; 
    5494} 
     
    118158        my $tag = shift; 
    119159        $tag =~ s/__S_\d+/:/; 
     160        my $tag = ::unmangle($tag); 
    120161 
    121162        if ($actions{$tag}) { 
    122             print (GREEN,$tag,"\n",RESET) unless $quiet; 
     163            print (GREEN,$tag,RESET,"\n") unless $quiet; 
    123164            local $_ = $self; 
    124165            $actions{$tag}->(); 
    125166            $self; 
    126167        } else { 
    127             print (RED,$tag,"\n",RESET) unless $quiet; 
     168            print (RED,$tag,RESET,"\n") unless $quiet; 
    128169            $self; 
    129170        } 
     
    136177    exit; 
    137178} else { 
    138     print dump_match($what=>$r,{vertical=>1,actions=>sub {Compiler::dump_IRx1(@_)}}),"\n" unless $quiet; 
     179    print dump_match($what=>$r,{vertical=>1,mark_arrays=>1,actions=>sub {Compiler::dump_IRx1(@_)}}),"\n" unless $quiet; 
    139180} 
    140181my $ir = $r->{''};