valatokentype.vala 6.65 KB
Newer Older
1 2
/* valatokentype.vala
 *
3
 * Copyright (C) 2008-2010  Jürg Billeter
4 5 6 7 8 9 10 11 12 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
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.

 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.

 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
 *
 * Author:
 * 	Jürg Billeter <j@bitron.ch>
 */

using GLib;

public enum Vala.TokenType {
	NONE,
	ABSTRACT,
	AS,
	ASSIGN,
	ASSIGN_ADD,
	ASSIGN_BITWISE_AND,
	ASSIGN_BITWISE_OR,
	ASSIGN_BITWISE_XOR,
	ASSIGN_DIV,
	ASSIGN_MUL,
	ASSIGN_PERCENT,
	ASSIGN_SHIFT_LEFT,
	ASSIGN_SUB,
39
	ASYNC,
40 41 42 43 44 45 46 47 48 49 50 51
	BASE,
	BITWISE_AND,
	BITWISE_OR,
	BREAK,
	CARRET,
	CASE,
	CATCH,
	CHARACTER_LITERAL,
	CLASS,
	CLOSE_BRACE,
	CLOSE_BRACKET,
	CLOSE_PARENS,
52
	CLOSE_REGEX_LITERAL,
53
	CLOSE_TEMPLATE,
54 55 56 57 58 59 60 61 62 63
	COLON,
	COMMA,
	CONST,
	CONSTRUCT,
	CONTINUE,
	DEFAULT,
	DELEGATE,
	DELETE,
	DIV,
	DO,
64
	DOUBLE_COLON,
65
	DOT,
66
	DYNAMIC,
67 68 69 70 71 72
	ELLIPSIS,
	ELSE,
	ENUM,
	ENSURES,
	ERRORDOMAIN,
	EOF,
73
	EXTERN,
74 75 76 77 78 79 80 81 82 83 84 85
	FALSE,
	FINALLY,
	FOR,
	FOREACH,
	GET,
	HASH,
	IDENTIFIER,
	IF,
	IN,
	INLINE,
	INTEGER_LITERAL,
	INTERFACE,
86
	INTERNAL,
87 88 89 90 91 92 93 94 95 96
	INTERR,
	IS,
	LAMBDA,
	LOCK,
	MINUS,
	NAMESPACE,
	NEW,
	NULL,
	OUT,
	OP_AND,
97
	OP_COALESCING,
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
	OP_DEC,
	OP_EQ,
	OP_GE,
	OP_GT,
	OP_INC,
	OP_LE,
	OP_LT,
	OP_NE,
	OP_NEG,
	OP_OR,
	OP_PTR,
	OP_SHIFT_LEFT,
	OPEN_BRACE,
	OPEN_BRACKET,
	OPEN_PARENS,
113
	OPEN_REGEX_LITERAL,
114
	OPEN_TEMPLATE,
115
	OVERRIDE,
116
	OWNED,
117
	PARAMS,
118 119 120 121 122 123 124
	PERCENT,
	PLUS,
	PRIVATE,
	PROTECTED,
	PUBLIC,
	REAL_LITERAL,
	REF,
125
	REGEX_LITERAL,
126 127
	REQUIRES,
	RETURN,
128
	SEALED,
129 130 131 132 133 134 135 136 137
	SEMICOLON,
	SET,
	SIGNAL,
	SIZEOF,
	STAR,
	STATIC,
	STRING_LITERAL,
	STRUCT,
	SWITCH,
138
	TEMPLATE_STRING_LITERAL,
139 140 141 142 143 144 145
	THIS,
	THROW,
	THROWS,
	TILDE,
	TRUE,
	TRY,
	TYPEOF,
146
	UNLOCK,
147
	UNOWNED,
148 149
	USING,
	VAR,
150
	VERBATIM_STRING_LITERAL,
151 152 153 154
	VIRTUAL,
	VOID,
	VOLATILE,
	WEAK,
Jürg Billeter's avatar
Jürg Billeter committed
155
	WHILE,
156
	YIELD;
157

158
	public unowned string to_string () {
159 160 161 162 163 164 165 166 167 168 169 170 171
		switch (this) {
		case ABSTRACT: return "`abstract'";
		case AS: return "`as'";
		case ASSIGN: return "`='";
		case ASSIGN_ADD: return "`+='";
		case ASSIGN_BITWISE_AND: return "`&='";
		case ASSIGN_BITWISE_OR: return "`|='";
		case ASSIGN_BITWISE_XOR: return "`^='";
		case ASSIGN_DIV: return "`/='";
		case ASSIGN_MUL: return "`*='";
		case ASSIGN_PERCENT: return "`%='";
		case ASSIGN_SHIFT_LEFT: return "`<<='";
		case ASSIGN_SUB: return "`-='";
172
		case ASYNC: return "`async'";
173 174 175 176 177 178 179 180 181 182 183 184
		case BASE: return "`base'";
		case BITWISE_AND: return "`&'";
		case BITWISE_OR: return "`|'";
		case BREAK: return "`break'";
		case CARRET: return "`^'";
		case CASE: return "`case'";
		case CATCH: return "`catch'";
		case CHARACTER_LITERAL: return "character literal";
		case CLASS: return "`class'";
		case CLOSE_BRACE: return "`}'";
		case CLOSE_BRACKET: return "`]'";
		case CLOSE_PARENS: return "`)'";
185
		case CLOSE_REGEX_LITERAL: return "`/'";
186
		case CLOSE_TEMPLATE: return "close template";
187 188 189 190 191 192 193 194 195 196
		case COLON: return "`:'";
		case COMMA: return "`,'";
		case CONST: return "`const'";
		case CONSTRUCT: return "`construct'";
		case CONTINUE: return "`continue'";
		case DEFAULT: return "`default'";
		case DELEGATE: return "`delegate'";
		case DELETE: return "`delete'";
		case DIV: return "`/'";
		case DO: return "`do'";
197
		case DOUBLE_COLON: return "`::'";
198
		case DOT: return "`.'";
199
		case DYNAMIC: return "`dynamic'";
200 201 202 203 204 205
		case ELLIPSIS: return "`...'";
		case ELSE: return "`else'";
		case ENUM: return "`enum'";
		case ENSURES: return "`ensures'";
		case ERRORDOMAIN: return "`errordomain'";
		case EOF: return "end of file";
206
		case EXTERN: return "`extern'";
207 208 209 210 211
		case FALSE: return "`false'";
		case FINALLY: return "`finally'";
		case FOR: return "`for'";
		case FOREACH: return "`foreach'";
		case GET: return "`get'";
212
		case HASH: return "`#'";
213 214 215 216 217 218
		case IDENTIFIER: return "identifier";
		case IF: return "`if'";
		case IN: return "`in'";
		case INLINE: return "`inline'";
		case INTEGER_LITERAL: return "integer literal";
		case INTERFACE: return "`interface'";
219
		case INTERNAL: return "`internal'";
220 221 222 223 224 225 226 227 228 229
		case INTERR: return "`?'";
		case IS: return "`is'";
		case LAMBDA: return "`=>'";
		case LOCK: return "`lock'";
		case MINUS: return "`-'";
		case NAMESPACE: return "`namespace'";
		case NEW: return "`new'";
		case NULL: return "`null'";
		case OUT: return "`out'";
		case OP_AND: return "`&&'";
230
		case OP_COALESCING: return "`??'";
231 232 233 234 235 236 237 238 239 240 241 242 243 244 245
		case OP_DEC: return "`--'";
		case OP_EQ: return "`=='";
		case OP_GE: return "`>='";
		case OP_GT: return "`>'";
		case OP_INC: return "`++'";
		case OP_LE: return "`<='";
		case OP_LT: return "`<'";
		case OP_NE: return "`!='";
		case OP_NEG: return "`!'";
		case OP_OR: return "`||'";
		case OP_PTR: return "`->'";
		case OP_SHIFT_LEFT: return "`<<'";
		case OPEN_BRACE: return "`{'";
		case OPEN_BRACKET: return "`['";
		case OPEN_PARENS: return "`('";
246
		case OPEN_REGEX_LITERAL: return "`/'";
247
		case OPEN_TEMPLATE: return "open template";
248
		case OVERRIDE: return "`override'";
249
		case OWNED: return "`owned'";
250
		case PARAMS: return "`params'";
251 252 253 254 255 256 257
		case PERCENT: return "`%'";
		case PLUS: return "`+'";
		case PRIVATE: return "`private'";
		case PROTECTED: return "`protected'";
		case PUBLIC: return "`public'";
		case REAL_LITERAL: return "real literal";
		case REF: return "`ref'";
258
		case REGEX_LITERAL: return "regex literal";
259 260
		case REQUIRES: return "`requires'";
		case RETURN: return "`return'";
261
		case SEALED: return "`sealed'";
262 263 264 265 266 267 268 269 270
		case SEMICOLON: return "`;'";
		case SET: return "`set'";
		case SIGNAL: return "`signal'";
		case SIZEOF: return "`sizeof'";
		case STAR: return "`*'";
		case STATIC: return "`static'";
		case STRING_LITERAL: return "string literal";
		case STRUCT: return "`struct'";
		case SWITCH: return "`switch'";
271
		case TEMPLATE_STRING_LITERAL: return "template string literal";
272 273 274 275 276 277 278
		case THIS: return "`this'";
		case THROW: return "`throw'";
		case THROWS: return "`throws'";
		case TILDE: return "`~'";
		case TRUE: return "`true'";
		case TRY: return "`try'";
		case TYPEOF: return "`typeof'";
279
		case UNLOCK: return "`unlock'";
280
		case UNOWNED: return "`unowned'";
281 282
		case USING: return "`using'";
		case VAR: return "`var'";
283
		case VERBATIM_STRING_LITERAL: return "verbatim string literal";
284 285 286 287 288
		case VIRTUAL: return "`virtual'";
		case VOID: return "`void'";
		case VOLATILE: return "`volatile'";
		case WEAK: return "`weak'";
		case WHILE: return "`while'";
Jürg Billeter's avatar
Jürg Billeter committed
289
		case YIELD: return "`yield'";
290 291 292 293 294
		default: return "unknown token";
		}
	}
}