Changeset 4075


Ignore:
Timestamp:
Aug 22, 2014, 10:00:15 AM (5 years ago)
Author:
cameron
Message:

Move make_shift_forward into pablo_expr.py

Location:
proto/charsetcompiler
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • proto/charsetcompiler/pablo_expr.py

    r3978 r4075  
    7171       else: return 'Advance(%s, %i)' % (self.operand.__str__(), self.offset)
    7272    def toAST(self): return ast.Call(ast.Attribute(ast.Name('pablo', ast.Load()), 'Advance', ast.Load()), [self.operand.toAST(), ast.Num(self.offset)])
    73 
    74 
    75 
    7673
    7774#
     
    216213    else: return False
    217214
     215def make_shift_forward(expr, n):
     216    if isinstance(expr, FalseLiteral):
     217        return expr
     218    elif n == 0:
     219        return expr
     220    elif isinstance(expr, Adv):
     221        return Adv(expr.operand, n + expr.offset)
     222    else: return Adv(expr, n)
     223
     224
  • proto/charsetcompiler/unicode_category_compiler.py

    r4071 r4075  
    1616#
    1717# Definitions for debugging/prototyping
    18 def make_shift_forward(e, n): return Adv(e, n)
    1918def make_if(p, s): return ["if %s\n" %p] + ["  " + x for x in s] + ["endif %s\n" %p]
    2019#
Note: See TracChangeset for help on using the changeset viewer.