Changeset 3947
- Timestamp:
- Aug 2, 2014, 1:09:52 PM (5 years ago)
- Location:
- proto/charsetcompiler
- Files:
-
- 1 added
- 3 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
proto/charsetcompiler/CC_compiler.py
r3944 r3947 7 7 Encoding_Type = UTF_encoding.UTF_Encoding_Type 8 8 9 from bitwise_expr import *9 from pablo_expr import * 10 10 11 11 class CC_compiler(): -
proto/charsetcompiler/charset_compiler.py
r3943 r3947 37 37 Encoding_Type = UTF_encoding.UTF_Encoding_Type 38 38 39 from bitwise_expr import *39 from pablo_expr import * 40 40 from CC_compiler import * 41 41 -
proto/charsetcompiler/charset_compiler2.py
r3942 r3947 42 42 import charset_input_parser 43 43 44 from bitwise_expr import * 44 import UTF_encoding 45 Encoding_Type = UTF_encoding.UTF_Encoding_Type 46 47 from pablo_expr import * 45 48 46 49 def bit_var(n): … … 371 374 # Option definition 372 375 option_parser = optparse.OptionParser(usage='python %prog [options] <input file>', version='0.8') 373 376 377 option_parser.add_option('-u', '--character_encoding', 378 dest='character_encoding', 379 type='string', 380 default='Default', 381 help='character encoding; default: UTF-8', 382 ) 374 383 option_parser.add_option('-b', '--basis_pattern', 375 384 dest='basis_pattern', … … 378 387 help='pattern for basis bit streams; default: basis_bits.bit_%i', 379 388 ) 389 option_parser.add_option('-l', '--little_endian', 390 dest='little_endian', 391 action='store_true', 392 default=False, 393 help='sets bit numbering of the output to little-endian', 394 ) 380 395 option_parser.add_option('-g', '--gensym_pattern', 381 396 dest='gensym_pattern', -
proto/charsetcompiler/pablo_expr.py
r3946 r3947 1 1 # 2 # Bitwise Boolean Expressions.2 # Pablo Expressions: bitwise Boolean Expressions + Advance. 3 3 # 4 4 import ast … … 62 62 def __str__(self): return 'Sel(%s, %s, %s)' % (self.sel.__str__(), self.true_branch.__str__(), self.false_branch.__str__()) 63 63 def toAST(self): return ast.IfExpr(self.sel.toAST(), self.true_branch.toAST(), self.false_branch.toAST()) 64 65 class 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 64 73 65 74 … … 200 209 else: return False 201 210 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.