summaryrefslogtreecommitdiff
path: root/sqlparse
diff options
context:
space:
mode:
authorAndi Albrecht <albrecht.andi@gmail.com>2016-09-14 14:45:44 +0200
committerAndi Albrecht <albrecht.andi@gmail.com>2016-09-14 14:45:44 +0200
commit358ad4b9754721f69c6b40333653bd84edb8634f (patch)
treee60e2f544353dc6037203ea7819fe764d36306e3 /sqlparse
parent7dd1ff99fe433d763840172eef7c14dc0c282d4f (diff)
downloadsqlparse-358ad4b9754721f69c6b40333653bd84edb8634f.tar.gz
Fix parsing of names containing special chars (fixes 291).
Diffstat (limited to 'sqlparse')
-rw-r--r--sqlparse/keywords.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/sqlparse/keywords.py b/sqlparse/keywords.py
index dee4030..22d872e 100644
--- a/sqlparse/keywords.py
+++ b/sqlparse/keywords.py
@@ -39,7 +39,7 @@ SQL_REGEX = {
(r'\?', tokens.Name.Placeholder),
(r'%(\(\w+\))?s', tokens.Name.Placeholder),
- (r'[$:?]\w+', tokens.Name.Placeholder),
+ (r'(?<!\w)[$:?]\w+', tokens.Name.Placeholder),
# FIXME(andi): VALUES shouldn't be listed here
# see https://github.com/andialbrecht/sqlparse/pull/64
@@ -76,7 +76,7 @@ SQL_REGEX = {
(r'CREATE(\s+OR\s+REPLACE)?\b', tokens.Keyword.DDL),
(r'DOUBLE\s+PRECISION\b', tokens.Name.Builtin),
- (r'[_A-Z]\w*', is_keyword),
+ (r'[_A-Z][_$#\w]*', is_keyword),
(r'[;:()\[\],\.]', tokens.Punctuation),
(r'[<>=~!]+', tokens.Operator.Comparison),