Back to index

moin  1.9.0~rc2
Public Member Functions | Static Public Attributes
MoinMoin.support.pygments.lexers.other.BashSessionLexer Class Reference
Inheritance diagram for MoinMoin.support.pygments.lexers.other.BashSessionLexer:
Inheritance graph
[legend]
Collaboration diagram for MoinMoin.support.pygments.lexers.other.BashSessionLexer:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def get_tokens_unprocessed

Static Public Attributes

string name = 'Bash Session'
list aliases = ['console']
list filenames = ['*.sh-session']
list mimetypes = ['application/x-shell-session']

Detailed Description

Lexer for simplistic shell sessions.

*New in Pygments 1.1.*

Definition at line 399 of file other.py.


Member Function Documentation

Definition at line 411 of file other.py.

00411 
00412     def get_tokens_unprocessed(self, text):
00413         bashlexer = BashLexer(**self.options)
00414 
00415         pos = 0
00416         curcode = ''
00417         insertions = []
00418 
00419         for match in line_re.finditer(text):
00420             line = match.group()
00421             m = re.match(r'^((?:|sh\S*?|\w+\S+[@:]\S+(?:\s+\S+)?|\[\S+[@:]'
00422                          r'[^\n]+\].+)[$#%])(.*\n?)', line)
00423             if m:
00424                 # To support output lexers (say diff output), the output
00425                 # needs to be broken by prompts whenever the output lexer
00426                 # changes.
00427                 if not insertions:
00428                     pos = match.start()
00429 
00430                 insertions.append((len(curcode),
00431                                    [(0, Generic.Prompt, m.group(1))]))
00432                 curcode += m.group(2)
00433             elif line.startswith('>'):
00434                 insertions.append((len(curcode),
00435                                    [(0, Generic.Prompt, line[:1])]))
00436                 curcode += line[1:]
00437             else:
00438                 if insertions:
00439                     toks = bashlexer.get_tokens_unprocessed(curcode)
00440                     for i, t, v in do_insertions(insertions, toks):
00441                         yield pos+i, t, v
00442                 yield match.start(), Generic.Output, line
00443                 insertions = []
00444                 curcode = ''
00445         if insertions:
00446             for i, t, v in do_insertions(insertions,
00447                                          bashlexer.get_tokens_unprocessed(curcode)):
00448                 yield pos+i, t, v
00449 

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 407 of file other.py.

Definition at line 408 of file other.py.

list MoinMoin.support.pygments.lexers.other.BashSessionLexer.mimetypes = ['application/x-shell-session'] [static]

Definition at line 409 of file other.py.

Definition at line 406 of file other.py.


The documentation for this class was generated from the following file: