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

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

Working on the scanner.

Line 
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):
8    code = '<directive>'
9
10class YAMLDirectiveToken(DirectiveToken):
11    code = '<%YAML directive>'
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):
19    code = '<%TAG directive>'
20
21class ReservedDirectiveToken(DirectiveToken):
22    code = '<unknown directive>'
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):
29    code = '<document start>'
30
31class DocumentEndToken(Token):
32    code = '<document end>'
33
34class StreamEndToken(Token):
35    code = '<stream end>'
36
37class BlockSequenceStartToken(Token):
38    code = '<block sequence start>'
39
40class BlockMappingStartToken(Token):
41    code = '<block mapping end>'
42
43class BlockEndToken(Token):
44    code = '<block end>'
45
46class FlowSequenceStartToken(Token):
47    code = '['
48
49class FlowMappingStartToken(Token):
50    code = '{'
51
52class FlowSequenceEndToken(Token):
53    code = ']'
54
55class FlowMappingEndToken(Token):
56    code = '}'
57
58class KeyToken(Token):
59    code = '?'
60
61class ValueToken(Token):
62    code = ':'
63
64class EntryToken(Token):
65    code = '- or ,'
66
67class AliasToken(Token):
68    code = '<alias>'
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):
75    code = '<anchor>'
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):
82    code = '<tag>'
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):
89    code = '<scalar>'
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.