summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES9
-rw-r--r--sqlparse/lexer.py4
-rw-r--r--tests/test_tokenize.py5
3 files changed, 16 insertions, 2 deletions
diff --git a/CHANGES b/CHANGES
index 4dfa2e5..673ee54 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,8 @@
-Release 0.1.0 (In Development)
-------------------------------
+In Development
+--------------
+ * Recognize backticks quoting identifiers.
+
+
+Release 0.1.0
+-------------
* Initial. \ No newline at end of file
diff --git a/sqlparse/lexer.py b/sqlparse/lexer.py
index b635fc6..dcac401 100644
--- a/sqlparse/lexer.py
+++ b/sqlparse/lexer.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
# Copyright (C) 2008 Andi Albrecht, albrecht.andi@gmail.com
#
# This module is part of python-sqlparse and is released under
@@ -162,6 +164,8 @@ class Lexer:
(r':=', Assignment),
(r'::', Punctuation),
(r'[*]', Wildcard),
+ (r"`(``|[^`])*`", Name),
+ (r"´(´´|[^´])*´", Name),
(r'[+/<>=~!@#%^&|`?^-]', Operator),
(r'[0-9]+', Number.Integer),
# TODO: Backslash escapes?
diff --git a/tests/test_tokenize.py b/tests/test_tokenize.py
index 7106b3c..74cf1fc 100644
--- a/tests/test_tokenize.py
+++ b/tests/test_tokenize.py
@@ -19,3 +19,8 @@ class TestTokenize(unittest.TestCase):
self.assertEqual(tokens[0], (Keyword.DML, u'select'))
self.assertEqual(tokens[-1], (Punctuation, u';'))
+ def test_backticks(self):
+ sql = '`foo`.`bar`'
+ tokens = list(lexer.tokenize(sql))
+ self.assertEqual(len(tokens), 3)
+ self.assertEqual(tokens[0], (Name, u'`foo`'))