- Timestamp:
- 10/11/08 04:53:26 (3 months ago)
- Location:
- misc/elfish/rx_on_re
- Files:
-
- 1 removed
- 5 modified
Legend:
- Unmodified
- Added
- Removed
-
misc/elfish/rx_on_re/Makefile
r21458 r22574 2 2 check: 3 3 export ELF_STD_RED_RUN=./../../STD_red/STD_red_run 4 ../../elf/elf_ gtest.pm > tst_1 2> tst_24 ../../elf/elf_h test.pm > tst_1 2> tst_2 5 5 diff t_baseline.result tst_1 6 6 @echo ok -
misc/elfish/rx_on_re/README
r21458 r22574 14 14 Milestones: 15 15 16 ( ) Dev environment and regression testing set up.16 (DONE) Dev environment and regression testing set up. 17 17 () P6 version passes t/. 18 18 () P6 version emitting P6 passes t/. … … 20 20 PLAN 21 21 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. 22 Unclear. 23 24 OLD 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. 26 30 () Setup for second translation phase. 27 31 () Migrate emitted code from p5 to p6. … … 33 37 () Implement ratchet. 34 38 () Flesh out and improve. 35 36 ISSUES37 38 () Not sure whether to migrate the p5 grammar or not. STD.pm doesn't39 currently have one.40 41 42 NOTES43 44 /EmitRegexYare.pm is a leftover from a previous attempt in this direction.45 Bits of it may be of use.46 47 39 48 40 BASELINE … … 74 66 75 67 Comments 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.80 68 # The regexp and regex parsers are temporarily retained, as some of the action logic will need to end up in IRx1_FromAST or elsewhere. 81 69 # And the unicode rules will need to be metaprogrammed in p6. -
misc/elfish/rx_on_re/emit5.pm
r22235 r22574 14 14 "}; if(!FAILED(\$__v__)){ ($tmpvars)=($vars); }}; if(!FAILED(\$__v__)){ ($vars)=($tmpvars) }; \$__v__ })" 15 15 } 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 } 16 22 } 17 23 '}; … … 21 27 class EmitRegex { 22 28 29 method expand_LETs($s) is p5 {' BacktrackMacrosKludge::replace_LETs($s) '} 23 30 method expand_backtrack_macros ($code) { 24 31 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') 32 36 ; 33 37 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'); 40 44 41 45 #print $code; … … 1149 1153 method RMARE_emit () { 1150 1154 my $re = self.<text>; 1151 $re.re_sub _g('([^\w\s])','\\\\$1');1155 $re.re_sub('([^\w\s])','\\\\$1','g'); 1152 1156 $re = $.RMARE_wrap_re_with_mods($re); 1153 1157 $.RMARE_eat_regexp($re); -
misc/elfish/rx_on_re/nodes.pm
r21602 r22574 32 32 33 33 } 34 class Mod_expr is M od_Base{34 class Mod_expr is MixinMod { 35 35 has $.match; 36 36 has $.mods; … … 48 48 49 49 } 50 class Mod_inline is M od_Base{50 class Mod_inline is MixinMod { 51 51 has $.match; 52 52 has $.mods; -
misc/elfish/rx_on_re/nodes_create.pl
r21602 r22574 100 100 101 101 my $base = 'BaseClass'; 102 $base = " ${1}_Base" if $name =~ /([^_]+)_/;102 $base = "Mixin${1}" if $name =~ /([^_]+)_/; 103 103 my $has = join("",map{"has \$.$_;\n "} @all,'notes'); 104 104 my $params = join(',',map{"\$$_"}@all);
