Back to work :). Rename markers to marks.
[pyyaml/python3.git] / lib / yaml / tokens.py
blobd25d7aa922f8891fb6838ba9c3b2e32f3118c3b9
2 class Token:
3 def __init__(self, start_mark, end_mark):
4 self.start_mark = start_mark
5 self.end_mark = end_mark
6 def __repr__(self):
7 attributes = [key for key in self.__dict__
8 if not key.endswith('_mark')]
9 attributes.sort()
10 arguments = ', '.join(['%s=%r' % (key, getattr(self, key))
11 for key in attributes])
12 return '%s(%s)' % (self.__class__.__name__, arguments)
14 #class BOMToken(Token):
15 # id = '<byte order mark>'
17 class DirectiveToken(Token):
18 id = '<directive>'
19 def __init__(self, name, value, start_mark, end_mark):
20 self.name = name
21 self.value = value
22 self.start_mark = start_mark
23 self.end_mark = end_mark
25 class DocumentStartToken(Token):
26 id = '<document start>'
28 class DocumentEndToken(Token):
29 id = '<document end>'
31 class StreamEndToken(Token):
32 id = '<stream end>'
34 class BlockSequenceStartToken(Token):
35 id = '<block sequence start>'
37 class BlockMappingStartToken(Token):
38 id = '<block mapping start>'
40 class BlockEndToken(Token):
41 id = '<block end>'
43 class FlowSequenceStartToken(Token):
44 id = '['
46 class FlowMappingStartToken(Token):
47 id = '{'
49 class FlowSequenceEndToken(Token):
50 id = ']'
52 class FlowMappingEndToken(Token):
53 id = '}'
55 class KeyToken(Token):
56 id = '?'
58 class ValueToken(Token):
59 id = ':'
61 class BlockEntryToken(Token):
62 id = '-'
64 class FlowEntryToken(Token):
65 id = ','
67 class AliasToken(Token):
68 id = '<alias>'
69 def __init__(self, value, start_mark, end_mark):
70 self.value = value
71 self.start_mark = start_mark
72 self.end_mark = end_mark
74 class AnchorToken(Token):
75 id = '<anchor>'
76 def __init__(self, value, start_mark, end_mark):
77 self.value = value
78 self.start_mark = start_mark
79 self.end_mark = end_mark
81 class TagToken(Token):
82 id = '<tag>'
83 def __init__(self, value, start_mark, end_mark):
84 self.value = value
85 self.start_mark = start_mark
86 self.end_mark = end_mark
88 class ScalarToken(Token):
89 id = '<scalar>'
90 def __init__(self, value, plain, start_mark, end_mark):
91 self.value = value
92 self.plain = plain
93 self.start_mark = start_mark
94 self.end_mark = end_mark