3 def __init__(self
, start_mark
, end_mark
):
4 self
.start_mark
= start_mark
5 self
.end_mark
= end_mark
7 attributes
= [key
for key
in self
.__dict
__
8 if not key
.endswith('_mark')]
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
):
19 def __init__(self
, name
, value
, start_mark
, end_mark
):
22 self
.start_mark
= start_mark
23 self
.end_mark
= end_mark
25 class DocumentStartToken(Token
):
26 id = '<document start>'
28 class DocumentEndToken(Token
):
31 class StreamStartToken(Token
):
33 def __init__(self
, start_mark
=None, end_mark
=None,
35 self
.start_mark
= start_mark
36 self
.end_mark
= end_mark
37 self
.encoding
= encoding
39 class StreamEndToken(Token
):
42 class BlockSequenceStartToken(Token
):
43 id = '<block sequence start>'
45 class BlockMappingStartToken(Token
):
46 id = '<block mapping start>'
48 class BlockEndToken(Token
):
51 class FlowSequenceStartToken(Token
):
54 class FlowMappingStartToken(Token
):
57 class FlowSequenceEndToken(Token
):
60 class FlowMappingEndToken(Token
):
63 class KeyToken(Token
):
66 class ValueToken(Token
):
69 class BlockEntryToken(Token
):
72 class FlowEntryToken(Token
):
75 class AliasToken(Token
):
77 def __init__(self
, value
, start_mark
, end_mark
):
79 self
.start_mark
= start_mark
80 self
.end_mark
= end_mark
82 class AnchorToken(Token
):
84 def __init__(self
, value
, start_mark
, end_mark
):
86 self
.start_mark
= start_mark
87 self
.end_mark
= end_mark
89 class TagToken(Token
):
91 def __init__(self
, value
, start_mark
, end_mark
):
93 self
.start_mark
= start_mark
94 self
.end_mark
= end_mark
96 class ScalarToken(Token
):
98 def __init__(self
, value
, plain
, start_mark
, end_mark
, style
=None):
101 self
.start_mark
= start_mark
102 self
.end_mark
= end_mark