Back to work :). Rename markers to marks.
[pyyaml/python3.git] / lib / yaml / nodes.py
blob6c2742111f227afc83e736c43ecb032ee576e6c3
2 class Node:
3 def __init__(self, tag, value, start_mark, end_mark):
4 self.tag = tag
5 self.value = value
6 self.start_mark = start_mark
7 self.end_mark = end_mark
8 def __repr__(self):
9 value = self.value
10 if isinstance(value, list):
11 if len(value) == 0:
12 value = '<empty>'
13 elif len(value) == 1:
14 value = '<1 item>'
15 else:
16 value = '<%d items>' % len(value)
17 else:
18 if len(value) > 75:
19 value = repr(value[:70]+u' ... ')
20 else:
21 value = repr(value)
22 return '%s(tag=%r, value=%s)' % (self.__class__.__name__, self.tag, value)
24 class ScalarNode(Node):
25 id = 'scalar'
27 class CollectionNode(Node):
28 pass
30 class SequenceNode(CollectionNode):
31 id = 'sequence'
33 class MappingNode(CollectionNode):
34 id = 'mapping'