aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/XMREngine/MMRScriptTokenize.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/XMREngine/MMRScriptTokenize.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/XMREngine/MMRScriptTokenize.cs1724
1 files changed, 0 insertions, 1724 deletions
diff --git a/OpenSim/Region/ScriptEngine/XMREngine/MMRScriptTokenize.cs b/OpenSim/Region/ScriptEngine/XMREngine/MMRScriptTokenize.cs
deleted file mode 100644
index 1bdcc27..0000000
--- a/OpenSim/Region/ScriptEngine/XMREngine/MMRScriptTokenize.cs
+++ /dev/null
@@ -1,1724 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28/**
29 * @brief Parse raw source file string into token list.
30 *
31 * Usage:
32 *
33 * emsg = some function to output error messages to
34 * source = string containing entire source file
35 *
36 * TokenBegin tokenBegin = TokenBegin.Construct (emsg, source);
37 *
38 * tokenBegin = null: tokenizing error
39 * else: first (dummy) token in file
40 * the rest are chained by nextToken,prevToken
41 * final token is always a (dummy) TokenEnd
42 */
43
44using System;
45using System.Collections.Generic;
46using System.IO;
47using System.Net;
48using System.Reflection;
49using System.Reflection.Emit;
50using System.Text;
51
52using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat;
53using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
54using LSL_Key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
55using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list;
56using LSL_Rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion;
57using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
58using LSL_Vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3;
59
60namespace OpenSim.Region.ScriptEngine.XMREngine {
61
62 public delegate void TokenErrorMessage (Token token, string message);
63
64 /**
65 * @brief base class for all tokens
66 */
67 public class Token {
68 public static readonly int MAX_NAME_LEN = 255;
69 public static readonly int MAX_STRING_LEN = 4096;
70
71 public Token nextToken;
72 public Token prevToken;
73 public bool nr2l;
74
75 // used for error message printing
76 public TokenErrorMessage emsg;
77 public string file = "";
78 public int line;
79 public int posn;
80 public Token copiedFrom;
81
82 /**
83 * @brief construct a token coming directly from a source file
84 * @param emsg = object that error messages get sent to
85 * @param file = source file name (or "" if none)
86 * @param line = source file line number
87 * @param posn = token's position within that source line
88 */
89 public Token (TokenErrorMessage emsg, string file, int line, int posn)
90 {
91 this.emsg = emsg;
92 this.file = file;
93 this.line = line;
94 this.posn = posn;
95 }
96
97 /**
98 * @brief construct a token with same error message parameters
99 * @param original = original token to create from
100 */
101 public Token (Token original)
102 {
103 if (original != null) {
104 this.emsg = original.emsg;
105 this.file = original.file;
106 this.line = original.line;
107 this.posn = original.posn;
108 this.nr2l = original.nr2l;
109 }
110 }
111
112 /**
113 * @brief output an error message associated with this token
114 * sends the message to the token's error object
115 * @param message = error message string
116 */
117 public void ErrorMsg (string message)
118 {
119 if (emsg != null) {
120 emsg (this, message);
121 }
122 }
123
124 /*
125 * Generate a unique string (for use in CIL label names, etc)
126 */
127 public string Unique
128 {
129 get { return file + "_" + line + "_" + posn; }
130 }
131
132 /*
133 * Generate source location string (for use in error messages)
134 */
135 public string SrcLoc
136 {
137 get {
138 string loc = file + "(" + line + "," + posn + ")";
139 if (copiedFrom == null) return loc;
140 string fromLoc = copiedFrom.SrcLoc;
141 if (fromLoc.StartsWith (loc)) return fromLoc;
142 return loc + ":" + fromLoc;
143 }
144 }
145
146 /*
147 * Used in generic instantiation to copy token.
148 * Only valid for parsing tokens, not reduction tokens
149 * because it is a shallow copy.
150 */
151 public Token CopyToken (Token src)
152 {
153 Token t = (Token)this.MemberwiseClone ();
154 t.file = src.file;
155 t.line = src.line;
156 t.posn = src.posn;
157 t.copiedFrom = this;
158 return t;
159 }
160
161 /*
162 * Generate debugging string - should look like source code.
163 */
164 public virtual void DebString (StringBuilder sb)
165 {
166 sb.Append (this.ToString ());
167 }
168 }
169
170
171 /**
172 * @brief token that begins a source file
173 * Along with TokenEnd, it keeps insertion/removal of intermediate tokens
174 * simple as the intermediate tokens always have non-null nextToken,prevToken.
175 */
176 public class TokenBegin : Token {
177
178 public int expiryDays = Int32.MaxValue; // has seen 'XMROption expiryDays;'
179
180 private class Options {
181 public bool arrays; // has seen 'XMROption arrays;'
182 public bool advFlowCtl; // has seen 'XMROption advFlowCtl;'
183 public bool tryCatch; // has seen 'XMROption tryCatch;'
184 public bool objects; // has seen 'XMROption objects;'
185 public bool chars; // has seen 'XMROption chars;'
186 public bool noRightToLeft; // has seen 'XMROption noRightToLeft;'
187 public bool dollarsigns; // has seen 'XMROption dollarsigns;'
188 }
189
190 private bool youveAnError; // there was some error tokenizing
191 private int bolIdx; // index in 'source' at begining of current line
192 private int lineNo; // current line in source file, starting at 0
193 private string filNam; // current source file name
194 private string source; // the whole script source code
195 private Token lastToken; // last token created so far
196 private string cameFrom; // where the source came from
197 private TextWriter saveSource; // save copy of source here (or null)
198 private Options options = new Options ();
199
200 /**
201 * @brief convert a source file in the form of a string
202 * to a list of raw tokens
203 * @param cameFrom = where the source came from
204 * @param emsg = where to output messages to
205 * @param source = whole source file contents
206 * @returns null: conversion error, message already output
207 * else: list of tokens, starting with TokenBegin, ending with TokenEnd.
208 */
209 public static TokenBegin Construct (string cameFrom, TextWriter saveSource, TokenErrorMessage emsg, string source, out string sourceHash)
210 {
211 sourceHash = null;
212
213 /*
214 * Now do the tokenization.
215 */
216 TokenBegin tokenBegin = new TokenBegin (emsg, "", 0, 0);
217 tokenBegin.cameFrom = cameFrom;
218 tokenBegin.saveSource = saveSource;
219 tokenBegin.lastToken = tokenBegin;
220 tokenBegin.source = source;
221 tokenBegin.filNam = cameFrom;
222 if (saveSource != null) saveSource.WriteLine (source);
223 tokenBegin.Tokenize ();
224 if (tokenBegin.youveAnError) return null;
225 tokenBegin.AppendToken (new TokenEnd (emsg, tokenBegin.filNam, ++ tokenBegin.lineNo, 0));
226
227 /*
228 * Return source hash so caller can know if source changes.
229 */
230 System.Security.Cryptography.MD5 md5 = System.Security.Cryptography.MD5.Create ();
231 byte[] hashBytes = md5.ComputeHash (new TokenStream (tokenBegin));
232 int hashBytesLen = hashBytes.Length;
233 StringBuilder sb = new StringBuilder (hashBytesLen * 2);
234 for (int i = 0; i < hashBytesLen; i ++) {
235 sb.Append (hashBytes[i].ToString ("X2"));
236 }
237 sourceHash = sb.ToString ();
238 if (saveSource != null) {
239 saveSource.WriteLine (" ");
240 saveSource.WriteLine ("********************************************************************************");
241 saveSource.WriteLine ("**** source hash: " + sourceHash);
242 saveSource.WriteLine ("********************************************************************************");
243 }
244
245 return tokenBegin;
246 }
247
248 private TokenBegin (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { }
249
250 /*
251 * Stream consisting of all the tokens.
252 * Null delimeters between the tokens.
253 * Used for creating the source hash.
254 */
255 private class TokenStream : Stream {
256 private Token curTok;
257 private bool delim;
258 private byte[] curBuf;
259 private int curOfs;
260 private int curLen;
261
262 public TokenStream (Token t)
263 {
264 curTok = t;
265 }
266
267 public override bool CanRead { get { return true; } }
268 public override bool CanSeek { get { return false; } }
269 public override bool CanWrite { get { return false; } }
270 public override long Length { get { return 0; } }
271 public override long Position { get { return 0; } set { } }
272
273 public override void Write (byte[] buffer, int offset, int count) { }
274 public override void Flush () { }
275 public override long Seek (long offset, SeekOrigin origin) { return 0; }
276 public override void SetLength (long value) { }
277
278 public override int Read (byte[] buffer, int offset, int count)
279 {
280 int len, total;
281 for (total = 0; total < count; total += len) {
282 while ((len = curLen - curOfs) <= 0) {
283 if (curTok is TokenEnd) goto done;
284 curTok = curTok.nextToken;
285 if (curTok is TokenEnd) goto done;
286 curBuf = System.Text.Encoding.UTF8.GetBytes (curTok.ToString ());
287 curOfs = 0;
288 curLen = curBuf.Length;
289 delim = true;
290 }
291 if (delim) {
292 buffer[offset+total] = 0;
293 delim = false;
294 len = 1;
295 } else {
296 if (len > count - total) len = count - total;
297 Array.Copy (curBuf, curOfs, buffer, offset + total, len);
298 curOfs += len;
299 }
300 }
301 done:
302 return total;
303 }
304 }
305
306 /*
307 * Produces raw token stream: names, numbers, strings, keywords/delimeters.
308 * @param this.source = whole source file in one string
309 * @returns this.nextToken = filled in with tokens
310 * this.youveAnError = true: some tokenizing error
311 * false: successful
312 */
313 private void Tokenize ()
314 {
315 bolIdx = 0;
316 lineNo = 0;
317 for (int i = 0; i < source.Length; i ++) {
318 char c = source[i];
319 if (c == '\n') {
320
321 /*
322 * Increment source line number and set char index of beg of next line.
323 */
324 lineNo ++;
325 bolIdx = i + 1;
326
327 /*
328 * Check for '#' lineno filename newline
329 * lineno is line number of next line in file
330 * If found, save values and remove tokens from stream
331 */
332 if ((lastToken is TokenStr) &&
333 (lastToken.prevToken is TokenInt) &&
334 (lastToken.prevToken.prevToken is TokenKwHash)) {
335 filNam = ((TokenStr)lastToken).val;
336 lineNo = ((TokenInt)lastToken.prevToken).val;
337 lastToken = lastToken.prevToken.prevToken.prevToken;
338 lastToken.nextToken = null;
339 }
340 continue;
341 }
342
343 /*
344 * Skip over whitespace.
345 */
346 if (c <= ' ') continue;
347
348 /*
349 * Skip over comments.
350 */
351 if ((i + 2 <= source.Length) && source.Substring (i, 2).Equals ("//")) {
352 while ((i < source.Length) && (source[i] != '\n')) i ++;
353 lineNo ++;
354 bolIdx = i + 1;
355 continue;
356 }
357 if ((i + 2 <= source.Length) && (source.Substring (i, 2).Equals ("/*"))) {
358 i += 2;
359 while ((i + 1 < source.Length) && (((c = source[i]) != '*') || (source[i+1] != '/'))) {
360 if (c == '\n') {
361 lineNo ++;
362 bolIdx = i + 1;
363 }
364 i ++;
365 }
366 i ++;
367 continue;
368 }
369
370 /*
371 * Check for numbers.
372 */
373 if ((c >= '0') && (c <= '9')) {
374 int j = TryParseFloat (i);
375 if (j == 0) j = TryParseInt (i);
376 i = -- j;
377 continue;
378 }
379 if ((c == '.') && (source[i+1] >= '0') && (source[i+1] <= '9')) {
380 int j = TryParseFloat (i);
381 if (j > 0) i = -- j;
382 continue;
383 }
384
385 /*
386 * Check for quoted strings.
387 */
388 if (c == '"') {
389 StringBuilder sb = new StringBuilder ();
390 bool backslash;
391 int j;
392
393 backslash = false;
394 for (j = i; ++ j < source.Length;) {
395 c = source[j];
396 if (c == '\\' && !backslash) {
397 backslash = true;
398 continue;
399 }
400 if (c == '\n') {
401 lineNo ++;
402 bolIdx = j + 1;
403 } else {
404 if (!backslash && (c == '"')) break;
405 if (backslash && (c == 'n')) c = '\n';
406 if (backslash && (c == 't')) {
407 sb.Append (" ");
408 c = ' ';
409 }
410 }
411 backslash = false;
412 sb.Append (c);
413 }
414 if (j - i > MAX_STRING_LEN) {
415 TokenError (i, "string too long, max " + MAX_STRING_LEN);
416 } else {
417 AppendToken (new TokenStr (emsg, filNam, lineNo, i - bolIdx, sb.ToString ()));
418 }
419 i = j;
420 continue;
421 }
422
423 /*
424 * Check for quoted characters.
425 */
426 if (c == '\'') {
427 char cb = (char)0;
428 bool backslash, overflow, underflow;
429 int j;
430
431 backslash = false;
432 overflow = false;
433 underflow = true;
434 for (j = i; ++ j < source.Length;) {
435 c = source[j];
436 if (c == '\\' && !backslash) {
437 backslash = true;
438 continue;
439 }
440 if (c == '\n') {
441 lineNo ++;
442 bolIdx = j + 1;
443 } else {
444 if (!backslash && (c == '\'')) break;
445 if (backslash && (c == 'n')) c = '\n';
446 if (backslash && (c == 't')) c = '\t';
447 }
448 backslash = false;
449 overflow = !underflow;
450 underflow = false;
451 cb = c;
452 }
453 if (underflow || overflow) {
454 TokenError (i, "character must be exactly one character");
455 } else {
456 AppendToken (new TokenChar (emsg, filNam, lineNo, i - bolIdx, cb));
457 }
458 i = j;
459 continue;
460 }
461
462 /*
463 * Check for keywords/names.
464 */
465 if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c == '_') || (c == '$' && options.dollarsigns)) {
466 int j;
467
468 for (j = i; ++ j < source.Length;) {
469 c = source[j];
470 if (c >= 'a' && c <= 'z') continue;
471 if (c >= 'A' && c <= 'Z') continue;
472 if (c >= '0' && c <= '9') continue;
473 if (c == '$' && options.dollarsigns) continue;
474 if (c != '_') break;
475 }
476 if (j - i > MAX_NAME_LEN) {
477 TokenError (i, "name too long, max " + MAX_NAME_LEN);
478 } else {
479 string name = source.Substring (i, j - i);
480 if (name == "quaternion") name = "rotation"; // see lslangtest1.lsl
481 if (keywords.ContainsKey (name)) {
482 Object[] args = new Object[] { emsg, filNam, lineNo, i - bolIdx };
483 AppendToken ((Token)keywords[name].Invoke (args));
484 } else if (options.arrays && arrayKeywords.ContainsKey (name)) {
485 Object[] args = new Object[] { emsg, filNam, lineNo, i - bolIdx };
486 AppendToken ((Token)arrayKeywords[name].Invoke (args));
487 } else if (options.advFlowCtl && advFlowCtlKeywords.ContainsKey (name)) {
488 Object[] args = new Object[] { emsg, filNam, lineNo, i - bolIdx };
489 AppendToken ((Token)advFlowCtlKeywords[name].Invoke (args));
490 } else if (options.tryCatch && tryCatchKeywords.ContainsKey (name)) {
491 Object[] args = new Object[] { emsg, filNam, lineNo, i - bolIdx };
492 AppendToken ((Token)tryCatchKeywords[name].Invoke (args));
493 } else if (options.objects && objectsKeywords.ContainsKey (name)) {
494 Object[] args = new Object[] { emsg, filNam, lineNo, i - bolIdx };
495 AppendToken ((Token)objectsKeywords[name].Invoke (args));
496 } else if (options.chars && charsKeywords.ContainsKey (name)) {
497 Object[] args = new Object[] { emsg, filNam, lineNo, i - bolIdx };
498 AppendToken ((Token)charsKeywords[name].Invoke (args));
499 } else {
500 AppendToken (new TokenName (emsg, filNam, lineNo, i - bolIdx, name));
501 }
502 }
503 i = -- j;
504 continue;
505 }
506
507 /*
508 * Check for option enables.
509 */
510 if ((c == ';') && (lastToken is TokenName) &&
511 (lastToken.prevToken is TokenName) &&
512 (strcasecmp(((TokenName)lastToken.prevToken).val, "xmroption") == 0)) {
513 string opt = ((TokenName)lastToken).val;
514 if (strcasecmp (opt, "arrays") == 0) {
515 options.arrays = true;
516 } else if (strcasecmp (opt, "advflowctl") == 0) {
517 options.advFlowCtl = true;
518 } else if (strcasecmp (opt, "trycatch") == 0) {
519 options.tryCatch = true;
520 } else if (strcasecmp (opt, "objects") == 0) {
521 options.objects = true;
522 } else if (strcasecmp (opt, "chars") == 0) {
523 options.chars = true;
524 } else if (strcasecmp (opt, "norighttoleft") == 0) {
525 options.noRightToLeft = true;
526 } else if (strcasecmp (opt, "dollarsigns") == 0) {
527 options.dollarsigns = true;
528 } else {
529 lastToken.ErrorMsg ("unknown XMROption");
530 }
531 lastToken = lastToken.prevToken.prevToken;
532 lastToken.nextToken = null;
533 continue;
534 }
535
536 /*
537 * Handle 'xmroption' 'expirydays' numberofdays ';'
538 */
539 if ((c == ';') &&
540 (lastToken is TokenInt) &&
541 (lastToken.prevToken is TokenName) &&
542 (lastToken.prevToken.prevToken is TokenName) &&
543 (strcasecmp(((TokenName)lastToken.prevToken.prevToken).val, "xmroption") == 0) &&
544 (strcasecmp(((TokenName)lastToken.prevToken).val, "expirydays") == 0)) {
545 expiryDays = ((TokenInt)lastToken).val;
546 this.lastToken = lastToken.prevToken.prevToken.prevToken;
547 this.lastToken.nextToken = null;
548 continue;
549 }
550
551
552 /*
553 * Handle 'xmroption' 'include' sourceurl ';'
554 */
555 if ((c == ';') &&
556 (lastToken is TokenStr) &&
557 (lastToken.prevToken is TokenName) &&
558 (lastToken.prevToken.prevToken is TokenName) &&
559 (strcasecmp(((TokenName)lastToken.prevToken.prevToken).val, "xmroption") == 0) &&
560 (strcasecmp(((TokenName)lastToken.prevToken).val, "include") == 0)) {
561
562 string newURL = ((TokenStr)lastToken).val;
563 if (newURL == "") {
564 lastToken.ErrorMsg ("empty URL string");
565 continue;
566 }
567 string newCameFrom = CreateURL (this.cameFrom, newURL);
568 string newSource = ReadSourceFromURL (newCameFrom);
569
570 this.lastToken = lastToken.prevToken.prevToken.prevToken;
571 this.lastToken.nextToken = null;
572
573 if (newSource != null) {
574 if (saveSource != null) {
575 saveSource.WriteLine (" ");
576 saveSource.WriteLine ("********************************************************************************");
577 saveSource.WriteLine ("**** include url: " + newCameFrom);
578 saveSource.WriteLine ("********************************************************************************");
579 saveSource.WriteLine (newSource);
580 }
581
582 string saveSourc = this.source;
583 string saveFilNam = this.filNam;
584 string saveCameFrom = this.cameFrom;
585 int saveBolIdx = this.bolIdx;
586 int saveLineNo = this.lineNo;
587 Options saveOptions = this.options;
588 this.source = newSource;
589 this.filNam = newURL;
590 this.cameFrom = newCameFrom;
591 this.options = new Options ();
592 this.Tokenize ();
593 this.source = saveSourc;
594 this.filNam = saveFilNam;
595 this.cameFrom = saveCameFrom;
596 this.bolIdx = saveBolIdx;
597 this.lineNo = saveLineNo;
598 this.options = saveOptions;
599 }
600 continue;
601 }
602
603 /*
604 * Lastly, check for delimeters.
605 */
606 {
607 int j;
608 int len = 0;
609
610 for (j = 0; j < delims.Length; j ++) {
611 len = delims[j].str.Length;
612 if ((i + len <= source.Length) && (source.Substring (i, len).Equals (delims[j].str))) break;
613 }
614 if (j < delims.Length) {
615 Object[] args = { emsg, filNam, lineNo, i - bolIdx };
616 Token kwToken = (Token)delims[j].ctorInfo.Invoke (args);
617 AppendToken (kwToken);
618 i += -- len;
619 continue;
620 }
621 }
622
623 /*
624 * Don't know what it is!
625 */
626 TokenError (i, "unknown character '" + c + "'");
627 }
628 }
629
630 private static int strcasecmp (String s, String t)
631 {
632 return String.Compare(s,t,StringComparison.OrdinalIgnoreCase);
633 }
634
635 /**
636 * @brief try to parse a floating-point number from the source
637 * @param i = starting position within this.source of number
638 * @returns 0: not a floating point number, try something else
639 * else: position in this.source of terminating character, ie, past number
640 * TokenFloat appended to token list
641 * or error message has been output
642 */
643 private int TryParseFloat (int i)
644 {
645 bool decimals, error, negexp, nulexp;
646 char c;
647 double f, f10;
648 int exponent, j, x, y;
649 ulong m, mantissa;
650
651 decimals = false;
652 error = false;
653 exponent = 0;
654 mantissa = 0;
655 for (j = i; j < source.Length; j ++) {
656 c = source[j];
657 if ((c >= '0') && (c <= '9')) {
658 m = mantissa * 10 + (ulong)(c - '0');
659 if (m / 10 != mantissa) {
660 if (!decimals) exponent ++;
661 } else {
662 mantissa = m;
663 if (decimals) exponent --;
664 }
665 continue;
666 }
667 if (c == '.') {
668 if (decimals) {
669 TokenError (i, "more than one decimal point");
670 return j;
671 }
672 decimals = true;
673 continue;
674 }
675 if ((c == 'E') || (c == 'e')) {
676 if (++ j >= source.Length) {
677 TokenError (i, "floating exponent off end of source");
678 return j;
679 }
680 c = source[j];
681 negexp = (c == '-');
682 if (negexp || (c == '+')) j ++;
683 y = 0;
684 nulexp = true;
685 for (; j < source.Length; j ++) {
686 c = source[j];
687 if ((c < '0') || (c > '9')) break;
688 x = y * 10 + (c - '0');
689 if (x / 10 != y) {
690 if (!error) TokenError (i, "floating exponent overflow");
691 error = true;
692 }
693 y = x;
694 nulexp = false;
695 }
696 if (nulexp) {
697 TokenError (i, "bad or missing floating exponent");
698 return j;
699 }
700 if (negexp) {
701 x = exponent - y;
702 if (x > exponent) {
703 if (!error) TokenError (i, "floating exponent overflow");
704 error = true;
705 }
706 } else {
707 x = exponent + y;
708 if (x < exponent) {
709 if (!error) TokenError (i, "floating exponent overflow");
710 error = true;
711 }
712 }
713 exponent = x;
714 }
715 break;
716 }
717 if (!decimals) {
718 return 0;
719 }
720
721 f = mantissa;
722 if ((exponent != 0) && (mantissa != 0) && !error) {
723 f10 = 10.0;
724 if (exponent < 0) {
725 exponent = -exponent;
726 while (exponent > 0) {
727 if ((exponent & 1) != 0) {
728 f /= f10;
729 }
730 exponent /= 2;
731 f10 *= f10;
732 }
733 } else {
734 while (exponent > 0) {
735 if ((exponent & 1) != 0) {
736 f *= f10;
737 }
738 exponent /= 2;
739 f10 *= f10;
740 }
741 }
742 }
743 if (!error) {
744 AppendToken (new TokenFloat (emsg, filNam, lineNo, i - bolIdx, f));
745 }
746 return j;
747 }
748
749 /**
750 * @brief try to parse an integer number from the source
751 * @param i = starting position within this.source of number
752 * @returns 0: not an integer number, try something else
753 * else: position in this.source of terminating character, ie, past number
754 * TokenInt appended to token list
755 * or error message has been output
756 */
757 private int TryParseInt (int i)
758 {
759 bool error;
760 char c;
761 int j;
762 uint basse, m, mantissa;
763
764 basse = 10;
765 error = false;
766 mantissa = 0;
767 for (j = i; j < source.Length; j ++) {
768 c = source[j];
769 if ((c >= '0') && (c <= '9')) {
770 m = mantissa * basse + (uint)(c - '0');
771 if (m / basse != mantissa) {
772 if (!error) TokenError (i, "integer overflow");
773 error = true;
774 }
775 mantissa = m;
776 continue;
777 }
778 if ((basse == 16) && ((c >= 'A') && (c <= 'F'))) {
779 m = mantissa * basse + (uint)(c - 'A') + 10U;
780 if (m / basse != mantissa) {
781 if (!error) TokenError (i, "integer overflow");
782 error = true;
783 }
784 mantissa = m;
785 continue;
786 }
787 if ((basse == 16) && ((c >= 'a') && (c <= 'f'))) {
788 m = mantissa * basse + (uint)(c - 'a') + 10U;
789 if (m / basse != mantissa) {
790 if (!error) TokenError (i, "integer overflow");
791 error = true;
792 }
793 mantissa = m;
794 continue;
795 }
796 if (((c == 'x') || (c == 'X')) && (mantissa == 0) && (basse == 10)) {
797 basse = 16;
798 continue;
799 }
800 break;
801 }
802 if (!error) {
803 AppendToken (new TokenInt (emsg, filNam, lineNo, i - bolIdx, (int)mantissa));
804 }
805 return j;
806 }
807
808 /**
809 * @brief append token on to end of list
810 * @param newToken = token to append
811 * @returns with token appended onto this.lastToken
812 */
813 private void AppendToken (Token newToken)
814 {
815 newToken.nextToken = null;
816 newToken.prevToken = lastToken;
817 newToken.nr2l = this.options.noRightToLeft;
818 lastToken.nextToken = newToken;
819 lastToken = newToken;
820 }
821
822 /**
823 * @brief print tokenizing error message
824 * and remember that we've an error
825 * @param i = position within source file of the error
826 * @param message = error message text
827 * @returns with this.youveAnError set
828 */
829 private void TokenError (int i, string message)
830 {
831 Token temp = new Token (this.emsg, this.filNam, this.lineNo, i - this.bolIdx);
832 temp.ErrorMsg (message);
833 youveAnError = true;
834 }
835
836 /**
837 * @brief get a token's constructor
838 * @param tokenType = token's type
839 * @returns token's constructor
840 */
841 private static Type[] constrTypes = new Type[] {
842 typeof (TokenErrorMessage), typeof (string), typeof (int), typeof (int)
843 };
844
845 private static System.Reflection.ConstructorInfo GetTokenCtor (Type tokenType)
846 {
847 return tokenType.GetConstructor (constrTypes);
848 }
849
850 /**
851 * @brief delimeter table
852 */
853 private class Delim {
854 public string str;
855 public System.Reflection.ConstructorInfo ctorInfo;
856 public Delim (string str, Type type)
857 {
858 this.str = str;
859 ctorInfo = GetTokenCtor (type);
860 }
861 }
862
863 private static Delim[] delims = new Delim[] {
864 new Delim ("...", typeof (TokenKwDotDotDot)),
865 new Delim ("&&&", typeof (TokenKwAndAndAnd)),
866 new Delim ("|||", typeof (TokenKwOrOrOr)),
867 new Delim ("<<=", typeof (TokenKwAsnLSh)),
868 new Delim (">>=", typeof (TokenKwAsnRSh)),
869 new Delim ("<=", typeof (TokenKwCmpLE)),
870 new Delim (">=", typeof (TokenKwCmpGE)),
871 new Delim ("==", typeof (TokenKwCmpEQ)),
872 new Delim ("!=", typeof (TokenKwCmpNE)),
873 new Delim ("++", typeof (TokenKwIncr)),
874 new Delim ("--", typeof (TokenKwDecr)),
875 new Delim ("&&", typeof (TokenKwAndAnd)),
876 new Delim ("||", typeof (TokenKwOrOr)),
877 new Delim ("+=", typeof (TokenKwAsnAdd)),
878 new Delim ("&=", typeof (TokenKwAsnAnd)),
879 new Delim ("-=", typeof (TokenKwAsnSub)),
880 new Delim ("*=", typeof (TokenKwAsnMul)),
881 new Delim ("/=", typeof (TokenKwAsnDiv)),
882 new Delim ("%=", typeof (TokenKwAsnMod)),
883 new Delim ("|=", typeof (TokenKwAsnOr)),
884 new Delim ("^=", typeof (TokenKwAsnXor)),
885 new Delim ("<<", typeof (TokenKwLSh)),
886 new Delim (">>", typeof (TokenKwRSh)),
887 new Delim ("~", typeof (TokenKwTilde)),
888 new Delim ("!", typeof (TokenKwExclam)),
889 new Delim ("@", typeof (TokenKwAt)),
890 new Delim ("%", typeof (TokenKwMod)),
891 new Delim ("^", typeof (TokenKwXor)),
892 new Delim ("&", typeof (TokenKwAnd)),
893 new Delim ("*", typeof (TokenKwMul)),
894 new Delim ("(", typeof (TokenKwParOpen)),
895 new Delim (")", typeof (TokenKwParClose)),
896 new Delim ("-", typeof (TokenKwSub)),
897 new Delim ("+", typeof (TokenKwAdd)),
898 new Delim ("=", typeof (TokenKwAssign)),
899 new Delim ("{", typeof (TokenKwBrcOpen)),
900 new Delim ("}", typeof (TokenKwBrcClose)),
901 new Delim ("[", typeof (TokenKwBrkOpen)),
902 new Delim ("]", typeof (TokenKwBrkClose)),
903 new Delim (";", typeof (TokenKwSemi)),
904 new Delim (":", typeof (TokenKwColon)),
905 new Delim ("<", typeof (TokenKwCmpLT)),
906 new Delim (">", typeof (TokenKwCmpGT)),
907 new Delim (",", typeof (TokenKwComma)),
908 new Delim (".", typeof (TokenKwDot)),
909 new Delim ("?", typeof (TokenKwQMark)),
910 new Delim ("/", typeof (TokenKwDiv)),
911 new Delim ("|", typeof (TokenKwOr)),
912 new Delim ("#", typeof (TokenKwHash))
913 };
914
915 /**
916 * @brief keyword tables
917 * The keyword tables translate a keyword string
918 * to the corresponding token constructor.
919 */
920 private static Dictionary<string, System.Reflection.ConstructorInfo> keywords = BuildKeywords ();
921 private static Dictionary<string, System.Reflection.ConstructorInfo> arrayKeywords = BuildArrayKeywords ();
922 private static Dictionary<string, System.Reflection.ConstructorInfo> advFlowCtlKeywords = BuildAdvFlowCtlKeywords ();
923 private static Dictionary<string, System.Reflection.ConstructorInfo> tryCatchKeywords = BuildTryCatchKeywords ();
924 private static Dictionary<string, System.Reflection.ConstructorInfo> objectsKeywords = BuildObjectsKeywords ();
925 private static Dictionary<string, System.Reflection.ConstructorInfo> charsKeywords = BuildCharsKeywords ();
926
927 private static Dictionary<string, System.Reflection.ConstructorInfo> BuildKeywords ()
928 {
929 Dictionary<string, System.Reflection.ConstructorInfo> kws = new Dictionary<string, System.Reflection.ConstructorInfo> ();
930
931 kws.Add ("default", GetTokenCtor (typeof (TokenKwDefault)));
932 kws.Add ("do", GetTokenCtor (typeof (TokenKwDo)));
933 kws.Add ("else", GetTokenCtor (typeof (TokenKwElse)));
934 kws.Add ("float", GetTokenCtor (typeof (TokenTypeFloat)));
935 kws.Add ("for", GetTokenCtor (typeof (TokenKwFor)));
936 kws.Add ("if", GetTokenCtor (typeof (TokenKwIf)));
937 kws.Add ("integer", GetTokenCtor (typeof (TokenTypeInt)));
938 kws.Add ("list", GetTokenCtor (typeof (TokenTypeList)));
939 kws.Add ("jump", GetTokenCtor (typeof (TokenKwJump)));
940 kws.Add ("key", GetTokenCtor (typeof (TokenTypeKey)));
941 kws.Add ("return", GetTokenCtor (typeof (TokenKwRet)));
942 kws.Add ("rotation", GetTokenCtor (typeof (TokenTypeRot)));
943 kws.Add ("state", GetTokenCtor (typeof (TokenKwState)));
944 kws.Add ("string", GetTokenCtor (typeof (TokenTypeStr)));
945 kws.Add ("vector", GetTokenCtor (typeof (TokenTypeVec)));
946 kws.Add ("while", GetTokenCtor (typeof (TokenKwWhile)));
947
948 return kws;
949 }
950
951 private static Dictionary<string, System.Reflection.ConstructorInfo> BuildArrayKeywords ()
952 {
953 Dictionary<string, System.Reflection.ConstructorInfo> kws = new Dictionary<string, System.Reflection.ConstructorInfo> ();
954
955 kws.Add ("array", GetTokenCtor (typeof (TokenTypeArray)));
956 kws.Add ("foreach", GetTokenCtor (typeof (TokenKwForEach)));
957 kws.Add ("in", GetTokenCtor (typeof (TokenKwIn)));
958 kws.Add ("is", GetTokenCtor (typeof (TokenKwIs)));
959 kws.Add ("object", GetTokenCtor (typeof (TokenTypeObject)));
960 kws.Add ("undef", GetTokenCtor (typeof (TokenKwUndef)));
961
962 return kws;
963 }
964
965 private static Dictionary<string, System.Reflection.ConstructorInfo> BuildAdvFlowCtlKeywords ()
966 {
967 Dictionary<string, System.Reflection.ConstructorInfo> kws = new Dictionary<string, System.Reflection.ConstructorInfo> ();
968
969 kws.Add ("break", GetTokenCtor (typeof (TokenKwBreak)));
970 kws.Add ("case", GetTokenCtor (typeof (TokenKwCase)));
971 kws.Add ("constant", GetTokenCtor (typeof (TokenKwConst)));
972 kws.Add ("continue", GetTokenCtor (typeof (TokenKwCont)));
973 kws.Add ("switch", GetTokenCtor (typeof (TokenKwSwitch)));
974
975 return kws;
976 }
977
978 private static Dictionary<string, System.Reflection.ConstructorInfo> BuildTryCatchKeywords ()
979 {
980 Dictionary<string, System.Reflection.ConstructorInfo> kws = new Dictionary<string, System.Reflection.ConstructorInfo> ();
981
982 kws.Add ("catch", GetTokenCtor (typeof (TokenKwCatch)));
983 kws.Add ("exception", GetTokenCtor (typeof (TokenTypeExc)));
984 kws.Add ("finally", GetTokenCtor (typeof (TokenKwFinally)));
985 kws.Add ("throw", GetTokenCtor (typeof (TokenKwThrow)));
986 kws.Add ("try", GetTokenCtor (typeof (TokenKwTry)));
987
988 return kws;
989 }
990
991 private static Dictionary<string, System.Reflection.ConstructorInfo> BuildObjectsKeywords ()
992 {
993 Dictionary<string, System.Reflection.ConstructorInfo> kws = new Dictionary<string, System.Reflection.ConstructorInfo> ();
994
995 kws.Add ("abstract", GetTokenCtor (typeof (TokenKwAbstract)));
996 kws.Add ("base", GetTokenCtor (typeof (TokenKwBase)));
997 kws.Add ("class", GetTokenCtor (typeof (TokenKwClass)));
998 kws.Add ("constructor", GetTokenCtor (typeof (TokenKwConstructor)));
999 kws.Add ("delegate", GetTokenCtor (typeof (TokenKwDelegate)));
1000 kws.Add ("destructor", GetTokenCtor (typeof (TokenKwDestructor)));
1001 kws.Add ("final", GetTokenCtor (typeof (TokenKwFinal)));
1002 kws.Add ("get", GetTokenCtor (typeof (TokenKwGet)));
1003 kws.Add ("interface", GetTokenCtor (typeof (TokenKwInterface)));
1004 kws.Add ("new", GetTokenCtor (typeof (TokenKwNew)));
1005 kws.Add ("override", GetTokenCtor (typeof (TokenKwOverride)));
1006 kws.Add ("partial", GetTokenCtor (typeof (TokenKwPartial)));
1007 kws.Add ("private", GetTokenCtor (typeof (TokenKwPrivate)));
1008 kws.Add ("protected", GetTokenCtor (typeof (TokenKwProtected)));
1009 kws.Add ("public", GetTokenCtor (typeof (TokenKwPublic)));
1010 kws.Add ("set", GetTokenCtor (typeof (TokenKwSet)));
1011 kws.Add ("static", GetTokenCtor (typeof (TokenKwStatic)));
1012 kws.Add ("this", GetTokenCtor (typeof (TokenKwThis)));
1013 kws.Add ("typedef", GetTokenCtor (typeof (TokenKwTypedef)));
1014 kws.Add ("virtual", GetTokenCtor (typeof (TokenKwVirtual)));
1015
1016 return kws;
1017 }
1018
1019 private static Dictionary<string, System.Reflection.ConstructorInfo> BuildCharsKeywords ()
1020 {
1021 Dictionary<string, System.Reflection.ConstructorInfo> kws = new Dictionary<string, System.Reflection.ConstructorInfo> ();
1022
1023 kws.Add ("char", GetTokenCtor (typeof (TokenTypeChar)));
1024
1025 return kws;
1026 }
1027
1028 /**
1029 * @brief Create a URL from a base URL and a relative string
1030 * @param oldurl = base url string
1031 * @param relurl = relative url
1032 * @returns new url string
1033 */
1034 private static string CreateURL (string oldurl, string relurl)
1035 {
1036 if (relurl.IndexOf ("://") >= 0) return relurl;
1037 StringBuilder newurl = new StringBuilder (oldurl.Length + relurl.Length);
1038 if (relurl[0] == '/') {
1039 // file:///oldname + /newname => file:///newname
1040 // http://webserver.com/oldname + /newname => http://webserver.com/newname
1041 int i = oldurl.IndexOf ("://") + 3;
1042 int j = oldurl.IndexOf ('/', i);
1043 if (j < 0) j = oldurl.Length;
1044 newurl.Append (oldurl.Substring (0, j));
1045 newurl.Append (relurl);
1046 } else {
1047 // file:///oldname + newname => file:///newname
1048 // http://webserver.com/oldname + newname => http://webserver.com/newname
1049 int i = oldurl.LastIndexOf ('/') + 1;
1050 newurl.Append (oldurl.Substring (0, i));
1051 newurl.Append (relurl);
1052 }
1053 return newurl.ToString ();
1054 }
1055
1056 /**
1057 * @brief Read source file from a webserver somewhere out there.
1058 */
1059 private const int MAX_INCLUDE_SIZE = 100000;
1060 private Dictionary<string, string> scriptIncludes = new Dictionary<string, string> ();
1061 private string ReadSourceFromURL (string url)
1062 {
1063 Stream stream = null;
1064 StreamReader reader = null;
1065
1066 try {
1067
1068 /*
1069 * Get stream to read from webserver.
1070 */
1071 stream = MMRWebRequest.MakeRequest ("GET", url, null, 0);
1072 reader = new StreamReader (stream);
1073
1074 /*
1075 * Read file from stream.
1076 */
1077 char[] buf = new char[4000];
1078 int len = 0;
1079 int total = 0;
1080 List<char[]> fullBuffs = new List<char[]> ();
1081 string signature = null;
1082
1083 while (true) {
1084
1085 /*
1086 * Read a big chunk of characters.
1087 */
1088 len = reader.ReadBlock (buf, 0, buf.Length);
1089
1090 /*
1091 * Signature is first line of the first chunk read and must be contained therein.
1092 * If an include file with the same signature has already been seen by this script,
1093 * this include file is ignored.
1094 */
1095 if (signature == null) {
1096 signature = new String (buf, 0, len);
1097 int siglen = signature.IndexOf ('\n');
1098 if (siglen <= 0) {
1099 throw new Exception ("missing signature in first " + len + " characters: " + url);
1100 }
1101 signature = signature.Substring (0, siglen);
1102 if (scriptIncludes.ContainsKey (signature)) return null;
1103 scriptIncludes.Add (signature, "");
1104 }
1105
1106 /*
1107 * Signature is ok, stash full blocks away and keep reading.
1108 * If short read, means we have hit the end of the stream.
1109 */
1110 total += len;
1111 if (total > MAX_INCLUDE_SIZE) {
1112 throw new Exception ("script include exceeds maximum " + MAX_INCLUDE_SIZE + ": " + url);
1113 }
1114 if (len < buf.Length) break;
1115 fullBuffs.Add (buf);
1116 buf = new char[4000];
1117 }
1118
1119 /*
1120 * Return the whole thing as one string.
1121 */
1122 StringBuilder sb = new StringBuilder (total + url.Length + 20);
1123 sb.Append ("# 1 \"");
1124 sb.Append (url);
1125 sb.Append ("\"\n");
1126 foreach (char[] fullBuff in fullBuffs) {
1127 sb.Append (fullBuff);
1128 }
1129 sb.Append (buf, 0, len);
1130 return sb.ToString ();
1131 } finally {
1132 if (reader != null) reader.Close ();
1133 else if (stream != null) stream.Close ();
1134 }
1135 }
1136 }
1137
1138 /**
1139 * @brief All output token types in addition to TokenBegin.
1140 * They are all sub-types of Token.
1141 */
1142
1143 public class TokenChar : Token {
1144 public char val;
1145 public TokenChar (TokenErrorMessage emsg, string file, int line, int posn, char val) : base (emsg, file, line, posn)
1146 {
1147 this.val = val;
1148 }
1149 public TokenChar (Token original, char val) : base (original)
1150 {
1151 this.val = val;
1152 }
1153 public override string ToString ()
1154 {
1155 switch (val) {
1156 case '\'': return "'\\''";
1157 case '\\': return "'\\\\'";
1158 case '\n': return "'\\n'";
1159 case '\t': return "'\\t'";
1160 default: return "'" + val + "'";
1161 }
1162 }
1163 }
1164
1165 public class TokenFloat : Token {
1166 public double val;
1167 public TokenFloat (TokenErrorMessage emsg, string file, int line, int posn, double val) : base (emsg, file, line, posn)
1168 {
1169 this.val = val;
1170 }
1171 public override string ToString ()
1172 {
1173 return val.ToString ();
1174 }
1175 }
1176
1177 public class TokenInt : Token {
1178 public int val;
1179 public TokenInt (TokenErrorMessage emsg, string file, int line, int posn, int val) : base (emsg, file, line, posn)
1180 {
1181 this.val = val;
1182 }
1183 public TokenInt (Token original, int val) : base (original)
1184 {
1185 this.val = val;
1186 }
1187 public override string ToString ()
1188 {
1189 return val.ToString ();
1190 }
1191 }
1192
1193 public class TokenName : Token {
1194 public string val;
1195 public TokenName (TokenErrorMessage emsg, string file, int line, int posn, string val) : base (emsg, file, line, posn)
1196 {
1197 this.val = val;
1198 }
1199 public TokenName (Token original, string val) : base (original)
1200 {
1201 this.val = val;
1202 }
1203 public override string ToString ()
1204 {
1205 return this.val;
1206 }
1207 }
1208
1209 public class TokenStr : Token {
1210 public string val;
1211 public TokenStr (TokenErrorMessage emsg, string file, int line, int posn, string val) : base (emsg, file, line, posn)
1212 {
1213 this.val = val;
1214 }
1215 public override string ToString ()
1216 {
1217 if ((val.IndexOf ('"') < 0) &&
1218 (val.IndexOf ('\\') < 0) &&
1219 (val.IndexOf ('\n') < 0) &&
1220 (val.IndexOf ('\t') < 0)) return "\"" + val + "\"";
1221
1222 int len = val.Length;
1223 StringBuilder sb = new StringBuilder (len * 2 + 2);
1224 sb.Append ('"');
1225 for (int i = 0; i < len; i ++) {
1226 char c = val[i];
1227 switch (c) {
1228 case '"': {
1229 sb.Append ('\\');
1230 sb.Append ('"');
1231 break;
1232 }
1233 case '\\': {
1234 sb.Append ('\\');
1235 sb.Append ('\\');
1236 break;
1237 }
1238 case '\n': {
1239 sb.Append ('\\');
1240 sb.Append ('n');
1241 break;
1242 }
1243 case '\t': {
1244 sb.Append ('\\');
1245 sb.Append ('t');
1246 break;
1247 }
1248 default: {
1249 sb.Append (c);
1250 break;
1251 }
1252 }
1253 }
1254 return sb.ToString ();
1255 }
1256 }
1257
1258 /*
1259 * This one marks the end-of-file.
1260 */
1261 public class TokenEnd : Token { public TokenEnd (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { } }
1262
1263 /*
1264 * Various keywords and delimeters.
1265 */
1266 public delegate object TokenRValConstBinOpDelegate (object left, object right);
1267 public delegate object TokenRValConstUnOpDelegate (object right);
1268
1269 public class TokenKw : Token {
1270 public TokenRValConstBinOpDelegate binOpConst;
1271 public TokenRValConstUnOpDelegate unOpConst;
1272 public bool sdtClassOp;
1273 public TokenKw (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { }
1274 public TokenKw (Token original) : base (original) { }
1275 }
1276
1277 public class TokenKwDotDotDot : TokenKw { public TokenKwDotDotDot (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public TokenKwDotDotDot (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public override string ToString () { return "..."; } }
1278 public class TokenKwAndAndAnd : TokenKw { public TokenKwAndAndAnd (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public TokenKwAndAndAnd (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public override string ToString () { return "&&&"; } }
1279 public class TokenKwOrOrOr : TokenKw { public TokenKwOrOrOr (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public TokenKwOrOrOr (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public override string ToString () { return "|||"; } }
1280 public class TokenKwAsnLSh : TokenKw { public TokenKwAsnLSh (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = true; } public TokenKwAsnLSh (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = true; } public override string ToString () { return "<<="; } }
1281 public class TokenKwAsnRSh : TokenKw { public TokenKwAsnRSh (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = true; } public TokenKwAsnRSh (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = true; } public override string ToString () { return ">>="; } }
1282 public class TokenKwCmpLE : TokenKw { public TokenKwCmpLE (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = true; } public TokenKwCmpLE (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = true; } public override string ToString () { return "<="; } }
1283 public class TokenKwCmpGE : TokenKw { public TokenKwCmpGE (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = true; } public TokenKwCmpGE (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = true; } public override string ToString () { return ">="; } }
1284 public class TokenKwCmpEQ : TokenKw { public TokenKwCmpEQ (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = true; } public TokenKwCmpEQ (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = true; } public override string ToString () { return "=="; } }
1285 public class TokenKwCmpNE : TokenKw { public TokenKwCmpNE (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = true; } public TokenKwCmpNE (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = true; } public override string ToString () { return "!="; } }
1286 public class TokenKwIncr : TokenKw { public TokenKwIncr (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public TokenKwIncr (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public override string ToString () { return "++"; } }
1287 public class TokenKwDecr : TokenKw { public TokenKwDecr (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public TokenKwDecr (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public override string ToString () { return "--"; } }
1288 public class TokenKwAndAnd : TokenKw { public TokenKwAndAnd (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = true; } public TokenKwAndAnd (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = true; } public override string ToString () { return "&&"; } }
1289 public class TokenKwOrOr : TokenKw { public TokenKwOrOr (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = true; } public TokenKwOrOr (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = true; } public override string ToString () { return "||"; } }
1290 public class TokenKwAsnAdd : TokenKw { public TokenKwAsnAdd (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = true; } public TokenKwAsnAdd (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = true; } public override string ToString () { return "+="; } }
1291 public class TokenKwAsnAnd : TokenKw { public TokenKwAsnAnd (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = true; } public TokenKwAsnAnd (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = true; } public override string ToString () { return "&="; } }
1292 public class TokenKwAsnSub : TokenKw { public TokenKwAsnSub (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = true; } public TokenKwAsnSub (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = true; } public override string ToString () { return "-="; } }
1293 public class TokenKwAsnMul : TokenKw { public TokenKwAsnMul (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = true; } public TokenKwAsnMul (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = true; } public override string ToString () { return "*="; } }
1294 public class TokenKwAsnDiv : TokenKw { public TokenKwAsnDiv (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = true; } public TokenKwAsnDiv (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = true; } public override string ToString () { return "/="; } }
1295 public class TokenKwAsnMod : TokenKw { public TokenKwAsnMod (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = true; } public TokenKwAsnMod (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = true; } public override string ToString () { return "%="; } }
1296 public class TokenKwAsnOr : TokenKw { public TokenKwAsnOr (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = true; } public TokenKwAsnOr (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = true; } public override string ToString () { return "|="; } }
1297 public class TokenKwAsnXor : TokenKw { public TokenKwAsnXor (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = true; } public TokenKwAsnXor (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = true; } public override string ToString () { return "^="; } }
1298 public class TokenKwLSh : TokenKw { public TokenKwLSh (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.LSh; unOpConst = TokenRValConstOps.Null; sdtClassOp = true; } public TokenKwLSh (Token original) : base (original) { binOpConst = TokenRValConstOps.LSh; unOpConst = TokenRValConstOps.Null; sdtClassOp = true; } public override string ToString () { return "<<"; } }
1299 public class TokenKwRSh : TokenKw { public TokenKwRSh (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.RSh; unOpConst = TokenRValConstOps.Null; sdtClassOp = true; } public TokenKwRSh (Token original) : base (original) { binOpConst = TokenRValConstOps.RSh; unOpConst = TokenRValConstOps.Null; sdtClassOp = true; } public override string ToString () { return ">>"; } }
1300 public class TokenKwTilde : TokenKw { public TokenKwTilde (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Not; sdtClassOp = true; } public TokenKwTilde (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Not; sdtClassOp = true; } public override string ToString () { return "~"; } }
1301 public class TokenKwExclam : TokenKw { public TokenKwExclam (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = true; } public TokenKwExclam (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = true; } public override string ToString () { return "!"; } }
1302 public class TokenKwAt : TokenKw { public TokenKwAt (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public TokenKwAt (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public override string ToString () { return "@"; } }
1303 public class TokenKwMod : TokenKw { public TokenKwMod (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Mod; unOpConst = TokenRValConstOps.Null; sdtClassOp = true; } public TokenKwMod (Token original) : base (original) { binOpConst = TokenRValConstOps.Mod; unOpConst = TokenRValConstOps.Null; sdtClassOp = true; } public override string ToString () { return "%"; } }
1304 public class TokenKwXor : TokenKw { public TokenKwXor (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Xor; unOpConst = TokenRValConstOps.Null; sdtClassOp = true; } public TokenKwXor (Token original) : base (original) { binOpConst = TokenRValConstOps.Xor; unOpConst = TokenRValConstOps.Null; sdtClassOp = true; } public override string ToString () { return "^"; } }
1305 public class TokenKwAnd : TokenKw { public TokenKwAnd (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.And; unOpConst = TokenRValConstOps.Null; sdtClassOp = true; } public TokenKwAnd (Token original) : base (original) { binOpConst = TokenRValConstOps.And; unOpConst = TokenRValConstOps.Null; sdtClassOp = true; } public override string ToString () { return "&"; } }
1306 public class TokenKwMul : TokenKw { public TokenKwMul (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Mul; unOpConst = TokenRValConstOps.Null; sdtClassOp = true; } public TokenKwMul (Token original) : base (original) { binOpConst = TokenRValConstOps.Mul; unOpConst = TokenRValConstOps.Null; sdtClassOp = true; } public override string ToString () { return "*"; } }
1307 public class TokenKwParOpen : TokenKw { public TokenKwParOpen (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public TokenKwParOpen (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public override string ToString () { return "("; } }
1308 public class TokenKwParClose : TokenKw { public TokenKwParClose (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public TokenKwParClose (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public override string ToString () { return ")"; } }
1309 public class TokenKwSub : TokenKw { public TokenKwSub (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Sub; unOpConst = TokenRValConstOps.Neg; sdtClassOp = true; } public TokenKwSub (Token original) : base (original) { binOpConst = TokenRValConstOps.Sub; unOpConst = TokenRValConstOps.Neg; sdtClassOp = true; } public override string ToString () { return "-"; } }
1310 public class TokenKwAdd : TokenKw { public TokenKwAdd (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Add; unOpConst = TokenRValConstOps.Null; sdtClassOp = true; } public TokenKwAdd (Token original) : base (original) { binOpConst = TokenRValConstOps.Add; unOpConst = TokenRValConstOps.Null; sdtClassOp = true; } public override string ToString () { return "+"; } }
1311 public class TokenKwAssign : TokenKw { public TokenKwAssign (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public TokenKwAssign (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public override string ToString () { return "="; } }
1312 public class TokenKwBrcOpen : TokenKw { public TokenKwBrcOpen (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public TokenKwBrcOpen (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public override string ToString () { return "{"; } }
1313 public class TokenKwBrcClose : TokenKw { public TokenKwBrcClose (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public TokenKwBrcClose (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public override string ToString () { return "}"; } }
1314 public class TokenKwBrkOpen : TokenKw { public TokenKwBrkOpen (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public TokenKwBrkOpen (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public override string ToString () { return "["; } }
1315 public class TokenKwBrkClose : TokenKw { public TokenKwBrkClose (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public TokenKwBrkClose (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public override string ToString () { return "]"; } }
1316 public class TokenKwSemi : TokenKw { public TokenKwSemi (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public TokenKwSemi (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public override string ToString () { return ";"; } }
1317 public class TokenKwColon : TokenKw { public TokenKwColon (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public TokenKwColon (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public override string ToString () { return ":"; } }
1318 public class TokenKwCmpLT : TokenKw { public TokenKwCmpLT (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = true; } public TokenKwCmpLT (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = true; } public override string ToString () { return "<"; } }
1319 public class TokenKwCmpGT : TokenKw { public TokenKwCmpGT (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = true; } public TokenKwCmpGT (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = true; } public override string ToString () { return ">"; } }
1320 public class TokenKwComma : TokenKw { public TokenKwComma (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public TokenKwComma (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public override string ToString () { return ","; } }
1321 public class TokenKwDot : TokenKw { public TokenKwDot (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public TokenKwDot (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public override string ToString () { return "."; } }
1322 public class TokenKwQMark : TokenKw { public TokenKwQMark (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public TokenKwQMark (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public override string ToString () { return "?"; } }
1323 public class TokenKwDiv : TokenKw { public TokenKwDiv (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Div; unOpConst = TokenRValConstOps.Null; sdtClassOp = true; } public TokenKwDiv (Token original) : base (original) { binOpConst = TokenRValConstOps.Div; unOpConst = TokenRValConstOps.Null; sdtClassOp = true; } public override string ToString () { return "/"; } }
1324 public class TokenKwOr : TokenKw { public TokenKwOr (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Or; unOpConst = TokenRValConstOps.Null; sdtClassOp = true; } public TokenKwOr (Token original) : base (original) { binOpConst = TokenRValConstOps.Or; unOpConst = TokenRValConstOps.Null; sdtClassOp = true; } public override string ToString () { return "|"; } }
1325 public class TokenKwHash : TokenKw { public TokenKwHash (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public TokenKwHash (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public override string ToString () { return "#"; } }
1326
1327 public class TokenKwAbstract : TokenKw { public TokenKwAbstract (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public TokenKwAbstract (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public override string ToString () { return "abstract"; } }
1328 public class TokenKwBase : TokenKw { public TokenKwBase (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public TokenKwBase (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public override string ToString () { return "base"; } }
1329 public class TokenKwBreak : TokenKw { public TokenKwBreak (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public TokenKwBreak (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public override string ToString () { return "break"; } }
1330 public class TokenKwCase : TokenKw { public TokenKwCase (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public TokenKwCase (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public override string ToString () { return "case"; } }
1331 public class TokenKwCatch : TokenKw { public TokenKwCatch (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public TokenKwCatch (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public override string ToString () { return "catch"; } }
1332 public class TokenKwClass : TokenKw { public TokenKwClass (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public TokenKwClass (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public override string ToString () { return "class"; } }
1333 public class TokenKwConst : TokenKw { public TokenKwConst (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public TokenKwConst (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public override string ToString () { return "constant"; } }
1334 public class TokenKwConstructor : TokenKw { public TokenKwConstructor (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public TokenKwConstructor (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public override string ToString () { return "constructor"; } }
1335 public class TokenKwCont : TokenKw { public TokenKwCont (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public TokenKwCont (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public override string ToString () { return "continue"; } }
1336 public class TokenKwDelegate : TokenKw { public TokenKwDelegate (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public TokenKwDelegate (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public override string ToString () { return "delegate"; } }
1337 public class TokenKwDefault : TokenKw { public TokenKwDefault (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public TokenKwDefault (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public override string ToString () { return "default"; } }
1338 public class TokenKwDestructor : TokenKw { public TokenKwDestructor (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public TokenKwDestructor (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public override string ToString () { return "destructor"; } }
1339 public class TokenKwDo : TokenKw { public TokenKwDo (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public TokenKwDo (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public override string ToString () { return "do"; } }
1340 public class TokenKwElse : TokenKw { public TokenKwElse (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public TokenKwElse (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public override string ToString () { return "else"; } }
1341 public class TokenKwFinal : TokenKw { public TokenKwFinal (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public TokenKwFinal (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public override string ToString () { return "final"; } }
1342 public class TokenKwFinally : TokenKw { public TokenKwFinally (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public TokenKwFinally (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public override string ToString () { return "finally"; } }
1343 public class TokenKwFor : TokenKw { public TokenKwFor (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public TokenKwFor (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public override string ToString () { return "for"; } }
1344 public class TokenKwForEach : TokenKw { public TokenKwForEach (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public TokenKwForEach (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public override string ToString () { return "foreach"; } }
1345 public class TokenKwGet : TokenKw { public TokenKwGet (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public TokenKwGet (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public override string ToString () { return "get"; } }
1346 public class TokenKwIf : TokenKw { public TokenKwIf (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public TokenKwIf (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public override string ToString () { return "if"; } }
1347 public class TokenKwIn : TokenKw { public TokenKwIn (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public TokenKwIn (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public override string ToString () { return "in"; } }
1348 public class TokenKwInterface : TokenKw { public TokenKwInterface (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public TokenKwInterface (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public override string ToString () { return "interface"; } }
1349 public class TokenKwIs : TokenKw { public TokenKwIs (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public TokenKwIs (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public override string ToString () { return "is"; } }
1350 public class TokenKwJump : TokenKw { public TokenKwJump (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public TokenKwJump (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public override string ToString () { return "jump"; } }
1351 public class TokenKwNew : TokenKw { public TokenKwNew (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public TokenKwNew (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public override string ToString () { return "new"; } }
1352 public class TokenKwOverride : TokenKw { public TokenKwOverride (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public TokenKwOverride (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public override string ToString () { return "override"; } }
1353 public class TokenKwPartial : TokenKw { public TokenKwPartial (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public TokenKwPartial (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public override string ToString () { return "partial"; } }
1354 public class TokenKwPrivate : TokenKw { public TokenKwPrivate (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public TokenKwPrivate (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public override string ToString () { return "private"; } }
1355 public class TokenKwProtected : TokenKw { public TokenKwProtected (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public TokenKwProtected (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public override string ToString () { return "protected"; } }
1356 public class TokenKwPublic : TokenKw { public TokenKwPublic (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public TokenKwPublic (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public override string ToString () { return "public"; } }
1357 public class TokenKwRet : TokenKw { public TokenKwRet (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public TokenKwRet (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public override string ToString () { return "return"; } }
1358 public class TokenKwSet : TokenKw { public TokenKwSet (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public TokenKwSet (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public override string ToString () { return "set"; } }
1359 public class TokenKwState : TokenKw { public TokenKwState (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public TokenKwState (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public override string ToString () { return "state"; } }
1360 public class TokenKwStatic : TokenKw { public TokenKwStatic (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public TokenKwStatic (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public override string ToString () { return "static"; } }
1361 public class TokenKwSwitch : TokenKw { public TokenKwSwitch (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public TokenKwSwitch (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public override string ToString () { return "switch"; } }
1362 public class TokenKwThis : TokenKw { public TokenKwThis (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public TokenKwThis (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public override string ToString () { return "this"; } }
1363 public class TokenKwThrow : TokenKw { public TokenKwThrow (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public TokenKwThrow (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public override string ToString () { return "throw"; } }
1364 public class TokenKwTry : TokenKw { public TokenKwTry (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public TokenKwTry (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public override string ToString () { return "try"; } }
1365 public class TokenKwTypedef : TokenKw { public TokenKwTypedef (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public TokenKwTypedef (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public override string ToString () { return "typedef"; } }
1366 public class TokenKwUndef : TokenKw { public TokenKwUndef (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public TokenKwUndef (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public override string ToString () { return "undef"; } }
1367 public class TokenKwVirtual : TokenKw { public TokenKwVirtual (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public TokenKwVirtual (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public override string ToString () { return "virtual"; } }
1368 public class TokenKwWhile : TokenKw { public TokenKwWhile (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public TokenKwWhile (Token original) : base (original) { binOpConst = TokenRValConstOps.Null; unOpConst = TokenRValConstOps.Null; sdtClassOp = false; } public override string ToString () { return "while"; } }
1369
1370 /**
1371 * @brief These static functions attempt to perform arithmetic on two constant
1372 * operands to generate the resultant constant.
1373 * Likewise for unary operators.
1374 *
1375 * @param left = left-hand value
1376 * @param right = right-hand value
1377 * @returns null: not able to perform computation
1378 * else: resultant value object
1379 *
1380 * Note: it is ok for these to throw any exception (such as overflow or div-by-zero),
1381 * and it will be treated as the 'not able to perform computation' case.
1382 */
1383 public class TokenRValConstOps {
1384 public static object Null (object left, object right) { return null; }
1385 public static object Div (object left, object right) { if ((left is int) && (right is int)) { return (int)left / (int)right; } if ((left is int) && (right is double)) { return (int)left / (double)right; } if ((left is double) && (right is int)) { return (double)left / (int)right; } if ((left is double) && (right is double)) { return (double)left / (double)right; } return null; }
1386 public static object Mod (object left, object right) { if ((left is int) && (right is int)) { return (int)left % (int)right; } if ((left is int) && (right is double)) { return (int)left % (double)right; } if ((left is double) && (right is int)) { return (double)left % (int)right; } if ((left is double) && (right is double)) { return (double)left % (double)right; } return null; }
1387 public static object Mul (object left, object right) { if ((left is int) && (right is int)) { return (int)left * (int)right; } if ((left is int) && (right is double)) { return (int)left * (double)right; } if ((left is double) && (right is int)) { return (double)left * (int)right; } if ((left is double) && (right is double)) { return (double)left * (double)right; } return null; }
1388 public static object And (object left, object right) { if ((left is int) && (right is int)) { return (int)left & (int)right; } if ((left is int) && (right is double)) { return (int)left & (int)(double)right; } if ((left is double) && (right is int)) { return (int)(double)left & (int)right; } if ((left is double) && (right is double)) { return (int)(double)left & (int)(double)right; } return null; }
1389 public static object LSh (object left, object right) { if ((left is int) && (right is int)) { return (int)left << (int)right; } if ((left is int) && (right is double)) { return (int)left << (int)(double)right; } if ((left is double) && (right is int)) { return (int)(double)left << (int)right; } if ((left is double) && (right is double)) { return (int)(double)left << (int)(double)right; } return null; }
1390 public static object Or (object left, object right) { if ((left is int) && (right is int)) { return (int)left | (int)right; } if ((left is int) && (right is double)) { return (int)left | (int)(double)right; } if ((left is double) && (right is int)) { return (int)(double)left | (int)right; } if ((left is double) && (right is double)) { return (int)(double)left | (int)(double)right; } return null; }
1391 public static object RSh (object left, object right) { if ((left is int) && (right is int)) { return (int)left >> (int)right; } if ((left is int) && (right is double)) { return (int)left >> (int)(double)right; } if ((left is double) && (right is int)) { return (int)(double)left >> (int)right; } if ((left is double) && (right is double)) { return (int)(double)left >> (int)(double)right; } return null; }
1392 public static object Xor (object left, object right) { if ((left is int) && (right is int)) { return (int)left ^ (int)right; } if ((left is int) && (right is double)) { return (int)left ^ (int)(double)right; } if ((left is double) && (right is int)) { return (int)(double)left ^ (int)right; } if ((left is double) && (right is double)) { return (int)(double)left ^ (int)(double)right; } return null; }
1393 public static object Add (object left, object right) { if ((left is char) && (right is int)) { return (char)((char)left + (int)right); } if ((left is double) && (right is double)) { return (double)left + (double)right; } if ((left is double) && (right is int)) { return (double)left + (int)right; } if ((left is double) && (right is string)) { return TypeCast.FloatToString((double)left) + (string)right; } if ((left is int) && (right is double)) { return (int)left + (double)right; } if ((left is int) && (right is int)) { return (int)left + (int)right; } if ((left is int) && (right is string)) { return TypeCast.IntegerToString((int)left) + (string)right; } if ((left is string) && (right is char)) { return (string)left + (char)right; } if ((left is string) && (right is double)) { return (string)left + TypeCast.FloatToString((double)right); } if ((left is string) && (right is int)) { return (string)left + TypeCast.IntegerToString ((int)right); } if ((left is string) && (right is string)) { return (string)left + (string)right; } return null; }
1394 public static object Sub (object left, object right) { if ((left is char) && (right is int)) { return (char)((char)left - (int)right); } if ((left is int) && (right is int)) { return (int)left - (int)right; } if ((left is int) && (right is double)) { return (int)left - (double)right; } if ((left is double) && (right is int)) { return (double)left - (int)right; } if ((left is double) && (right is double)) { return (double)left - (double)right; } return null; }
1395 public static object Null (object right) { return null; }
1396 public static object Neg (object right) { if (right is int) { return - (int)right; } if (right is double) { return - (double)right; } return null; }
1397 public static object Not (object right) { if (right is int) { return ~ (int)right; } return null; }
1398 }
1399
1400 /*
1401 * Various datatypes.
1402 */
1403 public abstract class TokenType : Token {
1404
1405 public TokenType (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { }
1406 public TokenType (Token original) : base (original) { }
1407
1408 public static TokenType FromSysType (Token original, System.Type typ)
1409 {
1410 if (typ == typeof (LSL_List)) return new TokenTypeList (original);
1411 if (typ == typeof (LSL_Rotation)) return new TokenTypeRot (original);
1412 if (typ == typeof (void)) return new TokenTypeVoid (original);
1413 if (typ == typeof (LSL_Vector)) return new TokenTypeVec (original);
1414 if (typ == typeof (float)) return new TokenTypeFloat (original);
1415 if (typ == typeof (int)) return new TokenTypeInt (original);
1416 if (typ == typeof (string)) return new TokenTypeStr (original);
1417 if (typ == typeof (double)) return new TokenTypeFloat (original);
1418 if (typ == typeof (bool)) return new TokenTypeBool (original);
1419 if (typ == typeof (object)) return new TokenTypeObject (original);
1420 if (typ == typeof (XMR_Array)) return new TokenTypeArray (original);
1421 if (typ == typeof (LSL_Integer)) return new TokenTypeLSLInt (original);
1422 if (typ == typeof (LSL_Float)) return new TokenTypeLSLFloat (original);
1423 if (typ == typeof (LSL_String)) return new TokenTypeLSLString (original);
1424 if (typ == typeof (char)) return new TokenTypeChar (original);
1425 if (typ == typeof (Exception)) return new TokenTypeExc (original);
1426
1427 throw new Exception ("unknown script type " + typ.ToString ());
1428 }
1429
1430 public static TokenType FromLSLType (Token original, string typ)
1431 {
1432 if (typ == "list") return new TokenTypeList (original);
1433 if (typ == "rotation") return new TokenTypeRot (original);
1434 if (typ == "vector") return new TokenTypeVec (original);
1435 if (typ == "float") return new TokenTypeFloat (original);
1436 if (typ == "integer") return new TokenTypeInt (original);
1437 if (typ == "key") return new TokenTypeKey (original);
1438 if (typ == "string") return new TokenTypeStr (original);
1439 if (typ == "object") return new TokenTypeObject (original);
1440 if (typ == "array") return new TokenTypeArray (original);
1441 if (typ == "bool") return new TokenTypeBool (original);
1442 if (typ == "void") return new TokenTypeVoid (original);
1443 if (typ == "char") return new TokenTypeChar (original);
1444 if (typ == "exception") return new TokenTypeExc (original);
1445
1446 throw new Exception ("unknown type " + typ);
1447 }
1448
1449 /**
1450 * @brief Estimate the number of bytes of memory taken by one of these
1451 * objects. For objects with widely varying size, return the
1452 * smallest it can be.
1453 */
1454 public static int StaticSize (System.Type typ)
1455 {
1456 if (typ == typeof (LSL_List)) return 96;
1457 if (typ == typeof (LSL_Rotation)) return 80;
1458 if (typ == typeof (void)) return 0;
1459 if (typ == typeof (LSL_Vector)) return 72;
1460 if (typ == typeof (float)) return 8;
1461 if (typ == typeof (int)) return 8;
1462 if (typ == typeof (string)) return 40;
1463 if (typ == typeof (double)) return 8;
1464 if (typ == typeof (bool)) return 8;
1465 if (typ == typeof (XMR_Array)) return 96;
1466 if (typ == typeof (object)) return 32;
1467 if (typ == typeof (char)) return 2;
1468
1469 if (typ == typeof (LSL_Integer)) return 32;
1470 if (typ == typeof (LSL_Float)) return 32;
1471 if (typ == typeof (LSL_String)) return 40;
1472
1473 throw new Exception ("unknown type " + typ.ToString ());
1474 }
1475
1476 /**
1477 * @brief Return the corresponding system type.
1478 */
1479 public abstract Type ToSysType ();
1480
1481 /**
1482 * @brief Return the equivalent LSL wrapping type.
1483 *
1484 * null: normal
1485 * else: LSL-style wrapping, ie, LSL_Integer, LSL_Float, LSL_String
1486 * ToSysType()=System.Int32; lslWrapping=LSL_Integer
1487 * ToSysType()=System.Float; lslWrapping=LSL_Float
1488 * ToSysType()=System.String; lslWrapping=LSL_String
1489 */
1490 public virtual Type ToLSLWrapType ()
1491 {
1492 return null;
1493 }
1494
1495 /**
1496 * @brief Assign slots in either the global variable arrays or the script-defined type instance arrays.
1497 * These only need to be implemented for script-visible types, ie, those that a script writer
1498 * can actually define a variable as.
1499 */
1500 public virtual void AssignVarSlot (TokenDeclVar declVar, XMRInstArSizes arSizes)
1501 {
1502 throw new Exception ("not implemented for " + ToString () + " (" + GetType () + ")");
1503 }
1504
1505 /**
1506 * @brief Get heap tracking type.
1507 * null indicates there is no heap tracker for the type.
1508 */
1509 public virtual Type ToHeapTrackerType ()
1510 {
1511 return null;
1512 }
1513 public virtual ConstructorInfo GetHeapTrackerCtor ()
1514 {
1515 throw new ApplicationException("no GetHeapTrackerCtor for " + this.GetType());
1516 }
1517 public virtual void CallHeapTrackerPopMeth (Token errorAt, ScriptMyILGen ilGen)
1518 {
1519 throw new ApplicationException("no CallHeapTrackerPopMeth for " + this.GetType());
1520 }
1521 public virtual void CallHeapTrackerPushMeth(Token errorAt, ScriptMyILGen ilGen)
1522 {
1523 throw new ApplicationException("no CallHeapTrackerPushMeth for " + this.GetType());
1524 }
1525 }
1526
1527 public class TokenTypeArray : TokenType {
1528 private static readonly FieldInfo iarArraysFieldInfo = typeof (XMRInstArrays).GetField ("iarArrays");
1529
1530 public TokenTypeArray (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { }
1531 public TokenTypeArray (Token original) : base (original) { }
1532 public override Type ToSysType () { return typeof (XMR_Array); }
1533 public override string ToString () { return "array"; }
1534 public override void AssignVarSlot (TokenDeclVar declVar, XMRInstArSizes arSizes)
1535 {
1536 declVar.vTableArray = iarArraysFieldInfo;
1537 declVar.vTableIndex = arSizes.iasArrays ++;
1538 }
1539 }
1540 public class TokenTypeBool : TokenType {
1541 public TokenTypeBool (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { }
1542 public TokenTypeBool (Token original) : base (original) { }
1543 public override Type ToSysType () { return typeof (bool); }
1544 public override string ToString () { return "bool"; }
1545 }
1546 public class TokenTypeChar : TokenType {
1547 private static readonly FieldInfo iarCharsFieldInfo = typeof (XMRInstArrays).GetField ("iarChars");
1548
1549 public TokenTypeChar (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { }
1550 public TokenTypeChar (Token original) : base (original) { }
1551 public override Type ToSysType () { return typeof (char); }
1552 public override string ToString () { return "char"; }
1553 public override void AssignVarSlot (TokenDeclVar declVar, XMRInstArSizes arSizes)
1554 {
1555 declVar.vTableArray = iarCharsFieldInfo;
1556 declVar.vTableIndex = arSizes.iasChars ++;
1557 }
1558 }
1559 public class TokenTypeExc : TokenType {
1560 private static readonly FieldInfo iarObjectsFieldInfo = typeof (XMRInstArrays).GetField ("iarObjects");
1561
1562 public TokenTypeExc (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { }
1563 public TokenTypeExc (Token original) : base (original) { }
1564 public override Type ToSysType () { return typeof (Exception); }
1565 public override string ToString () { return "exception"; }
1566 public override void AssignVarSlot (TokenDeclVar declVar, XMRInstArSizes arSizes)
1567 {
1568 declVar.vTableArray = iarObjectsFieldInfo;
1569 declVar.vTableIndex = arSizes.iasObjects ++;
1570 }
1571 }
1572 public class TokenTypeFloat : TokenType {
1573 private static readonly FieldInfo iarFloatsFieldInfo = typeof (XMRInstArrays).GetField ("iarFloats");
1574
1575 public TokenTypeFloat (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { }
1576 public TokenTypeFloat (Token original) : base (original) { }
1577 public override Type ToSysType () { return typeof (double); }
1578 public override string ToString () { return "float"; }
1579 public override void AssignVarSlot (TokenDeclVar declVar, XMRInstArSizes arSizes)
1580 {
1581 declVar.vTableArray = iarFloatsFieldInfo;
1582 declVar.vTableIndex = arSizes.iasFloats ++;
1583 }
1584 }
1585 public class TokenTypeInt : TokenType {
1586 private static readonly FieldInfo iarIntegersFieldInfo = typeof (XMRInstArrays).GetField ("iarIntegers");
1587
1588 public TokenTypeInt (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { }
1589 public TokenTypeInt (Token original) : base (original) { }
1590 public override Type ToSysType () { return typeof (int); }
1591 public override string ToString () { return "integer"; }
1592 public override void AssignVarSlot (TokenDeclVar declVar, XMRInstArSizes arSizes)
1593 {
1594 declVar.vTableArray = iarIntegersFieldInfo;
1595 declVar.vTableIndex = arSizes.iasIntegers ++;
1596 }
1597 }
1598 public class TokenTypeKey : TokenType {
1599 private static readonly FieldInfo iarStringsFieldInfo = typeof (XMRInstArrays).GetField ("iarStrings");
1600
1601 public TokenTypeKey (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { }
1602 public TokenTypeKey (Token original) : base (original) { }
1603 public override Type ToSysType () { return typeof (string); }
1604 public override string ToString () { return "key"; }
1605 public override void AssignVarSlot (TokenDeclVar declVar, XMRInstArSizes arSizes)
1606 {
1607 declVar.vTableArray = iarStringsFieldInfo;
1608 declVar.vTableIndex = arSizes.iasStrings ++;
1609 }
1610 }
1611 public class TokenTypeList : TokenType {
1612 private static readonly FieldInfo iarListsFieldInfo = typeof (XMRInstArrays).GetField ("iarLists");
1613 private static readonly ConstructorInfo htListCtor = typeof (HeapTrackerList).GetConstructor (new Type [] { typeof (XMRInstAbstract) });
1614
1615 public TokenTypeList (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { }
1616 public TokenTypeList (Token original) : base (original) { }
1617 public override Type ToSysType () { return typeof (LSL_List); }
1618 public override string ToString () { return "list"; }
1619 public override void AssignVarSlot (TokenDeclVar declVar, XMRInstArSizes arSizes)
1620 {
1621 declVar.vTableArray = iarListsFieldInfo;
1622 declVar.vTableIndex = arSizes.iasLists ++;
1623 }
1624 public override Type ToHeapTrackerType () { return typeof (HeapTrackerList); }
1625 public override ConstructorInfo GetHeapTrackerCtor () { return htListCtor; }
1626 public override void CallHeapTrackerPopMeth (Token errorAt, ScriptMyILGen ilGen) { HeapTrackerList.GenPop(errorAt, ilGen); }
1627 public override void CallHeapTrackerPushMeth (Token errorAt, ScriptMyILGen ilGen) { HeapTrackerList.GenPush(errorAt, ilGen); }
1628 }
1629 public class TokenTypeObject : TokenType {
1630 private static readonly FieldInfo iarObjectsFieldInfo = typeof (XMRInstArrays).GetField ("iarObjects");
1631 private static readonly ConstructorInfo htObjectCtor = typeof (HeapTrackerObject).GetConstructor (new Type [] { typeof (XMRInstAbstract) });
1632
1633 public TokenTypeObject (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { }
1634 public TokenTypeObject (Token original) : base (original) { }
1635 public override Type ToSysType () { return typeof (object); }
1636 public override string ToString () { return "object"; }
1637 public override void AssignVarSlot (TokenDeclVar declVar, XMRInstArSizes arSizes)
1638 {
1639 declVar.vTableArray = iarObjectsFieldInfo;
1640 declVar.vTableIndex = arSizes.iasObjects ++;
1641 }
1642 public override Type ToHeapTrackerType () { return typeof (HeapTrackerObject); }
1643 public override ConstructorInfo GetHeapTrackerCtor () { return htObjectCtor; }
1644 public override void CallHeapTrackerPopMeth(Token errorAt, ScriptMyILGen ilGen) { HeapTrackerObject.GenPop (errorAt, ilGen); }
1645 public override void CallHeapTrackerPushMeth(Token errorAt, ScriptMyILGen ilGen) { HeapTrackerObject.GenPush(errorAt, ilGen); }
1646 }
1647 public class TokenTypeRot : TokenType {
1648 private static readonly FieldInfo iarRotationsFieldInfo = typeof (XMRInstArrays).GetField ("iarRotations");
1649
1650 public TokenTypeRot (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { }
1651 public TokenTypeRot (Token original) : base (original) { }
1652 public override Type ToSysType () { return typeof (LSL_Rotation); }
1653 public override string ToString () { return "rotation"; }
1654 public override void AssignVarSlot (TokenDeclVar declVar, XMRInstArSizes arSizes)
1655 {
1656 declVar.vTableArray = iarRotationsFieldInfo;
1657 declVar.vTableIndex = arSizes.iasRotations ++;
1658 }
1659 }
1660 public class TokenTypeStr : TokenType {
1661 private static readonly FieldInfo iarStringsFieldInfo = typeof (XMRInstArrays).GetField ("iarStrings");
1662 private static readonly ConstructorInfo htStringCtor = typeof (HeapTrackerString).GetConstructor (new Type [] { typeof (XMRInstAbstract) });
1663
1664 public TokenTypeStr (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { }
1665 public TokenTypeStr (Token original) : base (original) { }
1666 public override Type ToSysType () { return typeof (string); }
1667 public override string ToString () { return "string"; }
1668 public override void AssignVarSlot (TokenDeclVar declVar, XMRInstArSizes arSizes)
1669 {
1670 declVar.vTableArray = iarStringsFieldInfo;
1671 declVar.vTableIndex = arSizes.iasStrings ++;
1672 }
1673 public override Type ToHeapTrackerType () { return typeof (HeapTrackerString); }
1674 public override ConstructorInfo GetHeapTrackerCtor () { return htStringCtor; }
1675 public override void CallHeapTrackerPopMeth(Token errorAt, ScriptMyILGen ilGen) { HeapTrackerString.GenPop(errorAt, ilGen); }
1676 public override void CallHeapTrackerPushMeth (Token errorAt, ScriptMyILGen ilGen) { HeapTrackerString.GenPush(errorAt, ilGen); }
1677 }
1678 public class TokenTypeUndef : TokenType { // for the 'undef' constant, ie, null object pointer
1679 public TokenTypeUndef (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { }
1680 public TokenTypeUndef (Token original) : base (original) { }
1681 public override Type ToSysType () { return typeof (object); }
1682 public override string ToString () { return "undef"; }
1683 }
1684 public class TokenTypeVec : TokenType {
1685 private static readonly FieldInfo iarVectorsFieldInfo = typeof (XMRInstArrays).GetField ("iarVectors");
1686
1687 public TokenTypeVec (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { }
1688 public TokenTypeVec (Token original) : base (original) { }
1689 public override Type ToSysType () { return typeof (LSL_Vector); }
1690 public override string ToString () { return "vector"; }
1691 public override void AssignVarSlot (TokenDeclVar declVar, XMRInstArSizes arSizes)
1692 {
1693 declVar.vTableArray = iarVectorsFieldInfo;
1694 declVar.vTableIndex = arSizes.iasVectors ++;
1695 }
1696 }
1697 public class TokenTypeVoid : TokenType { // used only for function/method return types
1698 public TokenTypeVoid (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { }
1699 public TokenTypeVoid (Token original) : base (original) { }
1700 public override Type ToSysType () { return typeof (void); }
1701 public override string ToString () { return "void"; }
1702 }
1703
1704 public class TokenTypeLSLFloat : TokenTypeFloat {
1705 public TokenTypeLSLFloat (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { }
1706 public TokenTypeLSLFloat (Token original) : base (original) { }
1707 public override Type ToLSLWrapType () { return typeof (LSL_Float); }
1708 }
1709 public class TokenTypeLSLInt : TokenTypeInt {
1710 public TokenTypeLSLInt (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { }
1711 public TokenTypeLSLInt (Token original) : base (original) { }
1712 public override Type ToLSLWrapType () { return typeof (LSL_Integer); }
1713 }
1714 public class TokenTypeLSLKey : TokenTypeKey {
1715 public TokenTypeLSLKey (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { }
1716 public TokenTypeLSLKey (Token original) : base (original) { }
1717 public override Type ToLSLWrapType () { return typeof (LSL_Key); }
1718 }
1719 public class TokenTypeLSLString : TokenTypeStr {
1720 public TokenTypeLSLString (TokenErrorMessage emsg, string file, int line, int posn) : base (emsg, file, line, posn) { }
1721 public TokenTypeLSLString (Token original) : base (original) { }
1722 public override Type ToLSLWrapType () { return typeof (LSL_String); }
1723 }
1724}