diff options
author | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2011-04-12 08:56:51 +0100 |
---|---|---|
committer | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2011-04-12 08:56:51 +0100 |
commit | 5c78ceb3e427f352a5bd28d75b0e42293a9d03bf (patch) | |
tree | f3fd2c0a2b9b7f8ff16875bc46e1c2a0571af6ec /pygments/lexers/postgres.py | |
parent | 0ed0588f1916a613050a9abd964aba1310f7c2bb (diff) | |
download | pygments-5c78ceb3e427f352a5bd28d75b0e42293a9d03bf.tar.gz |
Detect console prompt line in an interactive psql session
Diffstat (limited to 'pygments/lexers/postgres.py')
-rw-r--r-- | pygments/lexers/postgres.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/pygments/lexers/postgres.py b/pygments/lexers/postgres.py index 92c8833c..1bb38556 100644 --- a/pygments/lexers/postgres.py +++ b/pygments/lexers/postgres.py @@ -186,6 +186,14 @@ class PostgresConsoleLexer(Lexer): # the repl loop will be broken below break + # Identify a shell prompt in case of psql commandline example + if line.startswith('$'): + lexer = get_lexer_by_name('console', **self.options) + for x in lexer.get_tokens_unprocessed(line): + yield x + break + + # Identify a psql prompt mprompt = re_prompt.match(line) if mprompt is not None: insertions.append((len(curcode), |