- Timestamp:
- 05/12/05 21:39:48 (4 years ago)
- svk:copy_cache_prev:
- 4536
- Location:
- src/pge
- Files:
-
- 1 added
- 2 modified
-
PGE/Exp.pir (modified) (6 diffs)
-
PGE/Hs.pir (modified) (3 diffs)
-
cclass.pasm (added)
Legend:
- Unmodified
- Added
- Removed
-
src/pge/PGE/Exp.pir
r3079 r3118 29 29 30 30 =cut 31 32 .include "cclass.pasm" 31 33 32 34 .namespace [ "PGE::Exp" ] … … 486 488 $S0 = self."quant"() 487 489 $S1 = self["literal"] 490 $P0 = find_global "Data::Escape", "String" 491 $S1 = $P0($S1, "'") 488 492 emit(code, "\n %s: # literal %s", label, $S0) 489 493 emit(code, " lit = '%s'", $S1) … … 516 520 .return self.genliteral(code, label, next) 517 521 named: 518 $S1 = cname 519 emit(code, "\n %s: # backref $<%s> %s", label, subp, $S1) 522 $P0 = find_global "Data::Escape", "String" 523 $S1 = $P0(cname) 524 emit(code, "\n %s: # backref $<%s> %s", label, $S1, $S0) 520 525 emit(code, " lit = ''") 521 526 emit(code, " $P0 = getattribute mob, \"PGE::Match\\x0%:capt\"") … … 710 715 .namespace [ "PGE::Exp::WS" ] 711 716 717 .sub "analyze" method 718 .param pmc next 719 .param pmc pad 720 .local string nextfc 721 self["firstchars"] = "" 722 nextfc = next["firstchars"] 723 unless nextfc > "" goto end 724 $I1 = length nextfc 725 $I0 = find_cclass .CCLASS_WHITESPACE, nextfc, 0, $I1 726 unless $I0 == $I1 goto end 727 self["iscut"] = 1 728 end: 729 .end 730 712 731 .sub "gen" method 713 732 .param pmc code … … 720 739 emit(code, " if pos >= lastpos goto %s", next) 721 740 emit(code, " if pos < 1 goto %s_1", label) 722 emit(code, " $I0 = is_ wordchar target, pos")741 emit(code, " $I0 = is_cclass %d, target, pos", .CCLASS_WORD) 723 742 emit(code, " unless $I0 goto %s_1", label) 724 743 emit(code, " $I0 = pos - 1") 725 emit(code, " $I0 = is_ wordchar target, $I0")744 emit(code, " $I0 = is_cclass %d, target, $I0", .CCLASS_WORD) 726 745 emit(code, " if $I0 goto fail") 727 746 emit(code, " %s_1:", label) 728 emit(code, " if pos >= lastpos goto %s_2", label) 729 emit(code, " $I0 = is_whitespace target, pos") 730 emit(code, " unless $I0 goto %s_2", label) 731 emit(code, " inc rep") 732 emit(code, " inc pos") 733 emit(code, " goto %s", label) 747 $I0 = self["iscut"] 748 unless $I0 goto backtrack 749 emit(code, " pos = find_not_cclass %d, target, pos, lastpos", .CCLASS_WHITESPACE) 750 emit(code, " goto %s", next) 751 goto end 752 backtrack: 753 emit(code, " rep = $I0 - pos") 754 emit(code, " pos = $I0") 734 755 emit(code, " %s_2:", label) 735 756 emit(code, " if rep == 0 goto %s", next) … … 738 759 emit(code, " dec pos") 739 760 emit(code, " goto %s_2", label) 761 end: 740 762 .end 741 763 -
src/pge/PGE/Hs.pir
r3079 r3118 122 122 .local int tmpi, cond 123 123 .local string tmps, key 124 .local pmc capt, iter, elm, escape, is_array124 .local pmc capt, iter, subelm, elm, escape, is_array 125 125 126 126 out = "" … … 192 192 if is_array goto dumper_array 193 193 unless ari < arc goto dumper_fail 194 elm = elm[-1]195 tmps = elm."dump_hs"()194 subelm = elm[-1] 195 tmps = subelm."dump_hs"() 196 196 out .= tmps 197 197 ret … … 210 210 out .= ", " 211 211 dumper_array_body: 212 elm = elm[ari]213 tmps = elm."dump_hs"()212 subelm = elm[ari] 213 tmps = subelm."dump_hs"() 214 214 out .= tmps 215 215 inc ari
