Changeset 3121 for src/pge

Show
Ignore:
Timestamp:
05/12/05 22:17:56 (4 years ago)
Author:
autrijus
svk:copy_cache_prev:
4536
Message:

* revert last change for now as it breaks parrot 0.2.0

Location:
src/pge
Files:
1 removed
1 modified

Legend:

Unmodified
Added
Removed
  • src/pge/PGE/Exp.pir

    r3118 r3121  
    2929 
    3030=cut 
    31  
    32 .include "cclass.pasm" 
    3331 
    3432.namespace [ "PGE::Exp" ] 
     
    488486    $S0 = self."quant"() 
    489487    $S1 = self["literal"] 
    490     $P0 = find_global "Data::Escape", "String" 
    491     $S1 = $P0($S1, "'") 
    492488    emit(code, "\n  %s:  # literal %s", label, $S0) 
    493489    emit(code, "    lit = '%s'", $S1) 
     
    520516    .return self.genliteral(code, label, next) 
    521517  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) 
    525520    emit(code, "    lit = ''") 
    526521    emit(code, "    $P0 = getattribute mob, \"PGE::Match\\x0%:capt\"") 
     
    715710.namespace [ "PGE::Exp::WS" ] 
    716711 
    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  
    731712.sub "gen" method 
    732713    .param pmc code 
     
    739720    emit(code, "    if pos >= lastpos goto %s", next) 
    740721    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") 
    742723    emit(code, "    unless $I0 goto %s_1", label) 
    743724    emit(code, "    $I0 = pos - 1") 
    744     emit(code, "    $I0 = is_cclass %d, target, $I0", .CCLASS_WORD) 
     725    emit(code, "    $I0 = is_wordchar target, $I0") 
    745726    emit(code, "    if $I0 goto fail") 
    746727    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) 
    755734    emit(code, "  %s_2:", label) 
    756735    emit(code, "    if rep == 0 goto %s", next) 
     
    759738    emit(code, "    dec pos") 
    760739    emit(code, "    goto %s_2", label) 
    761   end: 
    762740.end 
    763741