Commit 60f94952 authored by Vincent Pelletier's avatar Vincent Pelletier Committed by Julien Muchembled

ZSQLCatalog: add support for NULL value in SearchText parsing

parent cb73785f
......@@ -264,7 +264,9 @@ class AdvancedSearchTextParser(lexer):
def p_value(self, p):
'''value : OPERATOR string
| string'''
| OPERATOR NULL
| string
| NULL'''
if len(p) == 2:
p[0] = ValueNode(p[1])
else:
......
from SearchTextParser import parse, isAdvancedSearchText
def dequote(value):
assert isinstance(value, basestring), value
if len(value) >= 2 and value[0] == value[-1] == '"' and value[-2] != '\\':
if isinstance(value, basestring) and len(value) >= 2 and \
value[0] == value[-1] == '"' and value[-2] != '\\':
escaped = False
value_list = []
append = value_list.append
......
......@@ -82,7 +82,9 @@ class lexer(object):
'WORD',
'OPERATOR',
'LEFT_PARENTHESE',
'RIGHT_PARENTHESE')
'RIGHT_PARENTHESE',
'NULL',
)
t_ignore = ' '
......@@ -123,6 +125,11 @@ class lexer(object):
r'[^><= :\(\)"][^ :\(\)"]*'
return t
def t_NULL(self, t):
r'NULL'
t.value = None
return t
def parse(self, *args, **kw):
kw['lexer'] = self
return self.parser.parse(*args, **kw)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment