summaryrefslogtreecommitdiff
path: root/sqlparse
diff options
context:
space:
mode:
authorAndi Albrecht <albrecht.andi@gmail.com>2015-01-16 21:45:32 +0100
committerAndi Albrecht <albrecht.andi@gmail.com>2015-01-16 21:45:32 +0100
commita17db7a7557056728acf5506d3dea6841ad55fa9 (patch)
tree07b9ef8495bbfef326cd4c92676cdcc11498fd12 /sqlparse
parentc8f2febb01bc6d5c5a1973881bf3c48f80a3d3d1 (diff)
downloadsqlparse-a17db7a7557056728acf5506d3dea6841ad55fa9.tar.gz
Improve parsing of inline comments for identifiers (fixes #163).
Diffstat (limited to 'sqlparse')
-rw-r--r--sqlparse/engine/grouping.py2
-rw-r--r--sqlparse/sql.py3
2 files changed, 5 insertions, 0 deletions
diff --git a/sqlparse/engine/grouping.py b/sqlparse/engine/grouping.py
index a048128..5189f7e 100644
--- a/sqlparse/engine/grouping.py
+++ b/sqlparse/engine/grouping.py
@@ -172,6 +172,8 @@ def group_identifier(tlist):
if next(x)(t):
yield t
else:
+ if isinstance(t, sql.Comment) and t.is_multiline():
+ yield t
raise StopIteration
def _next_token(tl, i):
diff --git a/sqlparse/sql.py b/sqlparse/sql.py
index b8e4090..6174db0 100644
--- a/sqlparse/sql.py
+++ b/sqlparse/sql.py
@@ -559,6 +559,9 @@ class Comment(TokenList):
"""A comment."""
__slots__ = ('value', 'ttype', 'tokens')
+ def is_multiline(self):
+ return self.tokens and self.tokens[0].ttype == T.Comment.Multiline
+
class Where(TokenList):
"""A WHERE clause."""