File: Synopsis/Token.hh 1
2
3
4
5
6
7#ifndef Synopsis_Token_hh_
8#define Synopsis_Token_hh_
9
10#include <cstring>
11
12namespace Synopsis
13{
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50struct Token
51{
52 typedef int Type;
53 enum
54 {
55 Identifier = 258,
56 Constant,
57 CharConst,
58 StringL,
59 AssignOp,
60 EqualOp,
61 RelOp,
62 ShiftOp,
63 LogOrOp,
64 LogAndOp,
65 IncOp,
66 Scope,
67 Ellipsis,
68 PmOp,
69 ArrowOp,
70 BadToken,
71 AUTO,
72 CHAR,
73 CLASS,
74 CONST,
75 DELETE,
76 DOUBLE,
77 ENUM,
78 EXTERN,
79 FLOAT,
80 FRIEND,
81 INLINE,
82 INT,
83 LONG,
84 NEW,
85 OPERATOR,
86 PRIVATE,
87 PROTECTED,
88 PUBLIC,
89 REGISTER,
90 SHORT,
91 SIGNED,
92 STATIC,
93 STRUCT,
94 TYPEDEF,
95 TYPENAME,
96 UNION,
97 UNSIGNED,
98 VIRTUAL,
99 VOID,
100 VOLATILE,
101 TEMPLATE,
102 MUTABLE,
103 BREAK,
104 CASE,
105 CONTINUE,
106 DEFAULT,
107 DO,
108 ELSE,
109 FOR,
110 GOTO,
111 IF,
112 OFFSETOF,
113 RETURN,
114 SIZEOF,
115 SWITCH,
116 THIS,
117 WHILE,
118 ATTRIBUTE,
119 METACLASS,
120 UserKeyword,
121 UserKeyword2,
122 UserKeyword3,
123 UserKeyword4,
124 BOOLEAN,
125 EXTENSION,
126 TRY,
127 CATCH,
128 THROW,
129 UserKeyword5,
130 NAMESPACE,
131 USING,
132 TYPEID,
133 TYPEOF,
134 WideStringL,
135 WideCharConst,
136 WCHAR,
137
138
139
140 ntDeclarator = 400,
141 ntName,
142 ntFstyleCast,
143 ntClassSpec,
144 ntEnumSpec,
145 ntDeclaration,
146 ntTypedef,
147 ntTemplateDecl,
148 ntMetaclassDecl,
149 ntParameterDecl,
150 ntLinkageSpec,
151 ntAccessSpec,
152 ntUserAccessSpec,
153 ntUserdefKeyword,
154 ntExternTemplate,
155 ntAccessDecl,
156 ntNamespaceSpec,
157 ntUsing,
158 ntTemplateInstantiation,
159 ntNamespaceAlias,
160 ntIfStatement,
161 ntSwitchStatement,
162 ntWhileStatement,
163 ntDoStatement,
164 ntForStatement,
165 ntBreakStatement,
166 ntContinueStatement,
167 ntReturnStatement,
168 ntGotoStatement,
169 ntCaseStatement,
170 ntDefaultStatement,
171 ntLabelStatement,
172 ntExprStatement,
173 ntTryStatement,
174
175 ntCommaExpr,
176 ntAssignExpr,
177 ntCondExpr,
178 ntInfixExpr,
179 ntPmExpr,
180 ntCastExpr,
181 ntUnaryExpr,
182 ntSizeofExpr,
183 ntNewExpr,
184 ntDeleteExpr,
185 ntArrayExpr,
186 ntFuncallExpr,
187 ntPostfixExpr,
188 ntUserStatementExpr,
189 ntDotMemberExpr,
190 ntArrowMemberExpr,
191 ntParenExpr,
192 ntStaticUserStatementExpr,
193 ntThrowExpr,
194 ntTypeidExpr,
195 ntTypeofExpr,
196
197 Ignore = 500,
198 ASM,
199 DECLSPEC,
200 PRAGMA,
201 INT64,
202 Comment
203 };
204
205 Token() : ptr(0), length(0), type(BadToken) {}
206 Token(const char *s, size_t l, Type t) : ptr(s), length(l), type(t) {}
207 bool operator == (char c) const { return *ptr == c && length == 1;}
208 const char *ptr;
209 size_t length;
210 Type type;
211};
212
213}
214
215#endif
Generated on Thu Apr 16 16:28:03 2009 by
synopsis (version devel)