Changeset 2903 for proto/PDF/cb_pablo.py


Ignore:
Timestamp:
Feb 10, 2013, 1:25:26 PM (7 years ago)
Author:
lindanl
Message:

Escape parsing and numeric calculation optimization.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • proto/PDF/cb_pablo.py

    r2902 r2903  
    196196       
    197197def Parse_Escaped(lex, parity, escape_Callouts, out_Callouts):
    198 
    199         odd = parity.odd
    200         even = parity.even
    201 
    202         start = lex.Backslash &~ pablo.Advance(lex.Backslash)
    203        
    204         even_start = start & even       
    205         even_final = pablo.ScanThru(even_start, lex.Backslash)
    206         escape = even_final & odd
    207         escape_char = even & pablo.SpanUpTo(even_start, even_final)
    208        
    209         odd_start = start & odd
    210         odd_final = pablo.ScanThru(odd_start, lex.Backslash)
    211         escape = escape | (odd_final & even)
    212         escape_char |= (odd & pablo.SpanUpTo(odd_start, odd_final))
    213 
    214         escape_Callouts.UELParen = lex.LParen &~ escape
    215         escape_Callouts.UERParen = lex.RParen &~ escape
    216         escape_Callouts.Nonoct = lex.Nonoct & escape   
    217         escape_Callouts.Oct1 = lex.Oct & escape
    218         escape_Callouts.Oct2 = escape_Callouts.Oct1 & pablo.Lookahead(lex.Oct)
    219         escape_Callouts.Oct1 &= ~escape_Callouts.Oct2
    220         escape_Callouts.Oct3 = escape_Callouts.Oct2 & pablo.Lookahead(lex.Oct, 2)
    221         escape_Callouts.Oct2 &= ~escape_Callouts.Oct3
    222         out_Callouts.delmask = escape_char
     198 
     199        escape_Callouts.UELParen = lex.LParen
     200        escape_Callouts.UERParen = lex.RParen
     201        escape_Callouts.Nonoct = 0
     202        escape_Callouts.Oct1 = 0
     203        escape_Callouts.Oct2 = 0
     204        escape_Callouts.Oct3 = 0
     205        out_Callouts.delmask = 0
     206 
     207        if lex.Backslash:
     208
     209          odd = parity.odd
     210          even = parity.even
     211
     212          start = lex.Backslash &~ pablo.Advance(lex.Backslash)
     213         
     214          even_start = start & even     
     215          even_final = pablo.ScanThru(even_start, lex.Backslash)
     216          escape = even_final & odd
     217          escape_char = even & pablo.SpanUpTo(even_start, even_final)
     218         
     219          odd_start = start & odd
     220          odd_final = pablo.ScanThru(odd_start, lex.Backslash)
     221          escape = escape | (odd_final & even)
     222          escape_char |= (odd & pablo.SpanUpTo(odd_start, odd_final))
     223
     224          escape_Callouts.UELParen = lex.LParen &~ escape
     225          escape_Callouts.UERParen = lex.RParen &~ escape
     226          escape_Callouts.Nonoct = lex.Nonoct & escape 
     227          escape_Callouts.Oct1 = lex.Oct & escape
     228          escape_Callouts.Oct2 = escape_Callouts.Oct1 & pablo.Lookahead(lex.Oct)
     229          escape_Callouts.Oct1 &= ~escape_Callouts.Oct2
     230          escape_Callouts.Oct3 = escape_Callouts.Oct2 & pablo.Lookahead(lex.Oct, 2)
     231          escape_Callouts.Oct2 &= ~escape_Callouts.Oct3
     232          out_Callouts.delmask = escape_char
    223233
    224234#def Parse_CommentsLiteralStrings(lex, escaped_Callouts, marker, comments_Callouts, literalStrings_Callouts) :
Note: See TracChangeset for help on using the changeset viewer.