diff options
-rw-r--r-- | pygments/lexers/postgres.py | 3 | ||||
-rw-r--r-- | tests/examplefiles/psql_session.txt | 5 |
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'; |