Project

General

Profile

« Previous | Next » 

Revision 5361

sql.py: logic_op_re(): Added expr_re param for an expr on the other side of the operator

View differences:

lib/sql.py
1025 1025
false_re = r'false'
1026 1026
bool_re = r'(?:'+true_re+r'|'+false_re+r')'
1027 1027

  
1028
def logic_op_re(op, value_re):
1028
def logic_op_re(op, value_re, expr_re=''):
1029 1029
    op_re = ' '+op+' '
1030
    return '(?:'+op_re+value_re+'|'+value_re+op_re+')'
1030
    return '(?:'+expr_re+op_re+value_re+'|'+value_re+op_re+expr_re+')'
1031 1031

  
1032 1032
def simplify_parens(expr):
1033 1033
    return regexp.sub_nested(r'\(('+bool_re+r'|\([^()]*\))\)', r'\1', expr)

Also available in: Unified diff