diff options
author | Simon Heisterkamp <simon@heisterkamp.dk> | 2022-12-01 10:35:42 +0000 |
---|---|---|
committer | Andi Albrecht <albrecht.andi@gmail.com> | 2023-01-02 08:54:47 +0100 |
commit | e0d3928ba69d73ba874ca03ec4395e94cf1ab293 (patch) | |
tree | effb9b90561b23e7edb2d4c1057d27df59660b08 /sqlparse/lexer.py | |
parent | f9a73a62cfc23b10c38f22a10bd1d4c3edbb286f (diff) | |
download | sqlparse-e0d3928ba69d73ba874ca03ec4395e94cf1ab293.tar.gz |
lexer documentation
Diffstat (limited to 'sqlparse/lexer.py')
-rw-r--r-- | sqlparse/lexer.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sqlparse/lexer.py b/sqlparse/lexer.py index aafb55f..50799df 100644 --- a/sqlparse/lexer.py +++ b/sqlparse/lexer.py @@ -6,7 +6,7 @@ # the BSD License: https://opensource.org/licenses/BSD-3-Clause """SQL Lexer""" - +import re # This code is based on the SqlLexer in pygments. # http://pygments.org/ # It's separated from the rest of pygments to increase performance @@ -56,7 +56,8 @@ class Lexer(metaclass=_LexerSingletonMetaclass): def set_SQL_REGEX(self, SQL_REGEX): """Set the list of regex that will parse the SQL.""" - self._SQL_REGEX = SQL_REGEX + FLAGS = re.IGNORECASE | re.UNICODE + self._SQL_REGEX = [(re.compile(rx, FLAGS).match, tt) for rx, tt in SQL_REGEX] def add_keywords(self, keywords): """Add keyword dictionaries. Keywords are looked up in the same order |