Back to index

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

List of all members.

Public Member Functions

def something
def reset_indent
def save_indent
def set_indent
def set_block_scalar_indent
def parse_block_scalar_empty_line
def parse_block_scalar_indent
def parse_plain_scalar_indent
def get_tokens_unprocessed

Static Public Attributes

string name = 'YAML'
list aliases = ['yaml']
list filenames = ['*.yaml', '*.yml']
list mimetypes = ['text/x-yaml']
dictionary tokens

Detailed Description

Lexer for `YAML <http://yaml.org/>`_, a human-friendly data serialization
language.

*New in Pygments 0.11.*

Definition at line 1036 of file text.py.


Member Function Documentation

def MoinMoin.support.pygments.lexers.text.YamlLexer.get_tokens_unprocessed (   self,
  text = None,
  context = None 
)

Definition at line 1431 of file text.py.

01431 
01432     def get_tokens_unprocessed(self, text=None, context=None):
01433         if context is None:
01434             context = YamlLexerContext(text, 0)
01435         return super(YamlLexer, self).get_tokens_unprocessed(text, context)
01436 

Here is the caller graph for this function:

def MoinMoin.support.pygments.lexers.text.YamlLexer.parse_block_scalar_empty_line (   indent_token_class,
  content_token_class 
)
Process an empty line in a block scalar.

Definition at line 1124 of file text.py.

01124 
01125     def parse_block_scalar_empty_line(indent_token_class, content_token_class):
01126         """Process an empty line in a block scalar."""
01127         def callback(lexer, match, context):
01128             text = match.group()
01129             if (context.block_scalar_indent is None or
01130                     len(text) <= context.block_scalar_indent):
01131                 if text:
01132                     yield match.start(), indent_token_class, text
01133             else:
01134                 indentation = text[:context.block_scalar_indent]
01135                 content = text[context.block_scalar_indent:]
01136                 yield match.start(), indent_token_class, indentation
01137                 yield (match.start()+context.block_scalar_indent,
01138                         content_token_class, content)
01139             context.pos = match.end()
01140         return callback

Here is the call graph for this function:

Process indentation spaces in a block scalar.

Definition at line 1141 of file text.py.

01141 
01142     def parse_block_scalar_indent(token_class):
01143         """Process indentation spaces in a block scalar."""
01144         def callback(lexer, match, context):
01145             text = match.group()
01146             if context.block_scalar_indent is None:
01147                 if len(text) <= max(context.indent, 0):
01148                     context.stack.pop()
01149                     context.stack.pop()
01150                     return
01151                 context.block_scalar_indent = len(text)
01152             else:
01153                 if len(text) < context.block_scalar_indent:
01154                     context.stack.pop()
01155                     context.stack.pop()
01156                     return
01157             if text:
01158                 yield match.start(), token_class, text
01159                 context.pos = match.end()
01160         return callback

Here is the call graph for this function:

Process indentation spaces in a plain scalar.

Definition at line 1161 of file text.py.

01161 
01162     def parse_plain_scalar_indent(token_class):
01163         """Process indentation spaces in a plain scalar."""
01164         def callback(lexer, match, context):
01165             text = match.group()
01166             if len(text) <= context.indent:
01167                 context.stack.pop()
01168                 context.stack.pop()
01169                 return
01170             if text:
01171                 yield match.start(), token_class, text
01172                 context.pos = match.end()
01173         return callback
01174 
01175 

Here is the call graph for this function:

Reset the indentation levels.

Definition at line 1060 of file text.py.

01060 
01061     def reset_indent(token_class):
01062         """Reset the indentation levels."""
01063         def callback(lexer, match, context):
01064             text = match.group()
01065             context.indent_stack = []
01066             context.indent = -1
01067             context.next_indent = 0
01068             context.block_scalar_indent = None
01069             yield match.start(), token_class, text
01070             context.pos = match.end()
01071         return callback

Here is the call graph for this function:

def MoinMoin.support.pygments.lexers.text.YamlLexer.save_indent (   token_class,
  start = False 
)
Save a possible indentation level.

Definition at line 1072 of file text.py.

01072 
01073     def save_indent(token_class, start=False):
01074         """Save a possible indentation level."""
01075         def callback(lexer, match, context):
01076             text = match.group()
01077             extra = ''
01078             if start:
01079                 context.next_indent = len(text)
01080                 if context.next_indent < context.indent:
01081                     while context.next_indent < context.indent:
01082                         context.indent = context.indent_stack.pop()
01083                     if context.next_indent > context.indent:
01084                         extra = text[context.indent:]
01085                         text = text[:context.indent]
01086             else:
01087                 context.next_indent += len(text)
01088             if text:
01089                 yield match.start(), token_class, text
01090             if extra:
01091                 yield match.start()+len(text), token_class.Error, extra
01092             context.pos = match.end()
01093         return callback

Here is the call graph for this function:

Set an explicit indentation level for a block scalar.

Definition at line 1107 of file text.py.

01107 
01108     def set_block_scalar_indent(token_class):
01109         """Set an explicit indentation level for a block scalar."""
01110         def callback(lexer, match, context):
01111             text = match.group()
01112             context.block_scalar_indent = None
01113             if not text:
01114                 return
01115             increment = match.group(1)
01116             if increment:
01117                 current_indent = max(context.indent, 0)
01118                 increment = int(increment)
01119                 context.block_scalar_indent = current_indent + increment
01120             if text:
01121                 yield match.start(), token_class, text
01122                 context.pos = match.end()
01123         return callback

Here is the call graph for this function:

def MoinMoin.support.pygments.lexers.text.YamlLexer.set_indent (   token_class,
  implicit = False 
)
Set the previously saved indentation level.

Definition at line 1094 of file text.py.

01094 
01095     def set_indent(token_class, implicit=False):
01096         """Set the previously saved indentation level."""
01097         def callback(lexer, match, context):
01098             text = match.group()
01099             if context.indent < context.next_indent:
01100                 context.indent_stack.append(context.indent)
01101                 context.indent = context.next_indent
01102             if not implicit:
01103                 context.next_indent += len(text)
01104             yield match.start(), token_class, text
01105             context.pos = match.end()
01106         return callback

Here is the call graph for this function:

Do not produce empty tokens.

Definition at line 1050 of file text.py.

01050 
01051     def something(token_class):
01052         """Do not produce empty tokens."""
01053         def callback(lexer, match, context):
01054             text = match.group()
01055             if not text:
01056                 return
01057             yield match.start(), token_class, text
01058             context.pos = match.end()
01059         return callback

Here is the call graph for this function:


Member Data Documentation

Definition at line 1045 of file text.py.

list MoinMoin.support.pygments.lexers.text.YamlLexer.filenames = ['*.yaml', '*.yml'] [static]

Definition at line 1046 of file text.py.

Definition at line 1047 of file text.py.

Definition at line 1044 of file text.py.

Definition at line 1176 of file text.py.


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