Commits

Georg Brandl committed 7c7374e

Add changelog entry and fixup imports in postgres module.

  • Participants
  • Parent commits 48c2b48

Comments (0)

Files changed (3)

   * Nemerle (#667)
   * F# (#353)
   * Groovy (#501)
+  * PostgreSQL (#660)
 
 - In the LaTeX formatter, escape special &, < and > chars (#648).
 

File pygments/lexers/_postgres_builtins.py

 """
 
 import re
-import urllib2
+import urllib
 
 # One man's constant is another man's variable.
 SOURCE_URL = 'https://github.com/postgres/postgres/raw/master'
     return dt
 
 def fetch(url):
-    return urllib2.urlopen(url)
+    return urllib.urlopen(url)
 
 def update_consts(filename, constname, content):
     f = open(filename)

File pygments/lexers/postgres.py

+# -*- coding: utf-8 -*-
 """
     pygments.lexers.postgres
     ~~~~~~~~~~~~~~~~~~~~~~~~
 
     Lexers for PostgreSQL-specific SQL and psql interactive session.
 
-    :copyright: Copyright 2011 by Daniele Varrazzo.
-    :license: BSD, see LICENSE for details.
-
-    The module contains lexers related to PostgreSQL languages.
-
     `PostgresLexer`
         A SQL lexer for the PostgreSQL dialect. Differences w.r.t. the SQL
         lexer are:
     The ``tests/examplefiles`` contains a few test files with data to be
     parsed by these lexers.
 
+    :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS.
+    :license: BSD, see LICENSE for details.
 """
 
 import re
-import sys
 from copy import deepcopy
 
-from pygments.lexer import Lexer, RegexLexer, include, bygroups, using, \
-     this, do_insertions
-from pygments.token import Error, Punctuation, Literal, Token, \
+from pygments.lexer import Lexer, RegexLexer, do_insertions
+from pygments.token import Punctuation, \
      Text, Comment, Operator, Keyword, Name, String, Number, Generic
 from pygments.lexers import get_lexer_by_name, ClassNotFound
 
-from pygments.lexers._postgres_builtins import (
-    KEYWORDS, DATATYPES, PSEUDO_TYPES, PLPGSQL_KEYWORDS)
+from pygments.lexers._postgres_builtins import KEYWORDS, DATATYPES, \
+     PSEUDO_TYPES, PLPGSQL_KEYWORDS
 
 
-__all__ = [ 'PostgresLexer', 'PlPgsqlLexer', 'PostgresConsoleLexer' ]
+__all__ = ['PostgresLexer', 'PlPgsqlLexer', 'PostgresConsoleLexer']
 
 line_re  = re.compile('.*?\n')
 
     else:
         yield (match.start(), String, match.group())
 
+
 class PostgresBase(object):
     """Base class for Postgres-related lexers.
 
             # print >>sys.stderr, "language not found:", lang
             return None
 
+
 class PostgresLexer(PostgresBase, RegexLexer):
     """
     Lexer for the PostgreSQL dialect of SQL.
+
+    *New in Pygments 1.5.*
     """
 
     name = 'PostgreSQL SQL dialect'
 class PlPgsqlLexer(PostgresBase, RegexLexer):
     """
     Handle the extra syntax in Pl/pgSQL language.
+
+    *New in Pygments 1.5.*
     """
     name = 'PL/pgSQL'
     aliases = ['plpgsql']
     This is not a complete psql lexer yet as it lacks prompt support
     and output rendering.
     """
+
     name = 'PostgreSQL console - regexp based lexer'
     aliases = []    # not public
 
 class PostgresConsoleLexer(Lexer):
     """
     Lexer for psql sessions.
+
+    *New in Pygments 1.5.*
     """
 
     name = 'PostgreSQL console (psql)'
                     yield (mmsg.start(2), out_token, mmsg.group(2))
                 else:
                     yield (0, out_token, line)
-
-