Ignore:
Timestamp:
Aug 2, 2014, 1:09:52 PM (5 years ago)
Author:
cameron
Message:

Rename bitwise-expr to pablo-expr;add advance expression, pablo-stmt

File:
1 moved

Legend:

Unmodified
Added
Removed
  • proto/charsetcompiler/pablo_expr.py

    r3946 r3947  
    11#
    2 Bitwise Boolean Expressions.
     2Pablo Expressions:  bitwise Boolean Expressions + Advance.
    33#
    44import ast
     
    6262    def __str__(self): return 'Sel(%s, %s, %s)' % (self.sel.__str__(), self.true_branch.__str__(), self.false_branch.__str__())
    6363    def toAST(self): return ast.IfExpr(self.sel.toAST(), self.true_branch.toAST(), self.false_branch.toAST())
     64
     65class Adv(BitwiseExpr):
     66    def __init__(self, expr, n):
     67        self.operand = expr
     68        self.offset = n
     69    def __str__(self): return 'Advance(%s, %i)' % (self.operand.__str__(), self.offset)
     70    def toAST(self): return ast.Call(ast.Attribute(ast.Name('pablo', ast.Load()), 'Advance', ast.Load()), [self.operand.toAST(), ast.Num(self.offset)])
     71
     72
    6473
    6574
     
    200209             else: return False
    201210        else: return False
    202 
    203 
     211    elif isinstance(e1, Adv) and isinstance(e2, Adv):
     212        if e1.offset == e2.offset: return equal_exprs(e1.operand(), e2.operand())
     213        else: return False
     214    else: return False
     215
Note: See TracChangeset for help on using the changeset viewer.