Changeset 1143 for proto/RE2PBS/bin


Ignore:
Timestamp:
Apr 22, 2011, 1:57:32 AM (9 years ago)
Author:
ksherdy
Message:

Move method out of Python file.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • proto/RE2PBS/bin/codepoint_symbol_table.py

    r1142 r1143  
    2626# Incremental insertion is supported.
    2727# --------------------------------------------------------------------------------
     28from charset_def import CharSetDef
     29
    2830BadCodePointException = Exception()
    2931
     
    9698        return "Key: %s Value: %s Invert: %s" % (self.key(), self.codepoints, self.invert)
    9799
    98 #
    99 #       Utility Functions       
    100 #
    101 # --------------------------------------------------------------------------------
    102 # Utility Functions     
    103 # --------------------------------------------------------------------------------
    104 def CodePointLists2CharSetDefList(codepointss):
    105         """ Translates 'lists of lists' of code points Character Class Compiler CharSetDef argument list syntax """       
    106         rv = []
    107                
    108         for codepoints in codepointss: 
    109           lgth = len(codepoints)
    110 
    111           if lgth < 1:
    112             raise BadCodePointException
    113           elif lgth == 1:
    114             rv.append(chr(codepoints[0]))
    115           elif lgth == 2:
    116             rv.append(chr(codepoints[0]) + '-' + chr(codepoints[1]))
    117           else:
    118             raise BadCodePointException
    119100       
    120         return rv
    121        
    122 
    123101def test():
    124102    symbol_table = CodePointSymbolTable()
     
    131109   
    132110    symbol_table.debug()
    133    
     111
     112    symbol_table.keys()
     113
    134114    return 
    135115
Note: See TracChangeset for help on using the changeset viewer.