Commits

Kirill Simonov committed 7c78def

Back to work :). Rename markers to marks.

Comments (0)

Files changed (14)

lib/yaml/composer.py

             anchor = event.anchor
             if anchor not in self.all_anchors:
                 raise ComposerError(None, None, "found undefined alias %r"
-                        % anchor.encode('utf-8'), event.start_marker)
+                        % anchor.encode('utf-8'), event.start_mark)
             if anchor not in self.complete_anchors:
                 collection_event = self.all_anchors[anchor]
                 raise ComposerError("while composing a collection",
-                        collection_event.start_marker,
+                        collection_event.start_mark,
                         "found recursive anchor %r" % anchor.encode('utf-8'),
-                        event.start_marker)
+                        event.start_mark)
             return self.complete_anchors[anchor]
         event = self.parser.peek()
         anchor = event.anchor
         if anchor is not None:
             if anchor in self.all_anchors:
                 raise ComposerError("found duplicate anchor %r; first occurence"
-                        % anchor.encode('utf-8'), self.all_anchors[anchor].start_marker,
-                        "second occurence", event.start_marker)
+                        % anchor.encode('utf-8'), self.all_anchors[anchor].start_mark,
+                        "second occurence", event.start_mark)
             self.all_anchors[anchor] = event
         if self.parser.check(ScalarEvent):
             node = self.compose_scalar_node()
     def compose_scalar_node(self):
         event = self.parser.get()
         return ScalarNode(event.tag, event.value,
-                event.start_marker, event.end_marker)
+                event.start_mark, event.end_mark)
 
     def compose_sequence_node(self):
         start_event = self.parser.get()
             value.append(self.compose_node())
         end_event = self.parser.get()
         return SequenceNode(start_event.tag, value,
-                start_event.start_marker, end_event.end_marker)
+                start_event.start_mark, end_event.end_mark)
 
     def compose_mapping_node(self):
         start_event = self.parser.get()
             item_key = self.compose_node()
             item_value = self.compose_node()
             if item_key in value:
-                raise ComposerError("while composing a mapping", start_event.start_marker,
-                        "found duplicate key", key_event.start_marker)
+                raise ComposerError("while composing a mapping", start_event.start_mark,
+                        "found duplicate key", key_event.start_mark)
             value[item_key] = item_value
         end_event = self.parser.get()
         return MappingNode(start_event.tag, value,
-                start_event.start_marker, end_event.end_marker)
+                start_event.start_mark, end_event.end_mark)
 

lib/yaml/constructor.py

                         return self.construct_scalar(node.value[key_node])
             raise ConstructorError(None, None,
                     "expected a scalar node, but found %s" % node.id,
-                    node.start_marker)
+                    node.start_mark)
         return node.value
 
     def construct_sequence(self, node):
         if not isinstance(node, SequenceNode):
             raise ConstructorError(None, None,
                     "expected a sequence node, but found %s" % node.id,
-                    node.start_marker)
+                    node.start_mark)
         return [self.construct_object(child) for child in node.value]
 
     def construct_mapping(self, node):
         if not isinstance(node, MappingNode):
             raise ConstructorError(None, None,
                     "expected a mapping node, but found %s" % node.id,
-                    node.start_marker)
+                    node.start_mark)
         mapping = {}
         merge = None
         for key_node in node.value:
             if key_node.tag == u'tag:yaml.org,2002:merge':
                 if merge is not None:
-                    raise ConstructorError("while constructing a mapping", node.start_marker,
-                            "found duplicate merge key", key_node.start_marker)
+                    raise ConstructorError("while constructing a mapping", node.start_mark,
+                            "found duplicate merge key", key_node.start_mark)
                 value_node = node.value[key_node]
                 if isinstance(value_node, MappingNode):
                     merge = [self.construct_mapping(value_node)]
                     for subnode in value_node.value:
                         if not isinstance(subnode, MappingNode):
                             raise ConstructorError("while constructing a mapping",
-                                    node.start_marker,
+                                    node.start_mark,
                                     "expected a mapping for merging, but found %s"
-                                    % subnode.id, subnode.start_marker)
+                                    % subnode.id, subnode.start_mark)
                         merge.append(self.construct_mapping(subnode))
                     merge.reverse()
                 else:
-                    raise ConstructorError("while constructing a mapping", node.start_marker,
+                    raise ConstructorError("while constructing a mapping", node.start_mark,
                             "expected a mapping or list of mappings for merging, but found %s"
-                            % value_node.id, value_node.start_marker)
+                            % value_node.id, value_node.start_mark)
             elif key_node.tag == u'tag:yaml.org,2002:value':
                 if '=' in mapping:
-                    raise ConstructorError("while construction a mapping", node.start_marker,
-                            "found duplicate value key", key_node.start_marker)
+                    raise ConstructorError("while construction a mapping", node.start_mark,
+                            "found duplicate value key", key_node.start_mark)
                 value = self.construct_object(node.value[key_node])
                 mapping['='] = value
             else:
                 try:
                     duplicate_key = key in mapping
                 except TypeError, exc:
-                    raise ConstructorError("while constructing a mapping", node.start_marker,
-                            "found unacceptable key (%s)" % exc, key_node.start_marker)
+                    raise ConstructorError("while constructing a mapping", node.start_mark,
+                            "found unacceptable key (%s)" % exc, key_node.start_mark)
                 if duplicate_key:
-                    raise ConstructorError("while constructing a mapping", node.start_marker,
-                            "found duplicate key", key_node.start_marker)
+                    raise ConstructorError("while constructing a mapping", node.start_mark,
+                            "found duplicate key", key_node.start_mark)
                 value = self.construct_object(node.value[key_node])
                 mapping[key] = value
         if merge is not None:
         if not isinstance(node, MappingNode):
             raise ConstructorError(None, None,
                     "expected a mapping node, but found %s" % node.id,
-                    node.start_marker)
+                    node.start_mark)
         pairs = []
         for key_node in node.value:
             key = self.construct_object(key_node)
             return str(value).decode('base64')
         except (binascii.Error, UnicodeEncodeError), exc:
             raise ConstructorError(None, None,
-                    "failed to decode base64 data: %s" % exc, node.start_marker) 
+                    "failed to decode base64 data: %s" % exc, node.start_mark) 
 
     timestamp_regexp = re.compile(
             ur'''^(?P<year>[0-9][0-9][0-9][0-9])
         # Note: we do not check for duplicate keys, because it's too
         # CPU-expensive.
         if not isinstance(node, SequenceNode):
-            raise ConstructorError("while constructing an ordered map", node.start_marker,
-                    "expected a sequence, but found %s" % node.id, node.start_marker)
+            raise ConstructorError("while constructing an ordered map", node.start_mark,
+                    "expected a sequence, but found %s" % node.id, node.start_mark)
         omap = []
         for subnode in node.value:
             if not isinstance(subnode, MappingNode):
-                raise ConstructorError("while constructing an ordered map", node.start_marker,
+                raise ConstructorError("while constructing an ordered map", node.start_mark,
                         "expected a mapping of length 1, but found %s" % subnode.id,
-                        subnode.start_marker)
+                        subnode.start_mark)
             if len(subnode.value) != 1:
-                raise ConstructorError("while constructing an ordered map", node.start_marker,
+                raise ConstructorError("while constructing an ordered map", node.start_mark,
                         "expected a single mapping item, but found %d items" % len(subnode.value),
-                        subnode.start_marker)
+                        subnode.start_mark)
             key_node = subnode.value.keys()[0]
             key = self.construct_object(key_node)
             value = self.construct_object(subnode.value[key_node])
     def construct_yaml_pairs(self, node):
         # Note: the same code as `construct_yaml_omap`.
         if not isinstance(node, SequenceNode):
-            raise ConstructorError("while constructing pairs", node.start_marker,
-                    "expected a sequence, but found %s" % node.id, node.start_marker)
+            raise ConstructorError("while constructing pairs", node.start_mark,
+                    "expected a sequence, but found %s" % node.id, node.start_mark)
         pairs = []
         for subnode in node.value:
             if not isinstance(subnode, MappingNode):
-                raise ConstructorError("while constructing pairs", node.start_marker,
+                raise ConstructorError("while constructing pairs", node.start_mark,
                         "expected a mapping of length 1, but found %s" % subnode.id,
-                        subnode.start_marker)
+                        subnode.start_mark)
             if len(subnode.value) != 1:
-                raise ConstructorError("while constructing pairs", node.start_marker,
+                raise ConstructorError("while constructing pairs", node.start_mark,
                         "expected a single mapping item, but found %d items" % len(subnode.value),
-                        subnode.start_marker)
+                        subnode.start_mark)
             key_node = subnode.value.keys()[0]
             key = self.construct_object(key_node)
             value = self.construct_object(subnode.value[key_node])
     def construct_undefined(self, node):
         raise ConstructorError(None, None,
                 "could not determine a constructor for the tag %r" % node.tag.encode('utf-8'),
-                node.start_marker)
+                node.start_mark)
 
 Constructor.add_constructor(
         u'tag:yaml.org,2002:null',
     def from_yaml(cls, constructor, node):
         raise ConstructorError(None, None,
                 "found undefined constructor for the tag %r"
-                % node.tag.encode('utf-8'), node.start_marker)
+                % node.tag.encode('utf-8'), node.start_mark)
     from_yaml = classmethod(from_yaml)
 
     def to_yaml(self):

lib/yaml/error.py

 
-__all__ = ['Marker', 'YAMLError', 'MarkedYAMLError']
+__all__ = ['Mark', 'YAMLError', 'MarkedYAMLError']
 
-class Marker:
+class Mark:
 
     def __init__(self, name, line, column, buffer, pointer):
         self.name = name
 
 class MarkedYAMLError(YAMLError):
 
-    def __init__(self, context=None, context_marker=None,
-            problem=None, problem_marker=None):
+    def __init__(self, context=None, context_mark=None,
+            problem=None, problem_mark=None):
         self.context = context
-        self.context_marker = context_marker
+        self.context_mark = context_mark
         self.problem = problem
-        self.problem_marker = problem_marker
+        self.problem_mark = problem_mark
 
     def __str__(self):
         lines = []
-        #for (place, marker) in [(self.context, self.context_marker),
-        #                        (self.problem, self.problem_marker)]:
+        #for (place, mark) in [(self.context, self.context_mark),
+        #                        (self.problem, self.problem_mark)]:
         #    if place is not None:
         #        lines.append(place)
-        #        if marker is not None:
-        #            lines.append(str(marker))
+        #        if mark is not None:
+        #            lines.append(str(mark))
         if self.context is not None:
             lines.append(self.context)
-        if self.context_marker is not None  \
-            and (self.problem is None or self.problem_marker is None
-                    or self.context_marker.name != self.problem_marker.name
-                    or self.context_marker.line != self.problem_marker.line
-                    or self.context_marker.column != self.problem_marker.column):
-            lines.append(str(self.context_marker))
+        if self.context_mark is not None  \
+            and (self.problem is None or self.problem_mark is None
+                    or self.context_mark.name != self.problem_mark.name
+                    or self.context_mark.line != self.problem_mark.line
+                    or self.context_mark.column != self.problem_mark.column):
+            lines.append(str(self.context_mark))
         if self.problem is not None:
             lines.append(self.problem)
-        if self.problem_marker is not None:
-            lines.append(str(self.problem_marker))
+        if self.problem_mark is not None:
+            lines.append(str(self.problem_mark))
         return '\n'.join(lines)
 
 

lib/yaml/events.py

 
 class Event:
-    def __init__(self, start_marker, end_marker):
-        self.start_marker = start_marker
-        self.end_marker = end_marker
+    def __init__(self, start_mark, end_mark):
+        self.start_mark = start_mark
+        self.end_mark = end_mark
     def __repr__(self):
         attributes = [key for key in self.__dict__
-                if not key.endswith('_marker')]
+                if not key.endswith('_mark')]
         attributes.sort()
         arguments = ', '.join(['%s=%r' % (key, getattr(self, key))
                 for key in attributes])
         return '%s(%s)' % (self.__class__.__name__, arguments)
 
 class NodeEvent(Event):
-    def __init__(self, anchor, start_marker, end_marker):
+    def __init__(self, anchor, start_mark, end_mark):
         self.anchor = anchor
-        self.start_marker = start_marker
-        self.end_marker = end_marker
+        self.start_mark = start_mark
+        self.end_mark = end_mark
 
 class AliasEvent(NodeEvent):
     pass
 
 class ScalarEvent(NodeEvent):
-    def __init__(self, anchor, tag, value, start_marker, end_marker):
+    def __init__(self, anchor, tag, value, start_mark, end_mark):
         self.anchor = anchor
         self.tag = tag
         self.value = value
-        self.start_marker = start_marker
-        self.end_marker = end_marker
+        self.start_mark = start_mark
+        self.end_mark = end_mark
 
 class CollectionEvent(NodeEvent):
-    def __init__(self, anchor, tag, start_marker, end_marker):
+    def __init__(self, anchor, tag, start_mark, end_mark):
         self.anchor = anchor
         self.tag = tag
-        self.start_marker = start_marker
-        self.end_marker = end_marker
+        self.start_mark = start_mark
+        self.end_mark = end_mark
 
 class SequenceEvent(CollectionEvent):
     pass

lib/yaml/nodes.py

 
 class Node:
-    def __init__(self, tag, value, start_marker, end_marker):
+    def __init__(self, tag, value, start_mark, end_mark):
         self.tag = tag
         self.value = value
-        self.start_marker = start_marker
-        self.end_marker = end_marker
+        self.start_mark = start_mark
+        self.end_mark = end_mark
     def __repr__(self):
         value = self.value
         if isinstance(value, list):

lib/yaml/parser.py

                 raise ParserError(None, None,
                         "expected '<document start>', but found %r"
                         % self.scanner.peek().id,
-                        self.scanner.peek().start_marker)
+                        self.scanner.peek().start_mark)
             token = self.scanner.get()
             if self.scanner.check(DirectiveToken,
                     DocumentStartToken, DocumentEndToken, StreamEndToken):
-                yield self.process_empty_scalar(token.end_marker)
+                yield self.process_empty_scalar(token.end_mark)
             else:
                 for event in self.parse_block_node():
                     yield event
 
         # Parse end of stream.
         token = self.scanner.get()
-        yield StreamEndEvent(token.start_marker, token.end_marker)
+        yield StreamEndEvent(token.start_mark, token.end_mark)
 
     def process_directives(self):
         # DIRECTIVE*
             if token.name == u'YAML':
                 if self.yaml_version is not None:
                     raise ParserError(None, None,
-                            "found duplicate YAML directive", token.start_marker)
+                            "found duplicate YAML directive", token.start_mark)
                 major, minor = token.value
                 if major != 1:
                     raise ParserError(None, None,
                             "found incompatible YAML document (version 1.* is required)",
-                            token.start_marker)
+                            token.start_mark)
                 self.yaml_version = token.value
             elif token.name == u'TAG':
                 handle, prefix = token.value
                 if handle in self.tag_handles:
                     raise ParserError(None, None,
                             "duplicate tag handle %r" % handle.encode('utf-8'),
-                            token.start_marker)
+                            token.start_mark)
                 self.tag_handles[handle] = prefix
         for key in self.DEFAULT_TAGS:
             if key not in self.tag_handles:
         #                                       (block_content | indentless_block_sequence)
         if self.scanner.check(AliasToken):
             token = self.scanner.get()
-            yield AliasEvent(token.value, token.start_marker, token.end_marker)
+            yield AliasEvent(token.value, token.start_mark, token.end_mark)
         else:
             anchor = None
             tag = None
-            start_marker = end_marker = tag_marker = None
+            start_mark = end_mark = tag_mark = None
             if self.scanner.check(AnchorToken):
                 token = self.scanner.get()
-                start_marker = end_marker = token.start_marker
+                start_mark = end_mark = token.start_mark
                 anchor = token.value
                 if self.scanner.check(TagToken):
                     token = self.scanner.get()
-                    end_marker = tag_marker = token.start_marker
+                    end_mark = tag_mark = token.start_mark
                     tag = token.value
             elif self.scanner.check(TagToken):
                 token = self.scanner.get()
-                start_marker = end_marker = tag_marker = token.start_marker
+                start_mark = end_mark = tag_mark = token.start_mark
                 tag = token.value
                 if self.scanner.check(AnchorToken):
                     token = self.scanner.get()
-                    end_marker = token.start_marker
+                    end_mark = token.start_mark
                     anchor = token.value
             if tag is not None:
                 handle, suffix = tag
                 if handle is not None:
                     if handle not in self.tag_handles:
-                        raise ParserError("while parsing a node", start_marker,
+                        raise ParserError("while parsing a node", start_mark,
                                 "found undefined tag handle %r" % handle.encode('utf-8'),
-                                tag_marker)
+                                tag_mark)
                     tag = self.tag_handles[handle]+suffix
                 else:
                     tag = suffix
                 if not (self.scanner.check(ScalarToken) and
                         self.scanner.peek().plain):
                     tag = u'!'
-            if start_marker is None:
-                start_marker = self.scanner.peek().start_marker
+            if start_mark is None:
+                start_mark = self.scanner.peek().start_mark
             event = None
             collection_events = None
             if indentless_sequence and self.scanner.check(BlockEntryToken):
-                end_marker = self.scanner.peek().end_marker
-                event = SequenceEvent(anchor, tag, start_marker, end_marker)
+                end_mark = self.scanner.peek().end_mark
+                event = SequenceEvent(anchor, tag, start_mark, end_mark)
                 collection_events = self.parse_indentless_sequence()
             else:
                 if self.scanner.check(ScalarToken):
                     token = self.scanner.get()
-                    end_marker = token.end_marker
+                    end_mark = token.end_mark
                     event = ScalarEvent(anchor, tag, token.value,
-                            start_marker, end_marker)
+                            start_mark, end_mark)
                 elif self.scanner.check(FlowSequenceStartToken):
-                    end_marker = self.scanner.peek().end_marker
-                    event = SequenceEvent(anchor, tag, start_marker, end_marker)
+                    end_mark = self.scanner.peek().end_mark
+                    event = SequenceEvent(anchor, tag, start_mark, end_mark)
                     collection_events = self.parse_flow_sequence()
                 elif self.scanner.check(FlowMappingStartToken):
-                    end_marker = self.scanner.peek().end_marker
-                    event = MappingEvent(anchor, tag, start_marker, end_marker)
+                    end_mark = self.scanner.peek().end_mark
+                    event = MappingEvent(anchor, tag, start_mark, end_mark)
                     collection_events = self.parse_flow_mapping()
                 elif block and self.scanner.check(BlockSequenceStartToken):
-                    end_marker = self.scanner.peek().start_marker
-                    event = SequenceEvent(anchor, tag, start_marker, end_marker)
+                    end_mark = self.scanner.peek().start_mark
+                    event = SequenceEvent(anchor, tag, start_mark, end_mark)
                     collection_events = self.parse_block_sequence()
                 elif block and self.scanner.check(BlockMappingStartToken):
-                    end_marker = self.scanner.peek().start_marker
-                    event = MappingEvent(anchor, tag, start_marker, end_marker)
+                    end_mark = self.scanner.peek().start_mark
+                    event = MappingEvent(anchor, tag, start_mark, end_mark)
                     collection_events = self.parse_block_mapping()
                 else:
                     if block:
                     else:
                         node = 'flow'
                     token = self.scanner.peek()
-                    raise ParserError("while scanning a %s node" % node, start_marker,
+                    raise ParserError("while scanning a %s node" % node, start_mark,
                             "expected the node content, but found %r" % token.id,
-                            token.start_marker)
+                            token.start_mark)
             yield event
             if collection_events is not None:
                 for event in collection_events:
     def parse_block_sequence(self):
         # BLOCK-SEQUENCE-START (BLOCK-ENTRY block_node?)* BLOCK-END
         token = self.scanner.get()
-        start_marker = token.start_marker
+        start_mark = token.start_mark
         while self.scanner.check(BlockEntryToken):
             token = self.scanner.get()
             if not self.scanner.check(BlockEntryToken, BlockEndToken):
                 for event in self.parse_block_node():
                     yield event
             else:
-                yield self.process_empty_scalar(token.end_marker)
+                yield self.process_empty_scalar(token.end_mark)
         if not self.scanner.check(BlockEndToken):
             token = self.scanner.peek()
-            raise ParserError("while scanning a block collection", start_marker,
-                    "expected <block end>, but found %r" % token.id, token.start_marker)
+            raise ParserError("while scanning a block collection", start_mark,
+                    "expected <block end>, but found %r" % token.id, token.start_mark)
         token = self.scanner.get()
-        yield CollectionEndEvent(token.start_marker, token.end_marker)
+        yield CollectionEndEvent(token.start_mark, token.end_mark)
 
     def parse_indentless_sequence(self):
         # (BLOCK-ENTRY block_node?)+
                 for event in self.parse_block_node():
                     yield event
             else:
-                yield self.process_empty_scalar(token.end_marker)
+                yield self.process_empty_scalar(token.end_mark)
         token = self.scanner.peek()
-        yield CollectionEndEvent(token.start_marker, token.start_marker)
+        yield CollectionEndEvent(token.start_mark, token.start_mark)
 
     def parse_block_mapping(self):
         # BLOCK-MAPPING_START
         #   (VALUE block_node_or_indentless_sequence?)?)*
         # BLOCK-END
         token = self.scanner.get()
-        start_marker = token.start_marker
+        start_mark = token.start_mark
         while self.scanner.check(KeyToken, ValueToken):
             if self.scanner.check(KeyToken):
                 token = self.scanner.get()
                     for event in self.parse_block_node_or_indentless_sequence():
                         yield event
                 else:
-                    yield self.process_empty_scalar(token.end_marker)
+                    yield self.process_empty_scalar(token.end_mark)
             if self.scanner.check(ValueToken):
                 token = self.scanner.get()
                 if not self.scanner.check(KeyToken, ValueToken, BlockEndToken):
                     for event in self.parse_block_node_or_indentless_sequence():
                         yield event
                 else:
-                    yield self.process_empty_scalar(token.end_marker)
+                    yield self.process_empty_scalar(token.end_mark)
             else:
                 token = self.scanner.peek()
-                yield self.process_empty_scalar(token.start_marker)
+                yield self.process_empty_scalar(token.start_mark)
         if not self.scanner.check(BlockEndToken):
             token = self.scanner.peek()
-            raise ParserError("while scanning a block mapping", start_marker,
-                    "expected <block end>, but found %r" % token.id, token.start_marker)
+            raise ParserError("while scanning a block mapping", start_mark,
+                    "expected <block end>, but found %r" % token.id, token.start_mark)
         token = self.scanner.get()
-        yield CollectionEndEvent(token.start_marker, token.end_marker)
+        yield CollectionEndEvent(token.start_mark, token.end_mark)
 
     def parse_flow_sequence(self):
         # flow_sequence     ::= FLOW-SEQUENCE-START
         # For `flow_sequence_entry`, the part `KEY flow_node? (VALUE flow_node?)?`
         # generate an inline mapping (set syntax).
         token = self.scanner.get()
-        start_marker = token.start_marker
+        start_mark = token.start_mark
         while not self.scanner.check(FlowSequenceEndToken):
             if self.scanner.check(KeyToken):
                 token = self.scanner.get()
                 yield MappingEvent(None, u'!',
-                        token.start_marker, token.end_marker)
+                        token.start_mark, token.end_mark)
                 if not self.scanner.check(ValueToken,
                         FlowEntryToken, FlowSequenceEndToken):
                     for event in self.parse_flow_node():
                         yield event
                 else:
-                    yield self.process_empty_scalar(token.end_marker)
+                    yield self.process_empty_scalar(token.end_mark)
                 if self.scanner.check(ValueToken):
                     token = self.scanner.get()
                     if not self.scanner.check(FlowEntryToken, FlowSequenceEndToken):
                         for event in self.parse_flow_node():
                             yield event
                     else:
-                        yield self.process_empty_scalar(token.end_marker)
+                        yield self.process_empty_scalar(token.end_mark)
                 else:
                     token = self.scanner.peek()
-                    yield self.process_empty_scalar(token.start_marker)
+                    yield self.process_empty_scalar(token.start_mark)
                 token = self.scanner.peek()
-                yield CollectionEndEvent(token.start_marker, token.start_marker)
+                yield CollectionEndEvent(token.start_mark, token.start_mark)
             else:
                 for event in self.parse_flow_node():
                     yield event
             if not self.scanner.check(FlowEntryToken, FlowSequenceEndToken):
                 token = self.scanner.peek()
-                raise ParserError("while scanning a flow sequence", start_marker,
-                        "expected ',' or ']', but got %r" % token.id, token.start_marker)
+                raise ParserError("while scanning a flow sequence", start_mark,
+                        "expected ',' or ']', but got %r" % token.id, token.start_mark)
             if self.scanner.check(FlowEntryToken):
                 self.scanner.get()
         token = self.scanner.get()
-        yield CollectionEndEvent(token.start_marker, token.end_marker)
+        yield CollectionEndEvent(token.start_mark, token.end_mark)
 
     def parse_flow_mapping(self):
         # flow_mapping      ::= FLOW-MAPPING-START
         #                       FLOW-MAPPING-END
         # flow_mapping_entry    ::= flow_node | KEY flow_node? (VALUE flow_node?)?
         token = self.scanner.get()
-        start_marker = token.start_marker
+        start_mark = token.start_mark
         while not self.scanner.check(FlowMappingEndToken):
             if self.scanner.check(KeyToken):
                 token = self.scanner.get()
                     for event in self.parse_flow_node():
                         yield event
                 else:
-                    yield self.process_empty_scalar(token.end_marker)
+                    yield self.process_empty_scalar(token.end_mark)
                 if self.scanner.check(ValueToken):
                     token = self.scanner.get()
                     if not self.scanner.check(FlowEntryToken, FlowMappingEndToken):
                         for event in self.parse_flow_node():
                             yield event
                     else:
-                        yield self.process_empty_scalar(token.end_marker)
+                        yield self.process_empty_scalar(token.end_mark)
                 else:
                     token = self.scanner.peek()
-                    yield self.process_empty_scalar(token.start_marker)
+                    yield self.process_empty_scalar(token.start_mark)
             else:
                 for event in self.parse_flow_node():
                     yield event
-                yield self.process_empty_scalar(self.scanner.peek().start_marker)
+                yield self.process_empty_scalar(self.scanner.peek().start_mark)
             if not self.scanner.check(FlowEntryToken, FlowMappingEndToken):
                 token = self.scanner.peek()
-                raise ParserError("while scanning a flow mapping", start_marker,
-                        "expected ',' or '}', but got %r" % token.id, token.start_marker)
+                raise ParserError("while scanning a flow mapping", start_mark,
+                        "expected ',' or '}', but got %r" % token.id, token.start_mark)
             if self.scanner.check(FlowEntryToken):
                 self.scanner.get()
         if not self.scanner.check(FlowMappingEndToken):
             token = self.scanner.peek()
-            raise ParserError("while scanning a flow mapping", start_marker,
-                    "expected '}', but found %r" % token.id, token.start_marker)
+            raise ParserError("while scanning a flow mapping", start_mark,
+                    "expected '}', but found %r" % token.id, token.start_mark)
         token = self.scanner.get()
-        yield CollectionEndEvent(token.start_marker, token.end_marker)
+        yield CollectionEndEvent(token.start_mark, token.end_mark)
 
-    def process_empty_scalar(self, marker):
-        return ScalarEvent(None, None, u'', marker, marker)
+    def process_empty_scalar(self, mark):
+        return ScalarEvent(None, None, u'', mark, mark)
 

lib/yaml/reader.py

 #
 # We define two classes here.
 #
-#   Marker(source, line, column)
+#   Mark(source, line, column)
 # It's just a record and its only use is producing nice error messages.
 # Parser does not use it for any other purposes.
 #
 
 __all__ = ['Reader', 'ReaderError']
 
-from error import YAMLError, Marker
+from error import YAMLError, Mark
 
 import codecs, re
 
             elif ch != u'\uFEFF':
                 self.column += 1
 
-    def get_marker(self):
+    def get_mark(self):
         if self.stream is None:
-            return Marker(self.name, self.line, self.column,
+            return Mark(self.name, self.line, self.column,
                     self.buffer, self.pointer)
         else:
-            return Marker(self.name, self.line, self.column, None, None)
+            return Mark(self.name, self.line, self.column, None, None)
 
     def determine_encoding(self):
         while not self.eof and len(self.raw_buffer) < 2:

lib/yaml/scanner.py

 class SimpleKey:
     # See below simple keys treatment.
 
-    def __init__(self, token_number, required, index, line, column, marker):
+    def __init__(self, token_number, required, index, line, column, mark):
         self.token_number = token_number
         self.required = required
         self.index = index
         self.line = line
         self.column = column
-        self.marker = marker
+        self.mark = mark
 
 class Scanner:
 
         # Keep track of possible simple keys. This is a dictionary. The key
         # is `flow_level`; there can be no more that one possible simple key
         # for each level. The value is a SimpleKey record:
-        #   (token_number, required, index, line, column, marker)
+        #   (token_number, required, index, line, column, mark)
         # A simple key may start with ALIAS, ANCHOR, TAG, SCALAR(flow),
         # '[', or '{' tokens.
         self.possible_simple_keys = {}
         # No? It's an error. Let's produce a nice error message.
         raise ScannerError("while scanning for the next token", None,
                 "found character %r that cannot start any token"
-                % ch.encode('utf-8'), self.reader.get_marker())
+                % ch.encode('utf-8'), self.reader.get_mark())
 
     # Simple keys treatment.
 
             if key.line != self.reader.line  \
                     or self.reader.index-key.index > 1024:
                 if key.required:
-                    raise ScannerError("while scanning a simple key", key.marker,
-                            "could not found expected ':'", self.reader.get_marker())
+                    raise ScannerError("while scanning a simple key", key.mark,
+                            "could not found expected ':'", self.reader.get_mark())
                 del self.possible_simple_keys[level]
 
     def save_possible_simple_key(self):
             index = self.reader.index
             line = self.reader.line
             column = self.reader.column
-            marker = self.reader.get_marker()
+            mark = self.reader.get_mark()
             key = SimpleKey(token_number, required,
-                    index, line, column, marker)
+                    index, line, column, mark)
             self.possible_simple_keys[self.flow_level] = key
 
     def remove_possible_simple_key(self):
             # I don't think it's possible, but I could be wrong.
             assert not key.required
             #if key.required:
-            #    raise ScannerError("while scanning a simple key", key.marker,
-            #            "could not found expected ':'", self.reader.get_marker())
+            #    raise ScannerError("while scanning a simple key", key.mark,
+            #            "could not found expected ':'", self.reader.get_mark())
 
     # Indentation functions.
 
         if self.flow_level and self.indent > column:
             raise ScannerError(None, None,
                     "invalid intendation or unclosed '[' or '{'",
-                    self.reader.get_marker())
+                    self.reader.get_mark())
 
         # In block context, we may need to issue the BLOCK-END tokens.
         while self.indent > column:
-            marker = self.reader.get_marker()
+            mark = self.reader.get_mark()
             self.indent = self.indents.pop()
-            self.tokens.append(BlockEndToken(marker, marker))
+            self.tokens.append(BlockEndToken(mark, mark))
 
     def add_indent(self, column):
         # Check if we need to increase indentation.
         self.possible_simple_keys = {}
 
         # Read the token.
-        marker = self.reader.get_marker()
+        mark = self.reader.get_mark()
         
         # Add END.
-        self.tokens.append(StreamEndToken(marker, marker))
+        self.tokens.append(StreamEndToken(mark, mark))
 
         # The reader is ended.
         self.done = True
         self.allow_simple_key = False
 
         # Add DOCUMENT-START or DOCUMENT-END.
-        start_marker = self.reader.get_marker()
+        start_mark = self.reader.get_mark()
         self.reader.forward(3)
-        end_marker = self.reader.get_marker()
-        self.tokens.append(TokenClass(start_marker, end_marker))
+        end_mark = self.reader.get_mark()
+        self.tokens.append(TokenClass(start_mark, end_mark))
 
     def fetch_flow_sequence_start(self):
         self.fetch_flow_collection_start(FlowSequenceStartToken)
         self.allow_simple_key = True
 
         # Add FLOW-SEQUENCE-START or FLOW-MAPPING-START.
-        start_marker = self.reader.get_marker()
+        start_mark = self.reader.get_mark()
         self.reader.forward()
-        end_marker = self.reader.get_marker()
-        self.tokens.append(TokenClass(start_marker, end_marker))
+        end_mark = self.reader.get_mark()
+        self.tokens.append(TokenClass(start_mark, end_mark))
 
     def fetch_flow_sequence_end(self):
         self.fetch_flow_collection_end(FlowSequenceEndToken)
         self.allow_simple_key = False
 
         # Add FLOW-SEQUENCE-END or FLOW-MAPPING-END.
-        start_marker = self.reader.get_marker()
+        start_mark = self.reader.get_mark()
         self.reader.forward()
-        end_marker = self.reader.get_marker()
-        self.tokens.append(TokenClass(start_marker, end_marker))
+        end_mark = self.reader.get_mark()
+        self.tokens.append(TokenClass(start_mark, end_mark))
 
     def fetch_flow_entry(self):
 
         self.remove_possible_simple_key()
 
         # Add FLOW-ENTRY.
-        start_marker = self.reader.get_marker()
+        start_mark = self.reader.get_mark()
         self.reader.forward()
-        end_marker = self.reader.get_marker()
-        self.tokens.append(FlowEntryToken(start_marker, end_marker))
+        end_mark = self.reader.get_mark()
+        self.tokens.append(FlowEntryToken(start_mark, end_mark))
 
     def fetch_block_entry(self):
 
             if not self.allow_simple_key:
                 raise ScannerError(None, None,
                         "sequence entries are not allowed here",
-                        self.reader.get_marker())
+                        self.reader.get_mark())
 
             # We may need to add BLOCK-SEQUENCE-START.
             if self.add_indent(self.reader.column):
-                marker = self.reader.get_marker()
-                self.tokens.append(BlockSequenceStartToken(marker, marker))
+                mark = self.reader.get_mark()
+                self.tokens.append(BlockSequenceStartToken(mark, mark))
 
         # It's an error for the block entry to occur in the flow context,
         # but we let the parser detect this.
         self.remove_possible_simple_key()
 
         # Add BLOCK-ENTRY.
-        start_marker = self.reader.get_marker()
+        start_mark = self.reader.get_mark()
         self.reader.forward()
-        end_marker = self.reader.get_marker()
-        self.tokens.append(BlockEntryToken(start_marker, end_marker))
+        end_mark = self.reader.get_mark()
+        self.tokens.append(BlockEntryToken(start_mark, end_mark))
 
     def fetch_key(self):
         
             if not self.allow_simple_key:
                 raise ScannerError(None, None,
                         "mapping keys are not allowed here",
-                        self.reader.get_marker())
+                        self.reader.get_mark())
 
             # We may need to add BLOCK-MAPPING-START.
             if self.add_indent(self.reader.column):
-                marker = self.reader.get_marker()
-                self.tokens.append(BlockMappingStartToken(marker, marker))
+                mark = self.reader.get_mark()
+                self.tokens.append(BlockMappingStartToken(mark, mark))
 
         # Simple keys are allowed after '?' in the block context.
         self.allow_simple_key = not self.flow_level
         self.remove_possible_simple_key()
 
         # Add KEY.
-        start_marker = self.reader.get_marker()
+        start_mark = self.reader.get_mark()
         self.reader.forward()
-        end_marker = self.reader.get_marker()
-        self.tokens.append(KeyToken(start_marker, end_marker))
+        end_mark = self.reader.get_mark()
+        self.tokens.append(KeyToken(start_mark, end_mark))
 
     def fetch_value(self):
 
             key = self.possible_simple_keys[self.flow_level]
             del self.possible_simple_keys[self.flow_level]
             self.tokens.insert(key.token_number-self.tokens_taken,
-                    KeyToken(key.marker, key.marker))
+                    KeyToken(key.mark, key.mark))
 
             # If this key starts a new block mapping, we need to add
             # BLOCK-MAPPING-START.
             if not self.flow_level:
                 if self.add_indent(key.column):
                     self.tokens.insert(key.token_number-self.tokens_taken,
-                            BlockMappingStartToken(key.marker, key.marker))
+                            BlockMappingStartToken(key.mark, key.mark))
 
             # There cannot be two simple keys one after another.
             self.allow_simple_key = False
                 if not self.allow_simple_key:
                     raise ScannerError(None, None,
                             "mapping values are not allowed here",
-                            self.reader.get_marker())
+                            self.reader.get_mark())
 
             # Simple keys are allowed after ':' in the block context.
             self.allow_simple_key = not self.flow_level
             self.remove_possible_simple_key()
 
         # Add VALUE.
-        start_marker = self.reader.get_marker()
+        start_mark = self.reader.get_mark()
         self.reader.forward()
-        end_marker = self.reader.get_marker()
-        self.tokens.append(ValueToken(start_marker, end_marker))
+        end_mark = self.reader.get_mark()
+        self.tokens.append(ValueToken(start_mark, end_mark))
 
     def fetch_alias(self):
 
 
     def scan_directive(self):
         # See the specification for details.
-        start_marker = self.reader.get_marker()
+        start_mark = self.reader.get_mark()
         self.reader.forward()
-        name = self.scan_directive_name(start_marker)
+        name = self.scan_directive_name(start_mark)
         value = None
         if name == u'YAML':
-            value = self.scan_yaml_directive_value(start_marker)
-            end_marker = self.reader.get_marker()
+            value = self.scan_yaml_directive_value(start_mark)
+            end_mark = self.reader.get_mark()
         elif name == u'TAG':
-            value = self.scan_tag_directive_value(start_marker)
-            end_marker = self.reader.get_marker()
+            value = self.scan_tag_directive_value(start_mark)
+            end_mark = self.reader.get_mark()
         else:
-            end_marker = self.reader.get_marker()
+            end_mark = self.reader.get_mark()
             while self.reader.peek() not in u'\0\r\n\x85\u2028\u2029':
                 self.reader.forward()
-        self.scan_directive_ignored_line(start_marker)
-        return DirectiveToken(name, value, start_marker, end_marker)
+        self.scan_directive_ignored_line(start_mark)
+        return DirectiveToken(name, value, start_mark, end_mark)
 
-    def scan_directive_name(self, start_marker):
+    def scan_directive_name(self, start_mark):
         # See the specification for details.
         length = 0
         ch = self.reader.peek(length)
             length += 1
             ch = self.reader.peek(length)
         if not length:
-            raise ScannerError("while scanning a directive", start_marker,
+            raise ScannerError("while scanning a directive", start_mark,
                     "expected alphabetic or numeric character, but found %r"
-                    % ch.encode('utf-8'), self.reader.get_marker())
+                    % ch.encode('utf-8'), self.reader.get_mark())
         value = self.reader.prefix(length)
         self.reader.forward(length)
         ch = self.reader.peek()
         if ch not in u'\0 \r\n\x85\u2028\u2029':
-            raise ScannerError("while scanning a directive", start_marker,
+            raise ScannerError("while scanning a directive", start_mark,
                     "expected alphabetic or numeric character, but found %r"
-                    % ch.encode('utf-8'), self.reader.get_marker())
+                    % ch.encode('utf-8'), self.reader.get_mark())
         return value
 
-    def scan_yaml_directive_value(self, start_marker):
+    def scan_yaml_directive_value(self, start_mark):
         # See the specification for details.
         while self.reader.peek() == u' ':
             self.reader.forward()
-        major = self.scan_yaml_directive_number(start_marker)
+        major = self.scan_yaml_directive_number(start_mark)
         if self.reader.peek() != '.':
-            raise ScannerError("while scanning a directive", start_marker,
+            raise ScannerError("while scanning a directive", start_mark,
                     "expected a digit or '.', but found %r"
                     % self.reader.peek().encode('utf-8'),
-                    self.reader.get_marker())
+                    self.reader.get_mark())
         self.reader.forward()
-        minor = self.scan_yaml_directive_number(start_marker)
+        minor = self.scan_yaml_directive_number(start_mark)
         if self.reader.peek() not in u'\0 \r\n\x85\u2028\u2029':
-            raise ScannerError("while scanning a directive", start_marker,
+            raise ScannerError("while scanning a directive", start_mark,
                     "expected a digit or ' ', but found %r"
                     % self.reader.peek().encode('utf-8'),
-                    self.reader.get_marker())
+                    self.reader.get_mark())
         return (major, minor)
 
-    def scan_yaml_directive_number(self, start_marker):
+    def scan_yaml_directive_number(self, start_mark):
         # See the specification for details.
         ch = self.reader.peek()
         if not (u'0' <= ch <= '9'):
-            raise ScannerError("while scanning a directive", start_marker,
+            raise ScannerError("while scanning a directive", start_mark,
                     "expected a digit, but found %r" % ch.encode('utf-8'),
-                    self.reader.get_marker())
+                    self.reader.get_mark())
         length = 0
         while u'0' <= self.reader.peek(length) <= u'9':
             length += 1
         self.reader.forward(length)
         return value
 
-    def scan_tag_directive_value(self, start_marker):
+    def scan_tag_directive_value(self, start_mark):
         # See the specification for details.
         while self.reader.peek() == u' ':
             self.reader.forward()
-        handle = self.scan_tag_directive_handle(start_marker)
+        handle = self.scan_tag_directive_handle(start_mark)
         while self.reader.peek() == u' ':
             self.reader.forward()
-        prefix = self.scan_tag_directive_prefix(start_marker)
+        prefix = self.scan_tag_directive_prefix(start_mark)
         return (handle, prefix)
 
-    def scan_tag_directive_handle(self, start_marker):
+    def scan_tag_directive_handle(self, start_mark):
         # See the specification for details.
-        value = self.scan_tag_handle('directive', start_marker)
+        value = self.scan_tag_handle('directive', start_mark)
         ch = self.reader.peek()
         if ch != u' ':
-            raise ScannerError("while scanning a directive", start_marker,
+            raise ScannerError("while scanning a directive", start_mark,
                     "expected ' ', but found %r" % ch.encode('utf-8'),
-                    self.reader.get_marker())
+                    self.reader.get_mark())
         return value
 
-    def scan_tag_directive_prefix(self, start_marker):
+    def scan_tag_directive_prefix(self, start_mark):
         # See the specification for details.
-        value = self.scan_tag_uri('directive', start_marker)
+        value = self.scan_tag_uri('directive', start_mark)
         ch = self.reader.peek()
         if ch not in u'\0 \r\n\x85\u2028\u2029':
-            raise ScannerError("while scanning a directive", start_marker,
+            raise ScannerError("while scanning a directive", start_mark,
                     "expected ' ', but found %r" % ch.encode('utf-8'),
-                    self.reader.get_marker())
+                    self.reader.get_mark())
         return value
 
-    def scan_directive_ignored_line(self, start_marker):
+    def scan_directive_ignored_line(self, start_mark):
         # See the specification for details.
         while self.reader.peek() == u' ':
             self.reader.forward()
                 self.reader.forward()
         ch = self.reader.peek()
         if ch not in u'\0\r\n\x85\u2028\u2029':
-            raise ScannerError("while scanning a directive", start_marker,
+            raise ScannerError("while scanning a directive", start_mark,
                     "expected a comment or a line break, but found %r"
-                        % ch.encode('utf-8'), self.reader.get_marker())
+                        % ch.encode('utf-8'), self.reader.get_mark())
         self.scan_line_break()
 
     def scan_anchor(self, TokenClass):
         # and
         #   [ *alias , "value" ]
         # Therefore we restrict aliases to numbers and ASCII letters.
-        start_marker = self.reader.get_marker()
+        start_mark = self.reader.get_mark()
         indicator = self.reader.peek()
         if indicator == '*':
             name = 'alias'
             length += 1
             ch = self.reader.peek(length)
         if not length:
-            raise ScannerError("while scanning an %s" % name, start_marker,
+            raise ScannerError("while scanning an %s" % name, start_mark,
                     "expected alphabetic or numeric character, but found %r"
-                    % ch.encode('utf-8'), self.reader.get_marker())
+                    % ch.encode('utf-8'), self.reader.get_mark())
         value = self.reader.prefix(length)
         self.reader.forward(length)
         ch = self.reader.peek()
         if ch not in u'\0 \t\r\n\x85\u2028\u2029?:,]}%@`':
-            raise ScannerError("while scanning an %s" % name, start_marker,
+            raise ScannerError("while scanning an %s" % name, start_mark,
                     "expected alphabetic or numeric character, but found %r"
-                    % ch.encode('utf-8'), self.reader.get_marker())
-        end_marker = self.reader.get_marker()
-        return TokenClass(value, start_marker, end_marker)
+                    % ch.encode('utf-8'), self.reader.get_mark())
+        end_mark = self.reader.get_mark()
+        return TokenClass(value, start_mark, end_mark)
 
     def scan_tag(self):
         # See the specification for details.
-        start_marker = self.reader.get_marker()
+        start_mark = self.reader.get_mark()
         ch = self.reader.peek(1)
         if ch == u'<':
             handle = None
             self.reader.forward(2)
-            suffix = self.scan_tag_uri('tag', start_marker)
+            suffix = self.scan_tag_uri('tag', start_mark)
             if self.reader.peek() != u'>':
-                raise ScannerError("while parsing a tag", start_marker,
+                raise ScannerError("while parsing a tag", start_mark,
                         "expected '>', but found %r" % self.reader.peek().encode('utf-8'),
-                        self.reader.get_marker())
+                        self.reader.get_mark())
             self.reader.forward()
         elif ch in u'\0 \t\r\n\x85\u2028\u2029':
             handle = None
                 ch = self.reader.peek(length)
             handle = u'!'
             if use_handle:
-                handle = self.scan_tag_handle('tag', start_marker)
+                handle = self.scan_tag_handle('tag', start_mark)
             else:
                 handle = u'!'
                 self.reader.forward()
-            suffix = self.scan_tag_uri('tag', start_marker)
+            suffix = self.scan_tag_uri('tag', start_mark)
         ch = self.reader.peek()
         if ch not in u'\0 \r\n\x85\u2028\u2029':
-            raise ScannerError("while scanning a tag", start_marker,
+            raise ScannerError("while scanning a tag", start_mark,
                     "expected ' ', but found %r" % ch.encode('utf-8'),
-                    self.reader.get_marker())
+                    self.reader.get_mark())
         value = (handle, suffix)
-        end_marker = self.reader.get_marker()
-        return TagToken(value, start_marker, end_marker)
+        end_mark = self.reader.get_mark()
+        return TagToken(value, start_mark, end_mark)
 
     def scan_block_scalar(self, folded):
         # See the specification for details.
 
         chunks = []
-        start_marker = self.reader.get_marker()
+        start_mark = self.reader.get_mark()
 
         # Scan the header.
         self.reader.forward()
-        chomping, increment = self.scan_block_scalar_indicators(start_marker)
-        self.scan_block_scalar_ignored_line(start_marker)
+        chomping, increment = self.scan_block_scalar_indicators(start_mark)
+        self.scan_block_scalar_ignored_line(start_mark)
 
         # Determine the indentation level and go to the first non-empty line.
         min_indent = self.indent+1
         if min_indent < 1:
             min_indent = 1
         if increment is None:
-            breaks, max_indent, end_marker = self.scan_block_scalar_indentation()
+            breaks, max_indent, end_mark = self.scan_block_scalar_indentation()
             indent = max(min_indent, max_indent)
         else:
             indent = min_indent+increment-1
-            breaks, end_marker = self.scan_block_scalar_breaks(indent)
+            breaks, end_mark = self.scan_block_scalar_breaks(indent)
         line_break = u''
 
         # Scan the inner part of the block scalar.
             chunks.append(self.reader.prefix(length))
             self.reader.forward(length)
             line_break = self.scan_line_break()
-            breaks, end_marker = self.scan_block_scalar_breaks(indent)
+            breaks, end_mark = self.scan_block_scalar_breaks(indent)
             if self.reader.column == indent and self.reader.peek() != u'\0':
                 # Unfortunately, folding rules are ambiguous.
                 #
             chunks.extend(breaks)
 
         # We are done.
-        return ScalarToken(u''.join(chunks), False, start_marker, end_marker)
+        return ScalarToken(u''.join(chunks), False, start_mark, end_mark)
 
-    def scan_block_scalar_indicators(self, start_marker):
+    def scan_block_scalar_indicators(self, start_mark):
         # See the specification for details.
         chomping = None
         increment = None
             if ch in u'0123456789':
                 increment = int(ch)
                 if increment == 0:
-                    raise ScannerError("while scanning a block scalar", start_marker,
+                    raise ScannerError("while scanning a block scalar", start_mark,
                             "expected indentation indicator in the range 1-9, but found 0",
-                            self.reader.get_marker())
+                            self.reader.get_mark())
                 self.reader.forward()
         elif ch in u'0123456789':
             increment = int(ch)
             if increment == 0:
-                raise ScannerError("while scanning a block scalar", start_marker,
+                raise ScannerError("while scanning a block scalar", start_mark,
                         "expected indentation indicator in the range 1-9, but found 0",
-                        self.reader.get_marker())
+                        self.reader.get_mark())
             self.reader.forward()
             ch = self.reader.peek()
             if ch in u'+-':
                 self.reader.forward()
         ch = self.reader.peek()
         if ch not in u'\0 \r\n\x85\u2028\u2029':
-            raise ScannerError("while scanning a block scalar", start_marker,
+            raise ScannerError("while scanning a block scalar", start_mark,
                     "expected chomping or indentation indicators, but found %r"
-                        % ch.encode('utf-8'), self.reader.get_marker())
+                        % ch.encode('utf-8'), self.reader.get_mark())
         return chomping, increment
 
-    def scan_block_scalar_ignored_line(self, start_marker):
+    def scan_block_scalar_ignored_line(self, start_mark):
         # See the specification for details.
         while self.reader.peek() == u' ':
             self.reader.forward()
                 self.reader.forward()
         ch = self.reader.peek()
         if ch not in u'\0\r\n\x85\u2028\u2029':
-            raise ScannerError("while scanning a block scalar", start_marker,
+            raise ScannerError("while scanning a block scalar", start_mark,
                     "expected a comment or a line break, but found %r"
-                        % ch.encode('utf-8'), self.reader.get_marker())
+                        % ch.encode('utf-8'), self.reader.get_mark())
         self.scan_line_break()
 
     def scan_block_scalar_indentation(self):
         # See the specification for details.
         chunks = []
         max_indent = 0
-        end_marker = self.reader.get_marker()
+        end_mark = self.reader.get_mark()
         while self.reader.peek() in u' \r\n\x85\u2028\u2029':
             if self.reader.peek() != u' ':
                 chunks.append(self.scan_line_break())
-                end_marker = self.reader.get_marker()
+                end_mark = self.reader.get_mark()
             else:
                 self.reader.forward()
                 if self.reader.column > max_indent:
                     max_indent = self.reader.column
-        return chunks, max_indent, end_marker
+        return chunks, max_indent, end_mark
 
     def scan_block_scalar_breaks(self, indent):
         # See the specification for details.
         chunks = []
-        end_marker = self.reader.get_marker()
+        end_mark = self.reader.get_mark()
         while self.reader.column < indent and self.reader.peek() == u' ':
             self.reader.forward()
         while self.reader.peek() in u'\r\n\x85\u2028\u2029':
             chunks.append(self.scan_line_break())
-            end_marker = self.reader.get_marker()
+            end_mark = self.reader.get_mark()
             while self.reader.column < indent and self.reader.peek() == u' ':
                 self.reader.forward()
-        return chunks, end_marker
+        return chunks, end_mark
 
     def scan_flow_scalar(self, double):
         # See the specification for details.
         chunks = []
-        start_marker = self.reader.get_marker()
+        start_mark = self.reader.get_mark()
         indent = self.indent+1
         if indent == 0:
             indent = 1
         quote = self.reader.peek()
         self.reader.forward()
-        chunks.extend(self.scan_flow_scalar_non_spaces(double, indent, start_marker))
+        chunks.extend(self.scan_flow_scalar_non_spaces(double, indent, start_mark))
         while self.reader.peek() != quote:
-            chunks.extend(self.scan_flow_scalar_spaces(double, indent, start_marker))
-            chunks.extend(self.scan_flow_scalar_non_spaces(double, indent, start_marker))
+            chunks.extend(self.scan_flow_scalar_spaces(double, indent, start_mark))
+            chunks.extend(self.scan_flow_scalar_non_spaces(double, indent, start_mark))
         self.reader.forward()
-        end_marker = self.reader.get_marker()
-        return ScalarToken(u''.join(chunks), False, start_marker, end_marker)
+        end_mark = self.reader.get_mark()
+        return ScalarToken(u''.join(chunks), False, start_mark, end_mark)
 
     ESCAPE_REPLACEMENTS = {
         u'0':   u'\0',
         u'U':   8,
     }
 
-    def scan_flow_scalar_non_spaces(self, double, indent, start_marker):
+    def scan_flow_scalar_non_spaces(self, double, indent, start_mark):
         # See the specification for details.
         chunks = []
         while True:
                     self.reader.forward()
                     for k in range(length):
                         if self.reader.peek(k) not in u'0123456789ABCDEFabcdef':
-                            raise ScannerError("while scanning a double-quoted scalar", start_marker,
+                            raise ScannerError("while scanning a double-quoted scalar", start_mark,
                                     "expected escape sequence of %d hexdecimal numbers, but found %r" %
-                                        (length, self.reader.peek(k).encode('utf-8')), self.reader.get_marker())
+                                        (length, self.reader.peek(k).encode('utf-8')), self.reader.get_mark())
                     code = int(self.reader.prefix(length), 16)
                     chunks.append(unichr(code))
                     self.reader.forward(length)
                 elif ch in u'\r\n\x85\u2028\u2029':
                     self.scan_line_break()
-                    chunks.extend(self.scan_flow_scalar_breaks(double, indent, start_marker))
+                    chunks.extend(self.scan_flow_scalar_breaks(double, indent, start_mark))
                 else:
-                    raise ScannerError("while scanning a double-quoted scalar", start_marker,
-                            "found unknown escape character %r" % ch.encode('utf-8'), self.reader.get_marker())
+                    raise ScannerError("while scanning a double-quoted scalar", start_mark,
+                            "found unknown escape character %r" % ch.encode('utf-8'), self.reader.get_mark())
             else:
                 return chunks
 
-    def scan_flow_scalar_spaces(self, double, indent, start_marker):
+    def scan_flow_scalar_spaces(self, double, indent, start_mark):
         # See the specification for details.
         chunks = []
         length = 0
         self.reader.forward(length)
         ch = self.reader.peek()
         if ch == u'\0':
-            raise ScannerError("while scanning a quoted scalar", start_marker,
-                    "found unexpected end of stream", self.reader.get_marker())
+            raise ScannerError("while scanning a quoted scalar", start_mark,
+                    "found unexpected end of stream", self.reader.get_mark())
         elif ch in u'\r\n\x85\u2028\u2029':
             line_break = self.scan_line_break()
-            breaks = self.scan_flow_scalar_breaks(double, indent, start_marker)
+            breaks = self.scan_flow_scalar_breaks(double, indent, start_mark)
             if line_break != u'\n':
                 chunks.append(line_break)
             elif not breaks:
             chunks.append(whitespaces)
         return chunks
 
-    def scan_flow_scalar_breaks(self, double, indent, start_marker):
+    def scan_flow_scalar_breaks(self, double, indent, start_mark):
         # See the specification for details.
         chunks = []
         while True:
                 s = 's'
                 if indent == 1:
                     s = ''
-                raise ScannerError("while scanning a quoted scalar", start_marker,
+                raise ScannerError("while scanning a quoted scalar", start_mark,
                         "expected %d space%s indentation, but found %r"
                         % (indent, s, self.reader.peek().encode('utf-8')),
-                        self.reader.get_marker())
+                        self.reader.get_mark())
             while self.reader.peek() in u' \t':
                 self.reader.forward()
             if self.reader.peek() in u'\r\n\x85\u2028\u2029':
         #   plain scalars in the flow context cannot contain ':' and '?'.
         # We also keep track of the `allow_simple_key` flag here.
         chunks = []
-        start_marker = self.reader.get_marker()
-        end_marker = start_marker
+        start_mark = self.reader.get_mark()
+        end_mark = start_mark
         indent = self.indent+1
         if indent == 0:
             indent = 1
             chunks.extend(spaces)
             chunks.append(self.reader.prefix(length))
             self.reader.forward(length)
-            end_marker = self.reader.get_marker()
+            end_mark = self.reader.get_mark()
             spaces = self.scan_plain_spaces(indent)
             if not spaces or self.reader.peek() == u'#' \
                     or self.reader.column < indent:
                 break
-        return ScalarToken(u''.join(chunks), True, start_marker, end_marker)
+        return ScalarToken(u''.join(chunks), True, start_mark, end_mark)
 
     def scan_plain_spaces(self, indent):
         # See the specification for details.
             chunks.append(whitespaces)
         return chunks
 
-    def scan_tag_handle(self, name, start_marker):
+    def scan_tag_handle(self, name, start_mark):
         # See the specification for details.
         # For some strange reasons, the specification does not allow '_' in
         # tag handles. I have allowed it anyway.
         ch = self.reader.peek()
         if ch != u'!':
-            raise ScannerError("while scanning a %s" % name, start_marker,
+            raise ScannerError("while scanning a %s" % name, start_mark,
                     "expected '!', but found %r" % ch.encode('utf-8'),
-                    self.reader.get_marker())
+                    self.reader.get_mark())
         length = 1
         ch = self.reader.peek(length)
         if ch != u' ':
                 ch = self.reader.peek(length)
             if ch != u'!':
                 self.reader.forward(length)
-                raise ScannerError("while scanning a %s" % name, start_marker,
+                raise ScannerError("while scanning a %s" % name, start_mark,
                         "expected '!', but found %r" % ch.encode('utf-8'),
-                        self.reader.get_marker())
+                        self.reader.get_mark())
             length += 1
         value = self.reader.prefix(length)
         self.reader.forward(length)
         return value
 
-    def scan_tag_uri(self, name, start_marker):
+    def scan_tag_uri(self, name, start_mark):
         # See the specification for details.
         # Note: we do not check if URI is well-formed.
         chunks = []
                 chunks.append(self.reader.prefix(length))
                 self.reader.forward(length)
                 length = 0
-                chunks.append(self.scan_uri_escapes(name, start_marker))
+                chunks.append(self.scan_uri_escapes(name, start_mark))
             else:
                 length += 1
             ch = self.reader.peek(length)
             self.reader.forward(length)
             length = 0
         if not chunks:
-            raise ScannerError("while parsing a %s" % name, start_marker,
+            raise ScannerError("while parsing a %s" % name, start_mark,
                     "expected URI, but found %r" % ch.encode('utf-8'),
-                    self.reader.get_marker())
+                    self.reader.get_mark())
         return u''.join(chunks)
 
-    def scan_uri_escapes(self, name, start_marker):
+    def scan_uri_escapes(self, name, start_mark):
         # See the specification for details.
         bytes = []
-        marker = self.reader.get_marker()
+        mark = self.reader.get_mark()
         while self.reader.peek() == u'%':
             self.reader.forward()
             for k in range(2):
                 if self.reader.peek(k) not in u'0123456789ABCDEFabcdef':
-                    raise ScannerError("while scanning a %s" % name, start_marker,
+                    raise ScannerError("while scanning a %s" % name, start_mark,
                             "expected URI escape sequence of 2 hexdecimal numbers, but found %r" %
-                                (self.reader.peek(k).encode('utf-8')), self.reader.get_marker())
+                                (self.reader.peek(k).encode('utf-8')), self.reader.get_mark())
             bytes.append(chr(int(self.reader.prefix(2), 16)))
             self.reader.forward(2)
         try:
             value = unicode(''.join(bytes), 'utf-8')
         except UnicodeDecodeError, exc:
-            raise ScannerError("while scanning a %s" % name, start_marker, str(exc), marker)
+            raise ScannerError("while scanning a %s" % name, start_mark, str(exc), mark)
         return value
 
     def scan_line_break(self):

lib/yaml/tokens.py

 
 class Token:
-    def __init__(self, start_marker, end_marker):
-        self.start_marker = start_marker
-        self.end_marker = end_marker
+    def __init__(self, start_mark, end_mark):
+        self.start_mark = start_mark
+        self.end_mark = end_mark
     def __repr__(self):
         attributes = [key for key in self.__dict__
-                if not key.endswith('_marker')]
+                if not key.endswith('_mark')]
         attributes.sort()
         arguments = ', '.join(['%s=%r' % (key, getattr(self, key))
                 for key in attributes])
 
 class DirectiveToken(Token):
     id = '<directive>'
-    def __init__(self, name, value, start_marker, end_marker):
+    def __init__(self, name, value, start_mark, end_mark):
         self.name = name
         self.value = value
-        self.start_marker = start_marker
-        self.end_marker = end_marker
+        self.start_mark = start_mark
+        self.end_mark = end_mark
 
 class DocumentStartToken(Token):
     id = '<document start>'
 
 class AliasToken(Token):
     id = '<alias>'
-    def __init__(self, value, start_marker, end_marker):
+    def __init__(self, value, start_mark, end_mark):
         self.value = value
-        self.start_marker = start_marker
-        self.end_marker = end_marker
+        self.start_mark = start_mark
+        self.end_mark = end_mark
 
 class AnchorToken(Token):
     id = '<anchor>'
-    def __init__(self, value, start_marker, end_marker):
+    def __init__(self, value, start_mark, end_mark):
         self.value = value
-        self.start_marker = start_marker
-        self.end_marker = end_marker
+        self.start_mark = start_mark
+        self.end_mark = end_mark
 
 class TagToken(Token):
     id = '<tag>'
-    def __init__(self, value, start_marker, end_marker):
+    def __init__(self, value, start_mark, end_mark):
         self.value = value
-        self.start_marker = start_marker
-        self.end_marker = end_marker
+        self.start_mark = start_mark
+        self.end_mark = end_mark
 
 class ScalarToken(Token):
     id = '<scalar>'
-    def __init__(self, value, plain, start_marker, end_marker):
+    def __init__(self, value, plain, start_mark, end_mark):
         self.value = value
         self.plain = plain
-        self.start_marker = start_marker
-        self.end_marker = end_marker
+        self.start_mark = start_mark
+        self.end_mark = end_mark
 

tests/data/test_mark.marks

+---
+*The first line.
+The last line.
+---
+The first*line.
+The last line.
+---
+The first line.*
+The last line.
+---
+The first line.
+*The last line.
+---
+The first line.
+The last*line.
+---
+The first line.
+The last line.*
+---
+The first line.
+*The selected line.
+The last line.
+---
+The first line.
+The selected*line.
+The last line.
+---
+The first line.
+The selected line.*
+The last line.
+---
+*The only line.
+---
+The only*line.
+---
+The only line.*
+---
+Loooooooooooooooooooooooooooooooooooooooooooooong*Liiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiine

tests/data/test_marker.markers

----
-*The first line.
-The last line.
----
-The first*line.
-The last line.
----
-The first line.*
-The last line.
----
-The first line.
-*The last line.
----
-The first line.
-The last*line.
----
-The first line.
-The last line.*
----
-The first line.
-*The selected line.
-The last line.
----
-The first line.
-The selected*line.
-The last line.
----
-The first line.
-The selected line.*
-The last line.
----
-*The only line.
----
-The only*line.
----
-The only line.*
----
-Loooooooooooooooooooooooooooooooooooooooooooooong*Liiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiine

tests/test_mark.py

+
+import test_appliance
+
+from yaml.reader import Mark
+
+class TestMark(test_appliance.TestAppliance):
+
+    def _testMarks(self, test_name, marks_filename):
+        inputs = file(marks_filename, 'rb').read().split('---\n')[1:]
+        for input in inputs:
+            index = 0
+            line = 0
+            column = 0
+            while input[index] != '*':
+                if input[index] == '\n':
+                    line += 1
+                    column = 0
+                else:
+                    column += 1
+                index += 1
+            mark = Mark(test_name, line, column, unicode(input), index)
+            snippet = mark.get_snippet(indent=2, max_length=79)
+            #print "INPUT:"
+            #print input
+            #print "SNIPPET:"
+            #print snippet
+            self.failUnless(isinstance(snippet, str))
+            self.failUnlessEqual(snippet.count('\n'), 1)
+            data, pointer = snippet.split('\n')
+            self.failUnless(len(data) < 82)
+            self.failUnlessEqual(data[len(pointer)-1], '*')
+
+TestMark.add_tests('testMarks', '.marks')
+

tests/test_marker.py

-
-import test_appliance
-
-from yaml.reader import Marker
-
-class TestMarker(test_appliance.TestAppliance):
-
-    def _testMarkers(self, test_name, markers_filename):
-        inputs = file(markers_filename, 'rb').read().split('---\n')[1:]
-        for input in inputs:
-            index = 0
-            line = 0
-            column = 0
-            while input[index] != '*':
-                if input[index] == '\n':
-                    line += 1
-                    column = 0
-                else:
-                    column += 1
-                index += 1
-            marker = Marker(test_name, line, column, unicode(input), index)
-            snippet = marker.get_snippet(indent=2, max_length=79)
-            #print "INPUT:"
-            #print input
-            #print "SNIPPET:"
-            #print snippet
-            self.failUnless(isinstance(snippet, str))
-            self.failUnlessEqual(snippet.count('\n'), 1)
-            data, pointer = snippet.split('\n')
-            self.failUnless(len(data) < 82)
-            self.failUnlessEqual(data[len(pointer)-1], '*')
-
-TestMarker.add_tests('testMarkers', '.markers')
-

tests/test_yaml.py

 
 import unittest
 
-from test_marker import *
+from test_mark import *
 from test_reader import *
 from test_canonical import *
 from test_tokens import *