Generates tokenizer exception if the value is not unicode

master
Salvo 'LtWorf' Tomaselli 2013-02-10 14:24:52 +07:00
parent 2e0cbf94a7
commit 5433f14b66
1 changed files with 3 additions and 2 deletions

@ -64,7 +64,8 @@ ARROW=u'➡'
b_operators=(PRODUCT,DIFFERENCE,UNION,INTERSECTION,DIVISION,JOIN,JOIN_LEFT,JOIN_RIGHT,JOIN_FULL) # List of binary operators b_operators=(PRODUCT,DIFFERENCE,UNION,INTERSECTION,DIVISION,JOIN,JOIN_LEFT,JOIN_RIGHT,JOIN_FULL) # List of binary operators
u_operators=(PROJECTION,SELECTION,RENAME) # List of unary operators u_operators=(PROJECTION,SELECTION,RENAME) # List of unary operators
op_functions={PRODUCT:'product',DIFFERENCE:'difference',UNION:'union',INTERSECTION:'intersection',DIVISION:'division',JOIN:'join',JOIN_LEFT:'outer_left',JOIN_RIGHT:'outer_right',JOIN_FULL:'outer',PROJECTION:'projection',SELECTION:'selection',RENAME:'rename'} # Associates operator with python method # Associates operator with python method
op_functions={PRODUCT:'product',DIFFERENCE:'difference',UNION:'union',INTERSECTION:'intersection',DIVISION:'division',JOIN:'join',JOIN_LEFT:'outer_left',JOIN_RIGHT:'outer_right',JOIN_FULL:'outer',PROJECTION:'projection',SELECTION:'selection',RENAME:'rename'}
class TokenizerException (Exception): class TokenizerException (Exception):
pass pass
@ -275,7 +276,7 @@ def tokenize(expression):
every token of the expression is an item of a list. Expressions into every token of the expression is an item of a list. Expressions into
parenthesis will be converted into sublists.''' parenthesis will be converted into sublists.'''
if not isinstance(expression,unicode): if not isinstance(expression,unicode):
raise Exception('expected unicode') raise TokenizerException('expected unicode')
items=[] #List for the tokens items=[] #List for the tokens