source: branches/pyyaml3000/lib/yaml/tokens.py @ 47

Revision 47, 2.4 KB checked in by xi, 9 years ago (diff)

Working on the scanner.

RevLine 
[46]1
2class Token:
3    def __init__(self, start_marker, end_marker):
4        self.start_marker = start_marker
5        self.end_marker = end_marker
6
7class DirectiveToken(Token):
[47]8    code = '<directive>'
[46]9
10class YAMLDirectiveToken(DirectiveToken):
[47]11    code = '<%YAML directive>'
[46]12    def __init__(self, major_version, minor_version, start_marker, end_marker):
13        self.major_version = major_version
14        self.minor_version = minor_version
15        self.start_marker = start_marker
16        self.end_marker = end_marker
17
18class TagDirectiveToken(DirectiveToken):
[47]19    code = '<%TAG directive>'
[46]20
21class ReservedDirectiveToken(DirectiveToken):
[47]22    code = '<unknown directive>'
[46]23    def __init__(self, name, start_marker, end_marker):
24        self.name = name
25        self.start_marker = start_marker
26        self.end_marker = end_marker
27
28class DocumentStartToken(Token):
[47]29    code = '<document start>'
[46]30
31class DocumentEndToken(Token):
[47]32    code = '<document end>'
[46]33
[47]34class StreamEndToken(Token):
35    code = '<stream end>'
[46]36
37class BlockSequenceStartToken(Token):
[47]38    code = '<block sequence start>'
[46]39
40class BlockMappingStartToken(Token):
[47]41    code = '<block mapping end>'
[46]42
43class BlockEndToken(Token):
[47]44    code = '<block end>'
[46]45
46class FlowSequenceStartToken(Token):
[47]47    code = '['
[46]48
49class FlowMappingStartToken(Token):
[47]50    code = '{'
[46]51
52class FlowSequenceEndToken(Token):
[47]53    code = ']'
[46]54
55class FlowMappingEndToken(Token):
[47]56    code = '}'
[46]57
58class KeyToken(Token):
[47]59    code = '?'
[46]60
61class ValueToken(Token):
[47]62    code = ':'
[46]63
64class EntryToken(Token):
[47]65    code = '- or ,'
[46]66
67class AliasToken(Token):
[47]68    code = '<alias>'
[46]69    def __init__(self, value, start_marker, end_marker):
70        self.value = value
71        self.start_marker = start_marker
72        self.end_marker = end_marker
73
74class AnchorToken(Token):
[47]75    code = '<anchor>'
[46]76    def __init__(self, value, start_marker, end_marker):
77        self.value = value
78        self.start_marker = start_marker
79        self.end_marker = end_marker
80
81class TagToken(Token):
[47]82    code = '<tag>'
[46]83    def __init__(self, value, start_marker, end_marker):
84        self.value = value
85        self.start_marker = start_marker
86        self.end_marker = end_marker
87
88class ScalarToken(Token):
[47]89    code = '<scalar>'
[46]90    def __init__(self, value, plain, start_marker, end_marker):
91        self.value = value
92        self.plain = plain
93        self.start_marker = start_marker
94        self.end_marker = end_marker
95
Note: See TracBrowser for help on using the repository browser.