xref: /netbsd/external/gpl3/gcc/dist/gcc/d/dmd/tokens.c (revision 81418a27)
1*81418a27Smrg 
2*81418a27Smrg /* Compiler implementation of the D programming language
3*81418a27Smrg  * Copyright (C) 1999-2019 by The D Language Foundation, All Rights Reserved
4*81418a27Smrg  * written by Walter Bright
5*81418a27Smrg  * http://www.digitalmars.com
6*81418a27Smrg  * Distributed under the Boost Software License, Version 1.0.
7*81418a27Smrg  * http://www.boost.org/LICENSE_1_0.txt
8*81418a27Smrg  * https://github.com/D-Programming-Language/dmd/blob/master/src/lexer.c
9*81418a27Smrg  */
10*81418a27Smrg 
11*81418a27Smrg #include "root/dsystem.h"
12*81418a27Smrg 
13*81418a27Smrg #include "tokens.h"
14*81418a27Smrg #include "root/rmem.h"
15*81418a27Smrg #include "root/outbuffer.h"
16*81418a27Smrg #include "id.h"
17*81418a27Smrg #include "identifier.h"
18*81418a27Smrg #include "utf.h"
19*81418a27Smrg 
20*81418a27Smrg /************************* Token **********************************************/
21*81418a27Smrg 
22*81418a27Smrg Token *Token::freelist = NULL;
23*81418a27Smrg 
24*81418a27Smrg const char *Token::tochars[TOKMAX];
25*81418a27Smrg 
alloc()26*81418a27Smrg Token *Token::alloc()
27*81418a27Smrg {
28*81418a27Smrg     if (Token::freelist)
29*81418a27Smrg     {
30*81418a27Smrg         Token *t = freelist;
31*81418a27Smrg         freelist = t->next;
32*81418a27Smrg         t->next = NULL;
33*81418a27Smrg         return t;
34*81418a27Smrg     }
35*81418a27Smrg 
36*81418a27Smrg     return new Token();
37*81418a27Smrg }
38*81418a27Smrg 
free()39*81418a27Smrg void Token::free()
40*81418a27Smrg {
41*81418a27Smrg     next = freelist;
42*81418a27Smrg     freelist = this;
43*81418a27Smrg }
44*81418a27Smrg 
toChars()45*81418a27Smrg const char *Token::toChars() const
46*81418a27Smrg {
47*81418a27Smrg     static char buffer[3 + 3 * sizeof(floatvalue) + 1];
48*81418a27Smrg 
49*81418a27Smrg     const char *p = &buffer[0];
50*81418a27Smrg     switch (value)
51*81418a27Smrg     {
52*81418a27Smrg         case TOKint32v:
53*81418a27Smrg             sprintf(&buffer[0],"%d",(d_int32)int64value);
54*81418a27Smrg             break;
55*81418a27Smrg 
56*81418a27Smrg         case TOKuns32v:
57*81418a27Smrg         case TOKcharv:
58*81418a27Smrg         case TOKwcharv:
59*81418a27Smrg         case TOKdcharv:
60*81418a27Smrg             sprintf(&buffer[0],"%uU",(d_uns32)uns64value);
61*81418a27Smrg             break;
62*81418a27Smrg 
63*81418a27Smrg         case TOKint64v:
64*81418a27Smrg             sprintf(&buffer[0],"%lldL",(longlong)int64value);
65*81418a27Smrg             break;
66*81418a27Smrg 
67*81418a27Smrg         case TOKuns64v:
68*81418a27Smrg             sprintf(&buffer[0],"%lluUL",(ulonglong)uns64value);
69*81418a27Smrg             break;
70*81418a27Smrg 
71*81418a27Smrg         case TOKfloat32v:
72*81418a27Smrg             CTFloat::sprint(&buffer[0], 'g', floatvalue);
73*81418a27Smrg             strcat(&buffer[0], "f");
74*81418a27Smrg             break;
75*81418a27Smrg 
76*81418a27Smrg         case TOKfloat64v:
77*81418a27Smrg             CTFloat::sprint(&buffer[0], 'g', floatvalue);
78*81418a27Smrg             break;
79*81418a27Smrg 
80*81418a27Smrg         case TOKfloat80v:
81*81418a27Smrg             CTFloat::sprint(&buffer[0], 'g', floatvalue);
82*81418a27Smrg             strcat(&buffer[0], "L");
83*81418a27Smrg             break;
84*81418a27Smrg 
85*81418a27Smrg         case TOKimaginary32v:
86*81418a27Smrg             CTFloat::sprint(&buffer[0], 'g', floatvalue);
87*81418a27Smrg             strcat(&buffer[0], "fi");
88*81418a27Smrg             break;
89*81418a27Smrg 
90*81418a27Smrg         case TOKimaginary64v:
91*81418a27Smrg             CTFloat::sprint(&buffer[0], 'g', floatvalue);
92*81418a27Smrg             strcat(&buffer[0], "i");
93*81418a27Smrg             break;
94*81418a27Smrg 
95*81418a27Smrg         case TOKimaginary80v:
96*81418a27Smrg             CTFloat::sprint(&buffer[0], 'g', floatvalue);
97*81418a27Smrg             strcat(&buffer[0], "Li");
98*81418a27Smrg             break;
99*81418a27Smrg 
100*81418a27Smrg         case TOKstring:
101*81418a27Smrg         {
102*81418a27Smrg             OutBuffer buf;
103*81418a27Smrg             buf.writeByte('"');
104*81418a27Smrg             for (size_t i = 0; i < len; )
105*81418a27Smrg             {
106*81418a27Smrg                 unsigned c;
107*81418a27Smrg                 utf_decodeChar((utf8_t *)ustring, len, &i, &c);
108*81418a27Smrg                 switch (c)
109*81418a27Smrg                 {
110*81418a27Smrg                     case 0:
111*81418a27Smrg                         break;
112*81418a27Smrg 
113*81418a27Smrg                     case '"':
114*81418a27Smrg                     case '\\':
115*81418a27Smrg                         buf.writeByte('\\');
116*81418a27Smrg                         /* fall through */
117*81418a27Smrg                     default:
118*81418a27Smrg                         if (c <= 0x7F)
119*81418a27Smrg                         {
120*81418a27Smrg                             if (isprint(c))
121*81418a27Smrg                                 buf.writeByte(c);
122*81418a27Smrg                             else
123*81418a27Smrg                                 buf.printf("\\x%02x", c);
124*81418a27Smrg                         }
125*81418a27Smrg                         else if (c <= 0xFFFF)
126*81418a27Smrg                             buf.printf("\\u%04x", c);
127*81418a27Smrg                         else
128*81418a27Smrg                             buf.printf("\\U%08x", c);
129*81418a27Smrg                         continue;
130*81418a27Smrg                 }
131*81418a27Smrg                 break;
132*81418a27Smrg             }
133*81418a27Smrg             buf.writeByte('"');
134*81418a27Smrg             if (postfix)
135*81418a27Smrg                 buf.writeByte(postfix);
136*81418a27Smrg             p = buf.extractString();
137*81418a27Smrg         }
138*81418a27Smrg             break;
139*81418a27Smrg 
140*81418a27Smrg         case TOKxstring:
141*81418a27Smrg         {
142*81418a27Smrg             OutBuffer buf;
143*81418a27Smrg             buf.writeByte('x');
144*81418a27Smrg             buf.writeByte('"');
145*81418a27Smrg             for (size_t i = 0; i < len; i++)
146*81418a27Smrg             {
147*81418a27Smrg                 if (i)
148*81418a27Smrg                     buf.writeByte(' ');
149*81418a27Smrg                 buf.printf("%02x", ustring[i]);
150*81418a27Smrg             }
151*81418a27Smrg             buf.writeByte('"');
152*81418a27Smrg             if (postfix)
153*81418a27Smrg                 buf.writeByte(postfix);
154*81418a27Smrg             buf.writeByte(0);
155*81418a27Smrg             p = (char *)buf.extractData();
156*81418a27Smrg             break;
157*81418a27Smrg         }
158*81418a27Smrg 
159*81418a27Smrg         case TOKidentifier:
160*81418a27Smrg         case TOKenum:
161*81418a27Smrg         case TOKstruct:
162*81418a27Smrg         case TOKimport:
163*81418a27Smrg         case TOKwchar: case TOKdchar:
164*81418a27Smrg         case TOKbool: case TOKchar:
165*81418a27Smrg         case TOKint8: case TOKuns8:
166*81418a27Smrg         case TOKint16: case TOKuns16:
167*81418a27Smrg         case TOKint32: case TOKuns32:
168*81418a27Smrg         case TOKint64: case TOKuns64:
169*81418a27Smrg         case TOKint128: case TOKuns128:
170*81418a27Smrg         case TOKfloat32: case TOKfloat64: case TOKfloat80:
171*81418a27Smrg         case TOKimaginary32: case TOKimaginary64: case TOKimaginary80:
172*81418a27Smrg         case TOKcomplex32: case TOKcomplex64: case TOKcomplex80:
173*81418a27Smrg         case TOKvoid:
174*81418a27Smrg             p = ident->toChars();
175*81418a27Smrg             break;
176*81418a27Smrg 
177*81418a27Smrg         default:
178*81418a27Smrg             p = toChars(value);
179*81418a27Smrg             break;
180*81418a27Smrg     }
181*81418a27Smrg     return p;
182*81418a27Smrg }
183*81418a27Smrg 
toChars(TOK value)184*81418a27Smrg const char *Token::toChars(TOK value)
185*81418a27Smrg {
186*81418a27Smrg     static char buffer[3 + 3 * sizeof(value) + 1];
187*81418a27Smrg 
188*81418a27Smrg     const char *p = tochars[value];
189*81418a27Smrg     if (!p)
190*81418a27Smrg     {
191*81418a27Smrg         sprintf(&buffer[0],"TOK%d",value);
192*81418a27Smrg         p = &buffer[0];
193*81418a27Smrg     }
194*81418a27Smrg     return p;
195*81418a27Smrg }
196*81418a27Smrg 
197*81418a27Smrg /****************************************
198*81418a27Smrg  */
199*81418a27Smrg 
200*81418a27Smrg struct Keyword
201*81418a27Smrg {
202*81418a27Smrg     const char *name;
203*81418a27Smrg     TOK value;
204*81418a27Smrg };
205*81418a27Smrg 
206*81418a27Smrg static size_t nkeywords;
207*81418a27Smrg static Keyword keywords[] =
208*81418a27Smrg {
209*81418a27Smrg     {   "this",         TOKthis         },
210*81418a27Smrg     {   "super",        TOKsuper        },
211*81418a27Smrg     {   "assert",       TOKassert       },
212*81418a27Smrg     {   "null",         TOKnull         },
213*81418a27Smrg     {   "true",         TOKtrue         },
214*81418a27Smrg     {   "false",        TOKfalse        },
215*81418a27Smrg     {   "cast",         TOKcast         },
216*81418a27Smrg     {   "new",          TOKnew          },
217*81418a27Smrg     {   "delete",       TOKdelete       },
218*81418a27Smrg     {   "throw",        TOKthrow        },
219*81418a27Smrg     {   "module",       TOKmodule       },
220*81418a27Smrg     {   "pragma",       TOKpragma       },
221*81418a27Smrg     {   "typeof",       TOKtypeof       },
222*81418a27Smrg     {   "typeid",       TOKtypeid       },
223*81418a27Smrg 
224*81418a27Smrg     {   "template",     TOKtemplate     },
225*81418a27Smrg 
226*81418a27Smrg     {   "void",         TOKvoid         },
227*81418a27Smrg     {   "byte",         TOKint8         },
228*81418a27Smrg     {   "ubyte",        TOKuns8         },
229*81418a27Smrg     {   "short",        TOKint16        },
230*81418a27Smrg     {   "ushort",       TOKuns16        },
231*81418a27Smrg     {   "int",          TOKint32        },
232*81418a27Smrg     {   "uint",         TOKuns32        },
233*81418a27Smrg     {   "long",         TOKint64        },
234*81418a27Smrg     {   "ulong",        TOKuns64        },
235*81418a27Smrg     {   "cent",         TOKint128,      },
236*81418a27Smrg     {   "ucent",        TOKuns128,      },
237*81418a27Smrg     {   "float",        TOKfloat32      },
238*81418a27Smrg     {   "double",       TOKfloat64      },
239*81418a27Smrg     {   "real",         TOKfloat80      },
240*81418a27Smrg 
241*81418a27Smrg     {   "bool",         TOKbool         },
242*81418a27Smrg     {   "char",         TOKchar         },
243*81418a27Smrg     {   "wchar",        TOKwchar        },
244*81418a27Smrg     {   "dchar",        TOKdchar        },
245*81418a27Smrg 
246*81418a27Smrg     {   "ifloat",       TOKimaginary32  },
247*81418a27Smrg     {   "idouble",      TOKimaginary64  },
248*81418a27Smrg     {   "ireal",        TOKimaginary80  },
249*81418a27Smrg 
250*81418a27Smrg     {   "cfloat",       TOKcomplex32    },
251*81418a27Smrg     {   "cdouble",      TOKcomplex64    },
252*81418a27Smrg     {   "creal",        TOKcomplex80    },
253*81418a27Smrg 
254*81418a27Smrg     {   "delegate",     TOKdelegate     },
255*81418a27Smrg     {   "function",     TOKfunction     },
256*81418a27Smrg 
257*81418a27Smrg     {   "is",           TOKis           },
258*81418a27Smrg     {   "if",           TOKif           },
259*81418a27Smrg     {   "else",         TOKelse         },
260*81418a27Smrg     {   "while",        TOKwhile        },
261*81418a27Smrg     {   "for",          TOKfor          },
262*81418a27Smrg     {   "do",           TOKdo           },
263*81418a27Smrg     {   "switch",       TOKswitch       },
264*81418a27Smrg     {   "case",         TOKcase         },
265*81418a27Smrg     {   "default",      TOKdefault      },
266*81418a27Smrg     {   "break",        TOKbreak        },
267*81418a27Smrg     {   "continue",     TOKcontinue     },
268*81418a27Smrg     {   "synchronized", TOKsynchronized },
269*81418a27Smrg     {   "return",       TOKreturn       },
270*81418a27Smrg     {   "goto",         TOKgoto         },
271*81418a27Smrg     {   "try",          TOKtry          },
272*81418a27Smrg     {   "catch",        TOKcatch        },
273*81418a27Smrg     {   "finally",      TOKfinally      },
274*81418a27Smrg     {   "with",         TOKwith         },
275*81418a27Smrg     {   "asm",          TOKasm          },
276*81418a27Smrg     {   "foreach",      TOKforeach      },
277*81418a27Smrg     {   "foreach_reverse",      TOKforeach_reverse      },
278*81418a27Smrg     {   "scope",        TOKscope        },
279*81418a27Smrg 
280*81418a27Smrg     {   "struct",       TOKstruct       },
281*81418a27Smrg     {   "class",        TOKclass        },
282*81418a27Smrg     {   "interface",    TOKinterface    },
283*81418a27Smrg     {   "union",        TOKunion        },
284*81418a27Smrg     {   "enum",         TOKenum         },
285*81418a27Smrg     {   "import",       TOKimport       },
286*81418a27Smrg     {   "mixin",        TOKmixin        },
287*81418a27Smrg     {   "static",       TOKstatic       },
288*81418a27Smrg     {   "final",        TOKfinal        },
289*81418a27Smrg     {   "const",        TOKconst        },
290*81418a27Smrg     {   "alias",        TOKalias        },
291*81418a27Smrg     {   "override",     TOKoverride     },
292*81418a27Smrg     {   "abstract",     TOKabstract     },
293*81418a27Smrg     {   "debug",        TOKdebug        },
294*81418a27Smrg     {   "deprecated",   TOKdeprecated   },
295*81418a27Smrg     {   "in",           TOKin           },
296*81418a27Smrg     {   "out",          TOKout          },
297*81418a27Smrg     {   "inout",        TOKinout        },
298*81418a27Smrg     {   "lazy",         TOKlazy         },
299*81418a27Smrg     {   "auto",         TOKauto         },
300*81418a27Smrg 
301*81418a27Smrg     {   "align",        TOKalign        },
302*81418a27Smrg     {   "extern",       TOKextern       },
303*81418a27Smrg     {   "private",      TOKprivate      },
304*81418a27Smrg     {   "package",      TOKpackage      },
305*81418a27Smrg     {   "protected",    TOKprotected    },
306*81418a27Smrg     {   "public",       TOKpublic       },
307*81418a27Smrg     {   "export",       TOKexport       },
308*81418a27Smrg 
309*81418a27Smrg     {   "invariant",    TOKinvariant    },
310*81418a27Smrg     {   "unittest",     TOKunittest     },
311*81418a27Smrg     {   "version",      TOKversion      },
312*81418a27Smrg 
313*81418a27Smrg     {   "__argTypes",   TOKargTypes     },
314*81418a27Smrg     {   "__parameters", TOKparameters   },
315*81418a27Smrg     {   "ref",          TOKref          },
316*81418a27Smrg     {   "macro",        TOKmacro        },
317*81418a27Smrg 
318*81418a27Smrg     {   "pure",         TOKpure         },
319*81418a27Smrg     {   "nothrow",      TOKnothrow      },
320*81418a27Smrg     {   "__gshared",    TOKgshared      },
321*81418a27Smrg     {   "__traits",     TOKtraits       },
322*81418a27Smrg     {   "__vector",     TOKvector       },
323*81418a27Smrg     {   "__overloadset", TOKoverloadset },
324*81418a27Smrg     {   "__FILE__",     TOKfile         },
325*81418a27Smrg     {   "__FILE_FULL_PATH__", TOKfilefullpath  },
326*81418a27Smrg     {   "__LINE__",     TOKline         },
327*81418a27Smrg     {   "__MODULE__",   TOKmodulestring },
328*81418a27Smrg     {   "__FUNCTION__", TOKfuncstring   },
329*81418a27Smrg     {   "__PRETTY_FUNCTION__", TOKprettyfunc   },
330*81418a27Smrg     {   "shared",       TOKshared       },
331*81418a27Smrg     {   "immutable",    TOKimmutable    },
332*81418a27Smrg     {   NULL,           TOKreserved     }
333*81418a27Smrg };
334*81418a27Smrg 
isKeyword()335*81418a27Smrg int Token::isKeyword()
336*81418a27Smrg {
337*81418a27Smrg     for (size_t u = 0; u < nkeywords; u++)
338*81418a27Smrg     {
339*81418a27Smrg         if (keywords[u].value == value)
340*81418a27Smrg             return 1;
341*81418a27Smrg     }
342*81418a27Smrg     return 0;
343*81418a27Smrg }
344*81418a27Smrg 
345*81418a27Smrg struct TokenInitializer
346*81418a27Smrg {
347*81418a27Smrg     TokenInitializer();
348*81418a27Smrg };
349*81418a27Smrg 
350*81418a27Smrg static TokenInitializer tokeninitializer;
351*81418a27Smrg 
TokenInitializer()352*81418a27Smrg TokenInitializer::TokenInitializer()
353*81418a27Smrg {
354*81418a27Smrg     Identifier::initTable();
355*81418a27Smrg     for (nkeywords = 0; keywords[nkeywords].name; nkeywords++)
356*81418a27Smrg     {
357*81418a27Smrg         //printf("keyword[%d] = '%s'\n",u, keywords[u].name);
358*81418a27Smrg         const char *s = keywords[nkeywords].name;
359*81418a27Smrg         size_t len = strlen(s);
360*81418a27Smrg         TOK v = keywords[nkeywords].value;
361*81418a27Smrg         Identifier::idPool(s, len, v);
362*81418a27Smrg 
363*81418a27Smrg         //printf("tochars[%d] = '%s'\n",v, s);
364*81418a27Smrg         Token::tochars[v] = s;
365*81418a27Smrg     }
366*81418a27Smrg 
367*81418a27Smrg     Token::tochars[TOKeof]              = "EOF";
368*81418a27Smrg     Token::tochars[TOKlcurly]           = "{";
369*81418a27Smrg     Token::tochars[TOKrcurly]           = "}";
370*81418a27Smrg     Token::tochars[TOKlparen]           = "(";
371*81418a27Smrg     Token::tochars[TOKrparen]           = ")";
372*81418a27Smrg     Token::tochars[TOKlbracket]         = "[";
373*81418a27Smrg     Token::tochars[TOKrbracket]         = "]";
374*81418a27Smrg     Token::tochars[TOKsemicolon]        = ";";
375*81418a27Smrg     Token::tochars[TOKcolon]            = ":";
376*81418a27Smrg     Token::tochars[TOKcomma]            = ",";
377*81418a27Smrg     Token::tochars[TOKdot]              = ".";
378*81418a27Smrg     Token::tochars[TOKxor]              = "^";
379*81418a27Smrg     Token::tochars[TOKxorass]           = "^=";
380*81418a27Smrg     Token::tochars[TOKassign]           = "=";
381*81418a27Smrg     Token::tochars[TOKconstruct]        = "=";
382*81418a27Smrg     Token::tochars[TOKblit]             = "=";
383*81418a27Smrg     Token::tochars[TOKlt]               = "<";
384*81418a27Smrg     Token::tochars[TOKgt]               = ">";
385*81418a27Smrg     Token::tochars[TOKle]               = "<=";
386*81418a27Smrg     Token::tochars[TOKge]               = ">=";
387*81418a27Smrg     Token::tochars[TOKequal]            = "==";
388*81418a27Smrg     Token::tochars[TOKnotequal]         = "!=";
389*81418a27Smrg     Token::tochars[TOKnotidentity]      = "!is";
390*81418a27Smrg 
391*81418a27Smrg     Token::tochars[TOKunord]            = "!<>=";
392*81418a27Smrg     Token::tochars[TOKue]               = "!<>";
393*81418a27Smrg     Token::tochars[TOKlg]               = "<>";
394*81418a27Smrg     Token::tochars[TOKleg]              = "<>=";
395*81418a27Smrg     Token::tochars[TOKule]              = "!>";
396*81418a27Smrg     Token::tochars[TOKul]               = "!>=";
397*81418a27Smrg     Token::tochars[TOKuge]              = "!<";
398*81418a27Smrg     Token::tochars[TOKug]               = "!<=";
399*81418a27Smrg 
400*81418a27Smrg     Token::tochars[TOKnot]              = "!";
401*81418a27Smrg     Token::tochars[TOKshl]              = "<<";
402*81418a27Smrg     Token::tochars[TOKshr]              = ">>";
403*81418a27Smrg     Token::tochars[TOKushr]             = ">>>";
404*81418a27Smrg     Token::tochars[TOKadd]              = "+";
405*81418a27Smrg     Token::tochars[TOKmin]              = "-";
406*81418a27Smrg     Token::tochars[TOKmul]              = "*";
407*81418a27Smrg     Token::tochars[TOKdiv]              = "/";
408*81418a27Smrg     Token::tochars[TOKmod]              = "%";
409*81418a27Smrg     Token::tochars[TOKslice]            = "..";
410*81418a27Smrg     Token::tochars[TOKdotdotdot]        = "...";
411*81418a27Smrg     Token::tochars[TOKand]              = "&";
412*81418a27Smrg     Token::tochars[TOKandand]           = "&&";
413*81418a27Smrg     Token::tochars[TOKor]               = "|";
414*81418a27Smrg     Token::tochars[TOKoror]             = "||";
415*81418a27Smrg     Token::tochars[TOKarray]            = "[]";
416*81418a27Smrg     Token::tochars[TOKindex]            = "[i]";
417*81418a27Smrg     Token::tochars[TOKaddress]          = "&";
418*81418a27Smrg     Token::tochars[TOKstar]             = "*";
419*81418a27Smrg     Token::tochars[TOKtilde]            = "~";
420*81418a27Smrg     Token::tochars[TOKdollar]           = "$";
421*81418a27Smrg     Token::tochars[TOKcast]             = "cast";
422*81418a27Smrg     Token::tochars[TOKplusplus]         = "++";
423*81418a27Smrg     Token::tochars[TOKminusminus]       = "--";
424*81418a27Smrg     Token::tochars[TOKpreplusplus]      = "++";
425*81418a27Smrg     Token::tochars[TOKpreminusminus]    = "--";
426*81418a27Smrg     Token::tochars[TOKtype]             = "type";
427*81418a27Smrg     Token::tochars[TOKquestion]         = "?";
428*81418a27Smrg     Token::tochars[TOKneg]              = "-";
429*81418a27Smrg     Token::tochars[TOKuadd]             = "+";
430*81418a27Smrg     Token::tochars[TOKvar]              = "var";
431*81418a27Smrg     Token::tochars[TOKaddass]           = "+=";
432*81418a27Smrg     Token::tochars[TOKminass]           = "-=";
433*81418a27Smrg     Token::tochars[TOKmulass]           = "*=";
434*81418a27Smrg     Token::tochars[TOKdivass]           = "/=";
435*81418a27Smrg     Token::tochars[TOKmodass]           = "%=";
436*81418a27Smrg     Token::tochars[TOKshlass]           = "<<=";
437*81418a27Smrg     Token::tochars[TOKshrass]           = ">>=";
438*81418a27Smrg     Token::tochars[TOKushrass]          = ">>>=";
439*81418a27Smrg     Token::tochars[TOKandass]           = "&=";
440*81418a27Smrg     Token::tochars[TOKorass]            = "|=";
441*81418a27Smrg     Token::tochars[TOKcatass]           = "~=";
442*81418a27Smrg     Token::tochars[TOKcat]              = "~";
443*81418a27Smrg     Token::tochars[TOKcall]             = "call";
444*81418a27Smrg     Token::tochars[TOKidentity]         = "is";
445*81418a27Smrg     Token::tochars[TOKnotidentity]      = "!is";
446*81418a27Smrg 
447*81418a27Smrg     Token::tochars[TOKorass]            = "|=";
448*81418a27Smrg     Token::tochars[TOKidentifier]       = "identifier";
449*81418a27Smrg     Token::tochars[TOKat]               = "@";
450*81418a27Smrg     Token::tochars[TOKpow]              = "^^";
451*81418a27Smrg     Token::tochars[TOKpowass]           = "^^=";
452*81418a27Smrg     Token::tochars[TOKgoesto]           = "=>";
453*81418a27Smrg     Token::tochars[TOKpound]            = "#";
454*81418a27Smrg 
455*81418a27Smrg      // For debugging
456*81418a27Smrg     Token::tochars[TOKerror]            = "error";
457*81418a27Smrg     Token::tochars[TOKdotid]            = "dotid";
458*81418a27Smrg     Token::tochars[TOKdottd]            = "dottd";
459*81418a27Smrg     Token::tochars[TOKdotti]            = "dotti";
460*81418a27Smrg     Token::tochars[TOKdotvar]           = "dotvar";
461*81418a27Smrg     Token::tochars[TOKdottype]          = "dottype";
462*81418a27Smrg     Token::tochars[TOKsymoff]           = "symoff";
463*81418a27Smrg     Token::tochars[TOKarraylength]      = "arraylength";
464*81418a27Smrg     Token::tochars[TOKarrayliteral]     = "arrayliteral";
465*81418a27Smrg     Token::tochars[TOKassocarrayliteral] = "assocarrayliteral";
466*81418a27Smrg     Token::tochars[TOKstructliteral]    = "structliteral";
467*81418a27Smrg     Token::tochars[TOKstring]           = "string";
468*81418a27Smrg     Token::tochars[TOKdsymbol]          = "symbol";
469*81418a27Smrg     Token::tochars[TOKtuple]            = "tuple";
470*81418a27Smrg     Token::tochars[TOKdeclaration]      = "declaration";
471*81418a27Smrg     Token::tochars[TOKon_scope_exit]    = "scope(exit)";
472*81418a27Smrg     Token::tochars[TOKon_scope_success] = "scope(success)";
473*81418a27Smrg     Token::tochars[TOKon_scope_failure] = "scope(failure)";
474*81418a27Smrg     Token::tochars[TOKdelegateptr]      = "delegateptr";
475*81418a27Smrg     Token::tochars[TOKvectorarray]      = "vectorarray";
476*81418a27Smrg }
477