summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>2011-04-12 01:02:39 +0100
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>2011-04-12 01:02:39 +0100
commitd4302474b65cd18f865a981ccd9483fed311ab5c (patch)
tree3f6e047c83907115f6f6d0ca32d46c9b70bd017f
parent7ed4229732bab59b4a290a54376acdda561acc7c (diff)
downloadpygments-d4302474b65cd18f865a981ccd9483fed311ab5c.tar.gz
psql can receive many backslash commands on the same line
-rw-r--r--pygments/lexers/postgres.py3
-rw-r--r--tests/examplefiles/psql_session.txt5
2 files changed, 7 insertions, 1 deletions
diff --git a/pygments/lexers/postgres.py b/pygments/lexers/postgres.py
index e99630fd..8aeab3b8 100644
--- a/pygments/lexers/postgres.py
+++ b/pygments/lexers/postgres.py
@@ -99,7 +99,7 @@ class PostgresLexer(RegexLexer):
(r'(?ms)(\$[^\$]*\$)(.*?)(\1)', language_callback),
(r'[a-zA-Z_][a-zA-Z0-9_]*', Name),
- # TODO: consider splitting the regex parser
+ # TODO: consider splitting the psql parser
(r'\\[^\s]+', Keyword.Pseudo, 'psql-command'),
# psql variable in SQL
(r""":(['"]?)[a-z][a-z0-9_]*\b\1""", Name.Variable),
@@ -115,6 +115,7 @@ class PostgresLexer(RegexLexer):
'psql-command': [
(r'\n', Text, 'root'),
(r'\s+', Text),
+ (r'\\[^\s]+', Keyword.Pseudo),
(r""":(['"]?)[a-z][a-z0-9_]*\b\1""", Name.Variable),
(r"'(''|[^'])*'", String.Single),
(r"`([^`])*`", String.Backtick),
diff --git a/tests/examplefiles/psql_session.txt b/tests/examplefiles/psql_session.txt
index 5a2897c6..289aa775 100644
--- a/tests/examplefiles/psql_session.txt
+++ b/tests/examplefiles/psql_session.txt
@@ -4,6 +4,11 @@ LINE 1: select foo;
^
regression=# \q
+peter@localhost testdb=> \a \t \x
+Output format is aligned.
+Tuples only is off.
+Expanded display is on.
+
regression=# select '\x';
WARNING: nonstandard use of escape in a string literal
LINE 1: select '\x';