Changeset 22574

Show
Ignore:
Timestamp:
10/11/08 04:53:26 (6 weeks ago)
Author:
putter
Message:

[elfish/rx_on_re] Update to elf_h. Dust README. Delete obsolete EmitRegexYare?.pm. Fixed a bogus classname.

Location:
misc/elfish/rx_on_re
Files:
1 removed
5 modified

Legend:

Unmodified
Added
Removed
  • misc/elfish/rx_on_re/Makefile

    r21458 r22574  
    22check: 
    33        export ELF_STD_RED_RUN=./../../STD_red/STD_red_run 
    4         ../../elf/elf_g test.pm > tst_1 2> tst_2 
     4        ../../elf/elf_h test.pm > tst_1 2> tst_2 
    55        diff t_baseline.result tst_1 
    66        @echo ok 
  • misc/elfish/rx_on_re/README

    r21458 r22574  
    1414Milestones: 
    1515 
    16 () Dev environment and regression testing set up. 
     16(DONE) Dev environment and regression testing set up. 
    1717() P6 version passes t/. 
    1818() P6 version emitting P6 passes t/. 
     
    2020PLAN 
    2121 
    22 () Makefile - a hyrid p6/p5 build; t/ regression test. 
    23 () Node definitions in p6. 
    24 () Migrate analysis methods to p6, one method at a time. 
    25 () Migrate emitter methods to p6. 
     22Unclear. 
     23 
     24OLD PLAN 
     25 
     26(DONE) Makefile - a hyrid p6/p5 build; t/ regression test. 
     27(DONE) Node definitions in p6. 
     28(...) Migrate analysis methods to p6, one method at a time. 
     29(...) Migrate emitter methods to p6. 
    2630() Setup for second translation phase. 
    2731() Migrate emitted code from p5 to p6. 
     
    3337() Implement ratchet. 
    3438() Flesh out and improve. 
    35  
    36 ISSUES 
    37  
    38 () Not sure whether to migrate the p5 grammar or not.  STD.pm doesn't 
    39 currently have one. 
    40  
    41  
    42 NOTES 
    43  
    44 /EmitRegexYare.pm is a leftover from a previous attempt in this direction. 
    45 Bits of it may be of use. 
    46  
    4739 
    4840BASELINE 
     
    7466 
    7567Comments from EmitRegexYare.pm. 
    76 # Backtracking api changes from a Filter::Simple to a s/// method. 
    77 # Engine core becomes a prelude. 
    78 # Emitters become p6, emitting p5 source. 
    79 # IR analysis becomes p6. 
    8068# The regexp and regex parsers are temporarily retained, as some of the action logic will need to end up in IRx1_FromAST or elsewhere. 
    8169# And the unicode rules will need to be metaprogrammed in p6. 
  • misc/elfish/rx_on_re/emit5.pm

    r22235 r22574  
    1414    "}; if(!FAILED(\$__v__)){ ($tmpvars)=($vars); }}; if(!FAILED(\$__v__)){ ($vars)=($tmpvars) }; \$__v__ })" 
    1515  } 
     16  sub replace_LETs { 
     17    my($s)=@_; 
     18    $s =~ s/\bLET\(([^\)]+)\)\{/BacktrackMacrosKludge::_let_gen($1)/eg; 
     19    $s =~ s/\}LET;/BacktrackMacrosKludge::_let_end().";"/eg; 
     20    $s; 
     21  } 
    1622} 
    1723'}; 
     
    2127class EmitRegex { 
    2228 
     29  method expand_LETs($s) is p5 {' BacktrackMacrosKludge::replace_LETs($s) '} 
    2330  method expand_backtrack_macros ($code) { 
    2431 
    25     $code.re_sub('\bLET\(([^\)]+)\)\{','BacktrackMacrosKludge::_let_gen($1)','eg 
    26 '); 
    27     $code.re_sub('\}LET;','BacktrackMacrosKludge::_let_end().";"','eg'); 
    28  
    29     $code.re_sub_g('\bFAIL_IF_FAILED\(([^\)]+)\);','return($1) if FAILED($1);'); 
    30     $code.re_sub_g('\bFAIL\(\)','return(undef)'); 
    31     $code.re_sub_g('\bFAILED\(([^\)]+)\)','(!defined($1)||(!ref($1)&&($1<=0)))') 
     32    $code = $.expand_LETs($code); 
     33    $code.re_sub('\bFAIL_IF_FAILED\(([^\)]+)\);','return($1) if FAILED($1);','g'); 
     34    $code.re_sub('\bFAIL\(\)','return(undef)','g'); 
     35    $code.re_sub('\bFAILED\(([^\)]+)\)','(!defined($1)||(!ref($1)&&($1<=0)))','g') 
    3236; 
    3337 
    34     $code.re_sub_g('\bFAIL_SEQUENCE\(\)','die("fail sequence\\\\n")'); 
    35     $code.re_sub_g('\bFAIL_GROUP\(\)','die("fail group\\\\n")'); 
    36     $code.re_sub_g('\bFAIL_REGEX\(\)','die("fail regex\\\\n")'); 
    37     $code.re_sub_g('\bFAIL_MATCH\(\)','die("fail match\\\\n")'); 
    38  
    39     $code.re_sub_g('\bTAILCALL\(([^,\)]+),?([^\)]*)\);','\@_=($2);goto \&$1;'); 
     38    $code.re_sub('\bFAIL_SEQUENCE\(\)','die("fail sequence\\\\n")','g'); 
     39    $code.re_sub('\bFAIL_GROUP\(\)','die("fail group\\\\n")','g'); 
     40    $code.re_sub('\bFAIL_REGEX\(\)','die("fail regex\\\\n")','g'); 
     41    $code.re_sub('\bFAIL_MATCH\(\)','die("fail match\\\\n")','g'); 
     42 
     43    $code.re_sub('\bTAILCALL\(([^,\)]+),?([^\)]*)\);','\@_=($2);goto \&$1;','g'); 
    4044 
    4145    #print $code; 
     
    11491153    method RMARE_emit () { 
    11501154      my $re = self.<text>; 
    1151       $re.re_sub_g('([^\w\s])','\\\\$1'); 
     1155      $re.re_sub('([^\w\s])','\\\\$1','g'); 
    11521156      $re = $.RMARE_wrap_re_with_mods($re); 
    11531157      $.RMARE_eat_regexp($re); 
  • misc/elfish/rx_on_re/nodes.pm

    r21602 r22574  
    3232 
    3333  } 
    34   class Mod_expr is Mod_Base { 
     34  class Mod_expr is MixinMod { 
    3535    has $.match; 
    3636    has $.mods; 
     
    4848 
    4949  } 
    50   class Mod_inline is Mod_Base { 
     50  class Mod_inline is MixinMod { 
    5151    has $.match; 
    5252    has $.mods; 
  • misc/elfish/rx_on_re/nodes_create.pl

    r21602 r22574  
    100100     
    101101    my $base = 'BaseClass'; 
    102     $base = "${1}_Base" if $name =~ /([^_]+)_/; 
     102    $base = "Mixin${1}" if $name =~ /([^_]+)_/; 
    103103    my $has = join("",map{"has \$.$_;\n        "} @all,'notes'); 
    104104    my $params = join(',',map{"\$$_"}@all);