- Timestamp:
- 05/12/05 22:17:56 (4 years ago)
- svk:copy_cache_prev:
- 4536
- Location:
- src/pge
- Files:
-
- 1 removed
- 1 modified
-
PGE/Exp.pir (modified) (6 diffs)
-
cclass.pasm (deleted)
Legend:
- Unmodified
- Added
- Removed
-
src/pge/PGE/Exp.pir
r3118 r3121 29 29 30 30 =cut 31 32 .include "cclass.pasm"33 31 34 32 .namespace [ "PGE::Exp" ] … … 488 486 $S0 = self."quant"() 489 487 $S1 = self["literal"] 490 $P0 = find_global "Data::Escape", "String"491 $S1 = $P0($S1, "'")492 488 emit(code, "\n %s: # literal %s", label, $S0) 493 489 emit(code, " lit = '%s'", $S1) … … 520 516 .return self.genliteral(code, label, next) 521 517 named: 522 $P0 = find_global "Data::Escape", "String" 523 $S1 = $P0(cname) 524 emit(code, "\n %s: # backref $<%s> %s", label, $S1, $S0) 518 $S1 = cname 519 emit(code, "\n %s: # backref $<%s> %s", label, subp, $S1) 525 520 emit(code, " lit = ''") 526 521 emit(code, " $P0 = getattribute mob, \"PGE::Match\\x0%:capt\"") … … 715 710 .namespace [ "PGE::Exp::WS" ] 716 711 717 .sub "analyze" method718 .param pmc next719 .param pmc pad720 .local string nextfc721 self["firstchars"] = ""722 nextfc = next["firstchars"]723 unless nextfc > "" goto end724 $I1 = length nextfc725 $I0 = find_cclass .CCLASS_WHITESPACE, nextfc, 0, $I1726 unless $I0 == $I1 goto end727 self["iscut"] = 1728 end:729 .end730 731 712 .sub "gen" method 732 713 .param pmc code … … 739 720 emit(code, " if pos >= lastpos goto %s", next) 740 721 emit(code, " if pos < 1 goto %s_1", label) 741 emit(code, " $I0 = is_ cclass %d, target, pos", .CCLASS_WORD)722 emit(code, " $I0 = is_wordchar target, pos") 742 723 emit(code, " unless $I0 goto %s_1", label) 743 724 emit(code, " $I0 = pos - 1") 744 emit(code, " $I0 = is_ cclass %d, target, $I0", .CCLASS_WORD)725 emit(code, " $I0 = is_wordchar target, $I0") 745 726 emit(code, " if $I0 goto fail") 746 727 emit(code, " %s_1:", 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") 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) 755 734 emit(code, " %s_2:", label) 756 735 emit(code, " if rep == 0 goto %s", next) … … 759 738 emit(code, " dec pos") 760 739 emit(code, " goto %s_2", label) 761 end:762 740 .end 763 741
