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

Move make_shift_forward into pablo_expr.py

File:
1 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
Note: See TracChangeset for help on using the changeset viewer.