ThirdParty/Pygments/pygments/lexers/sql.py

changeset 2426
da76c71624de
parent 1705
b0fbc9300f2b
child 2525
8b507a9a2d40
diff -r ace8a08028f3 -r da76c71624de ThirdParty/Pygments/pygments/lexers/sql.py
--- a/ThirdParty/Pygments/pygments/lexers/sql.py	Sun Feb 17 19:05:40 2013 +0100
+++ b/ThirdParty/Pygments/pygments/lexers/sql.py	Sun Feb 17 19:07:15 2013 +0100
@@ -34,12 +34,11 @@
     The ``tests/examplefiles`` contains a few test files with data to be
     parsed by these lexers.
 
-    :copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
+    :copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
     :license: BSD, see LICENSE for details.
 """
 
 import re
-from copy import deepcopy
 
 from pygments.lexer import Lexer, RegexLexer, do_insertions, bygroups
 from pygments.token import Punctuation, \
@@ -61,9 +60,6 @@
     """Parse the content of a $-string using a lexer
 
     The lexer is chosen looking for a nearby LANGUAGE.
-
-    Note: this function should have been a `PostgresBase` method, but the
-    rules deepcopy fails in this case.
     """
     l = None
     m = language_re.match(lexer.text[match.end():match.end()+100])
@@ -93,8 +89,6 @@
     had, _tokens could be created on this ancestor and not updated for the
     other classes, resulting e.g. in PL/pgSQL parsed as SQL. This shortcoming
     seem to suggest that regexp lexers are not really subclassable.
-
-    `language_callback` should really be our method, but this breaks deepcopy.
     """
     def get_tokens_unprocessed(self, text, *args):
         # Have a copy of the entire text to be used by `language_callback`.
@@ -182,7 +176,7 @@
     mimetypes = ['text/x-plpgsql']
 
     flags = re.IGNORECASE
-    tokens = deepcopy(PostgresLexer.tokens)
+    tokens = dict((k, l[:]) for (k, l) in PostgresLexer.tokens.items())
 
     # extend the keywords list
     for i, pattern in enumerate(tokens['root']):
@@ -216,7 +210,7 @@
     aliases = []    # not public
 
     flags = re.IGNORECASE
-    tokens = deepcopy(PostgresLexer.tokens)
+    tokens = dict((k, l[:]) for (k, l) in PostgresLexer.tokens.items())
 
     tokens['root'].append(
         (r'\\[^\s]+', Keyword.Pseudo, 'psql-command'))

eric ide

mercurial