summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>2011-04-05 14:49:25 +0100
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>2011-04-05 14:49:25 +0100
commit52f26cc94197b1de1c2e01169e40393f2cebd5a5 (patch)
tree0be6cfb26026a4417b02c5f98854eecdd4c9dee4
parent37c9a8a5ac168832b1560e495d491ea9d36bd5b6 (diff)
downloadpygments-52f26cc94197b1de1c2e01169e40393f2cebd5a5.tar.gz
Handle PostgreSQL escaped strings
-rw-r--r--pygments/lexers/postgres.py2
-rw-r--r--tests/examplefiles/psql_session.txt2
2 files changed, 3 insertions, 1 deletions
diff --git a/pygments/lexers/postgres.py b/pygments/lexers/postgres.py
index 79cfe3e1..f7c9dd0f 100644
--- a/pygments/lexers/postgres.py
+++ b/pygments/lexers/postgres.py
@@ -47,7 +47,7 @@ class PostgresLexer(RegexLexer):
(r'([0-9]*\.[0-9]*|[0-9]+)(e[+-]?[0-9]+)?', Number.Float),
(r'[0-9]+', Number.Integer),
# TODO: Backslash escapes?
- (r"'(''|[^'])*'", String.Single),
+ (r"E?'(''|[^'])*'", String.Single),
(r'"(""|[^"])*"', String.Name), # quoted identifier
(r'[a-zA-Z_][a-zA-Z0-9_]*', Name),
diff --git a/tests/examplefiles/psql_session.txt b/tests/examplefiles/psql_session.txt
index 8b920258..5a2897c6 100644
--- a/tests/examplefiles/psql_session.txt
+++ b/tests/examplefiles/psql_session.txt
@@ -14,6 +14,8 @@ HINT: Use the escape string syntax for escapes, e.g., E'\r\n'.
x
(1 row)
+regression=# select E'\x';
+
piro=> \set foo 30;
piro=> select * from test where foo <= :foo;
foo | bar