summaryrefslogtreecommitdiff
path: root/sqlparse/lexer.py
diff options
context:
space:
mode:
authorAndi Albrecht <albrecht.andi@gmail.com>2015-02-08 16:52:15 +0100
committerAndi Albrecht <albrecht.andi@gmail.com>2015-02-08 16:52:15 +0100
commite1b5482b1413591260f41ceb50e97091928f195a (patch)
tree01ab00f4d38f20b37a2f75ef28f737da12baaa00 /sqlparse/lexer.py
parent1ebad53c11295b26375fabf61591e7a69161842e (diff)
downloadsqlparse-e1b5482b1413591260f41ceb50e97091928f195a.tar.gz
(postgresql) Add support for square bracket array indexing, by darikg.
Pull request #170 with trivial conflicts resolved.
Diffstat (limited to 'sqlparse/lexer.py')
-rw-r--r--sqlparse/lexer.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/sqlparse/lexer.py b/sqlparse/lexer.py
index 611835f..a60c789 100644
--- a/sqlparse/lexer.py
+++ b/sqlparse/lexer.py
@@ -195,6 +195,7 @@ class Lexer(object):
(r"'(''|\\'|[^'])*'", tokens.String.Single),
# not a real string literal in ANSI SQL:
(r'(""|".*?[^\\]")', tokens.String.Symbol),
+ (r'(?<=[\w\]])(\[[^\]]*?\])', tokens.Punctuation.ArrayIndex),
(r'(\[[^\]]+\])', tokens.Name),
(r'((LEFT\s+|RIGHT\s+|FULL\s+)?(INNER\s+|OUTER\s+|STRAIGHT\s+)?|(CROSS\s+|NATURAL\s+)?)?JOIN\b', tokens.Keyword),
(r'END(\s+IF|\s+LOOP)?\b', tokens.Keyword),