File tree Expand file tree Collapse file tree 2 files changed +4
-3
lines changed
Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -194,8 +194,10 @@ class Lexer(object):
194194 (r"'(''|\\\\|\\'|[^'])*'" , tokens .String .Single ),
195195 # not a real string literal in ANSI SQL:
196196 (r'(""|".*?[^\\]")' , tokens .String .Symbol ),
197- (r'(?<=[\w\]])(\[[^\]]*?\])' , tokens .Punctuation .ArrayIndex ),
198- (r'(\[[^\]]+\])' , tokens .Name ),
197+ # sqlite names can be escaped with [square brackets]. left bracket
198+ # cannot be preceded by word character or a right bracket --
199+ # otherwise it's probably an array index
200+ (r'(?<![\w\])])(\[[^\]]+\])' , tokens .Name ),
199201 (r'((LEFT\s+|RIGHT\s+|FULL\s+)?(INNER\s+|OUTER\s+|STRAIGHT\s+)?|(CROSS\s+|NATURAL\s+)?)?JOIN\b' , tokens .Keyword ),
200202 (r'END(\s+IF|\s+LOOP)?\b' , tokens .Keyword ),
201203 (r'NOT NULL\b' , tokens .Keyword ),
Original file line number Diff line number Diff line change @@ -57,7 +57,6 @@ def __repr__(self):
5757String = Literal .String
5858Number = Literal .Number
5959Punctuation = Token .Punctuation
60- ArrayIndex = Punctuation .ArrayIndex
6160Operator = Token .Operator
6261Comparison = Operator .Comparison
6362Wildcard = Token .Wildcard
You can’t perform that action at this time.
0 commit comments