Changeset 3118 for src/pge

Show
Ignore:
Timestamp:
05/12/05 21:39:48 (4 years ago)
Author:
autrijus
svk:copy_cache_prev:
4536
Message:

* sync pge

Location:
src/pge
Files:
1 added
2 modified

Legend:

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

    r3079 r3118  
    2929 
    3030=cut 
     31 
     32.include "cclass.pasm" 
    3133 
    3234.namespace [ "PGE::Exp" ] 
     
    486488    $S0 = self."quant"() 
    487489    $S1 = self["literal"] 
     490    $P0 = find_global "Data::Escape", "String" 
     491    $S1 = $P0($S1, "'") 
    488492    emit(code, "\n  %s:  # literal %s", label, $S0) 
    489493    emit(code, "    lit = '%s'", $S1) 
     
    516520    .return self.genliteral(code, label, next) 
    517521  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) 
    520525    emit(code, "    lit = ''") 
    521526    emit(code, "    $P0 = getattribute mob, \"PGE::Match\\x0%:capt\"") 
     
    710715.namespace [ "PGE::Exp::WS" ] 
    711716 
     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 
    712731.sub "gen" method 
    713732    .param pmc code 
     
    720739    emit(code, "    if pos >= lastpos goto %s", next) 
    721740    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) 
    723742    emit(code, "    unless $I0 goto %s_1", label) 
    724743    emit(code, "    $I0 = pos - 1") 
    725     emit(code, "    $I0 = is_wordchar target, $I0") 
     744    emit(code, "    $I0 = is_cclass %d, target, $I0", .CCLASS_WORD) 
    726745    emit(code, "    if $I0 goto fail") 
    727746    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") 
    734755    emit(code, "  %s_2:", label) 
    735756    emit(code, "    if rep == 0 goto %s", next) 
     
    738759    emit(code, "    dec pos") 
    739760    emit(code, "    goto %s_2", label) 
     761  end: 
    740762.end 
    741763 
  • src/pge/PGE/Hs.pir

    r3079 r3118  
    122122    .local int tmpi, cond 
    123123    .local string tmps, key 
    124     .local pmc capt, iter, elm, escape, is_array 
     124    .local pmc capt, iter, subelm, elm, escape, is_array 
    125125 
    126126    out = "" 
     
    192192    if is_array goto dumper_array 
    193193    unless ari < arc goto dumper_fail 
    194     elm = elm[-1] 
    195     tmps = elm."dump_hs"() 
     194    subelm = elm[-1] 
     195    tmps = subelm."dump_hs"() 
    196196    out .= tmps 
    197197    ret 
     
    210210    out .= ", " 
    211211  dumper_array_body: 
    212     elm = elm[ari] 
    213     tmps = elm."dump_hs"() 
     212    subelm = elm[ari] 
     213    tmps = subelm."dump_hs"() 
    214214    out .= tmps 
    215215    inc ari