home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1997 August / PCO0897.ISO / filesbbs / os2 / fp1os2.arj / OS2 / DATA / 49 / C / 0 / F_26836 / JScriptTokenizer.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-05-15  |  16.3 KB  |  871 lines

  1. import java.io.IOException;
  2. import java.io.InputStream;
  3. import java.io.PrintStream;
  4. import java.io.StringBufferInputStream;
  5.  
  6. public class JScriptTokenizer extends JSbxBase implements JScriptTokenInterface {
  7.    private static JSbxHashtable aTokenTab = new JSbxHashtable();
  8.    private static short[] aCharTypeTab;
  9.    private static JScriptToken aStartBlockToken;
  10.    private static JScriptToken aEndBlockToken;
  11.    private static JScriptToken aStartIndexToken;
  12.    private static JScriptToken aEndIndexToken;
  13.    private static JScriptToken aEndOfStmtToken;
  14.    private static JScriptToken aElemPointToken;
  15.    private static JScriptToken aEndOfLineToken;
  16.    private boolean bCommentAsToken;
  17.    private static int EOF = -1;
  18.    InputStream aIn;
  19.    private int[] aPeekCharBuffer;
  20.    private int nPeekCharCount;
  21.    private static int NO_PEEK_CHAR = -2;
  22.    private JScriptToken aPeekToken;
  23.    private JScriptTokenPosition aPeekTokenPos;
  24.    private char[] aCharBuffer;
  25.    private int nTotalPos;
  26.    private int nLine;
  27.    private int nCol;
  28.    private int nStartPos;
  29.    private int nStartLine;
  30.    private int nStartCol;
  31.    private JScriptToken aLastToken;
  32.    public static final short JST_START_RESERVED = 1;
  33.    public static final short JST_ABSTRACT = 1;
  34.    public static final short JST_BOOLEAN = 2;
  35.    public static final short JST_BREAK = 3;
  36.    public static final short JST_BYTE = 4;
  37.    public static final short JST_CASE = 5;
  38.    public static final short JST_CATCH = 6;
  39.    public static final short JST_CHAR = 7;
  40.    public static final short JST_CLASS = 8;
  41.    public static final short JST_CONST = 9;
  42.    public static final short JST_CONTINUE = 10;
  43.    public static final short JST_DEFAULT = 11;
  44.    public static final short JST_DELETE = 52;
  45.    public static final short JST_DO = 12;
  46.    public static final short JST_DOUBLE = 13;
  47.    public static final short JST_ELSE = 14;
  48.    public static final short JST_EXTENDS = 15;
  49.    public static final short JST_FINAL = 16;
  50.    public static final short JST_FINALLY = 17;
  51.    public static final short JST_FLOAT = 18;
  52.    public static final short JST_FOR = 19;
  53.    public static final short JST_FUNCTION = 20;
  54.    public static final short JST_GOTO = 21;
  55.    public static final short JST_IF = 22;
  56.    public static final short JST_IMPLEMENTS = 23;
  57.    public static final short JST_IMPORT = 24;
  58.    public static final short JST_IN = 25;
  59.    public static final short JST_INSTANCEOF = 26;
  60.    public static final short JST_INT = 27;
  61.    public static final short JST_INTERFACE = 28;
  62.    public static final short JST_LONG = 29;
  63.    public static final short JST_NATIVE = 30;
  64.    public static final short JST_NEW = 31;
  65.    public static final short JST_PACKAGE = 32;
  66.    public static final short JST_PRIVATE = 33;
  67.    public static final short JST_PROTECTED = 34;
  68.    public static final short JST_PUBLIC = 35;
  69.    public static final short JST_RETURN = 36;
  70.    public static final short JST_SHORT = 37;
  71.    public static final short JST_STATIC = 38;
  72.    public static final short JST_SUPER = 39;
  73.    public static final short JST_SWITCH = 40;
  74.    public static final short JST_SYNCHRONIZED = 41;
  75.    public static final short JST_THIS = 42;
  76.    public static final short JST_THROW = 43;
  77.    public static final short JST_THROWS = 44;
  78.    public static final short JST_TRANSIENT = 45;
  79.    public static final short JST_TRY = 46;
  80.    public static final short JST_TYPEOF = 47;
  81.    public static final short JST_VAR = 48;
  82.    public static final short JST_VOID = 49;
  83.    public static final short JST_WHILE = 50;
  84.    public static final short JST_WITH = 51;
  85.    public static final short JST_START_OPERATORS = 80;
  86.    public static final short JST_LOG_NOT = 80;
  87.    public static final short JST_NE = 81;
  88.    public static final short JST_MOD = 82;
  89.    public static final short JST_ASS_MOD = 83;
  90.    public static final short JST_BIT_AND = 84;
  91.    public static final short JST_LOG_AND = 85;
  92.    public static final short JST_ASS_AND = 86;
  93.    public static final short JST_LPAREN = 87;
  94.    public static final short JST_RPAREN = 88;
  95.    public static final short JST_MUL = 89;
  96.    public static final short JST_ASS_MUL = 90;
  97.    public static final short JST_PLUS = 91;
  98.    public static final short JST_INC = 92;
  99.    public static final short JST_ASS_PLUS = 93;
  100.    public static final short JST_COMMA = 94;
  101.    public static final short JST_MINUS = 95;
  102.    public static final short JST_DEC = 96;
  103.    public static final short JST_ASS_MINUS = 97;
  104.    public static final short JST_DIV = 98;
  105.    public static final short JST_ASS_DIV = 99;
  106.    public static final short JST_COND_SEL = 100;
  107.    public static final short JST_LT = 101;
  108.    public static final short JST_LSHIFT = 102;
  109.    public static final short JST_ASS_LSHIFT = 103;
  110.    public static final short JST_LE = 104;
  111.    public static final short JST_ASSIGNMENT = 105;
  112.    public static final short JST_EQ = 106;
  113.    public static final short JST_GT = 107;
  114.    public static final short JST_RSHIFT = 108;
  115.    public static final short JST_ASS_RSHIFT = 109;
  116.    public static final short JST_RSHIFT_Z = 110;
  117.    public static final short JST_ASS_RSHIFT_Z = 111;
  118.    public static final short JST_GE = 112;
  119.    public static final short JST_COND_QUEST = 113;
  120.    public static final short JST_BIT_XOR = 114;
  121.    public static final short JST_ASS_XOR = 115;
  122.    public static final short JST_BIT_OR = 116;
  123.    public static final short JST_ASS_OR = 117;
  124.    public static final short JST_LOG_OR = 118;
  125.    public static final short JST_BIT_NOT = 119;
  126.    public static final short JST_START_CHARS = 128;
  127.    public static final short JST_START_BLOCK = 128;
  128.    public static final short JST_END_BLOCK = 129;
  129.    public static final short JST_START_INDEX = 130;
  130.    public static final short JST_END_INDEX = 131;
  131.    public static final short JST_END_OF_STMT = 132;
  132.    public static final short JST_ELEM_POINT = 133;
  133.    public static final short JST_END_OF_LINE = 134;
  134.    public static final short JST_MAX_TOKEN_ID = 134;
  135.    private static final short CHAR_START_IDENTIFIER = 1;
  136.    private static final short CHAR_IN_IDENTIFIER = 2;
  137.    private static final short CHAR_START_NUMBER = 4;
  138.    private static final short CHAR_IN_NUMBER = 8;
  139.    private static final short CHAR_IN_HEX_NUMBER = 16;
  140.    private static final short CHAR_IN_OCT_NUMBER = 32;
  141.    private static final short CHAR_START_STRING = 64;
  142.    private static final short CHAR_OPERATOR = 128;
  143.    private static final short CHAR_SPECIAL = 256;
  144.    private static final short CHAR_SPACE = 512;
  145.    private static final short CHAR_EOL = 1024;
  146.    private static JScriptToken[] aTokenIDTab = new JScriptToken[134];
  147.  
  148.    public JScriptTokenizer() {
  149.       this.nStartPos = this.nTotalPos;
  150.       this.nStartLine = this.nLine;
  151.       this.nStartCol = this.nCol;
  152.       this.Init();
  153.    }
  154.  
  155.    public JScriptTokenizer(String var1) {
  156.       this.nStartPos = this.nTotalPos;
  157.       this.nStartLine = this.nLine;
  158.       this.nStartCol = this.nCol;
  159.       this.Init();
  160.       this.SetSource(var1);
  161.    }
  162.  
  163.    public JScriptTokenizer(InputStream var1) {
  164.       this.nStartPos = this.nTotalPos;
  165.       this.nStartLine = this.nLine;
  166.       this.nStartCol = this.nCol;
  167.       this.Init();
  168.       this.SetSource(var1);
  169.    }
  170.  
  171.    private void Init() {
  172.       this.aPeekCharBuffer = new int[10];
  173.       this.aCharBuffer = new char[2048];
  174.       this.aPeekTokenPos = new JScriptTokenPosition();
  175.       this.aLastToken = null;
  176.    }
  177.  
  178.    public void Reset() {
  179.       this.nPeekCharCount = 0;
  180.       this.aPeekToken = null;
  181.       this.nLine = 0;
  182.       this.nCol = 0;
  183.       this.nTotalPos = 0;
  184.    }
  185.  
  186.    public void SetSource(String var1) {
  187.       this.Reset();
  188.       this.aIn = new StringBufferInputStream(var1);
  189.    }
  190.  
  191.    public void SetSource(InputStream var1) {
  192.       this.Reset();
  193.       this.aIn = var1;
  194.    }
  195.  
  196.    public JScriptToken NextToken(JScriptTokenPosition var1) throws JScriptTokenizerException {
  197.       JScriptToken var2;
  198.       if (this.aPeekToken != null) {
  199.          var2 = this.aPeekToken;
  200.          if (var1 != null) {
  201.             var1.Set(this.aPeekTokenPos);
  202.          }
  203.  
  204.          this.aPeekToken = null;
  205.       } else {
  206.          var2 = this.ImpNextToken(var1);
  207.       }
  208.  
  209.       this.aLastToken = var2;
  210.       return var2;
  211.    }
  212.  
  213.    public JScriptToken PeekToken(JScriptTokenPosition var1) throws JScriptTokenizerException {
  214.       if (this.aPeekToken != null) {
  215.          if (var1 != null) {
  216.             var1.Set(this.aPeekTokenPos);
  217.          }
  218.       } else {
  219.          this.aPeekToken = this.ImpNextToken(this.aPeekTokenPos);
  220.       }
  221.  
  222.       return this.aPeekToken;
  223.    }
  224.  
  225.    public JScriptToken LastToken() {
  226.       return this.aLastToken;
  227.    }
  228.  
  229.    private JScriptToken ImpNextToken(JScriptTokenPosition var1) throws JScriptTokenizerException {
  230.       JScriptToken var2 = null;
  231.  
  232.       while(this.TestCharFlags(this.PeekChar(), (short)512)) {
  233.          this.GetChar();
  234.       }
  235.  
  236.       this.nStartPos = this.nTotalPos;
  237.       this.nStartLine = this.nLine;
  238.       this.nStartCol = this.nCol;
  239.       int var3 = this.PeekChar();
  240.       if (var3 == EOF) {
  241.          if (var1 != null) {
  242.             var1.Set(0, 0, 0, 0);
  243.          }
  244.  
  245.          return var2;
  246.       } else {
  247.          this.GetChar();
  248.          if (this.TestCharFlags(var3, (short)1)) {
  249.             int var39 = 0;
  250.  
  251.             boolean var29;
  252.             do {
  253.                this.aCharBuffer[var39++] = (char)var3;
  254.                var3 = this.PeekChar();
  255.                var29 = this.TestCharFlags(var3, (short)2);
  256.                if (var29) {
  257.                   this.GetChar();
  258.                }
  259.             } while(var29);
  260.  
  261.             String var46 = new String(this.aCharBuffer, 0, var39);
  262.             var2 = (JScriptToken)aTokenTab.get(var46);
  263.             if (var2 == null) {
  264.                var2 = new JScriptToken(var46, (byte)2, (short)0);
  265.             }
  266.          } else if (this.TestCharFlags(var3, (short)128)) {
  267.             if (var3 == 47) {
  268.                int var22 = this.PeekChar();
  269.                if (var22 == 47 || var22 == 42) {
  270.                   this.GetChar();
  271.                   if (var22 == 47) {
  272.                      int var31 = 0;
  273.                      if (this.bCommentAsToken) {
  274.                         this.aCharBuffer[var31++] = '/';
  275.                         this.aCharBuffer[var31++] = '/';
  276.                      }
  277.  
  278.                      int var43 = this.PeekChar();
  279.  
  280.                      while(var43 != EOF && !this.TestCharFlags(var43, (short)1024)) {
  281.                         var3 = this.GetChar();
  282.                         var43 = this.PeekChar();
  283.                         if (this.bCommentAsToken) {
  284.                            this.aCharBuffer[var31++] = (char)var3;
  285.                         }
  286.                      }
  287.  
  288.                      if (this.bCommentAsToken) {
  289.                         String var53 = new String(this.aCharBuffer, 0, var31);
  290.                         this.SetTokenPos(var1);
  291.                         return new JScriptToken(var53, (byte)6, (short)0);
  292.                      }
  293.                   } else if (var22 == 42) {
  294.                      int var33 = 0;
  295.                      if (this.bCommentAsToken) {
  296.                         this.aCharBuffer[var33++] = '/';
  297.                         this.aCharBuffer[var33++] = '*';
  298.                      }
  299.  
  300.                      do {
  301.                         var3 = this.GetChar();
  302.                         var22 = this.PeekChar();
  303.                         if (this.TestCharFlags(var3, (short)1024)) {
  304.                            if (var22 != var3 && this.TestCharFlags(var22, (short)1024)) {
  305.                               var3 = this.GetChar();
  306.                               var22 = this.PeekChar();
  307.                            }
  308.  
  309.                            this.nCol = 0;
  310.                            ++this.nLine;
  311.                         } else if (this.bCommentAsToken) {
  312.                            this.aCharBuffer[var33++] = (char)var3;
  313.                         }
  314.                      } while(var22 != EOF && (var3 != 42 || var22 != 47));
  315.  
  316.                      if (var22 != EOF) {
  317.                         this.GetChar();
  318.                      }
  319.  
  320.                      if (this.bCommentAsToken) {
  321.                         this.aCharBuffer[var33++] = '/';
  322.                         String var44 = new String(this.aCharBuffer, 0, var33);
  323.                         this.SetTokenPos(var1);
  324.                         return new JScriptToken(var44, (byte)6, (short)0);
  325.                      }
  326.                   }
  327.  
  328.                   return this.ImpNextToken(var1);
  329.                }
  330.             } else if (var3 == 60) {
  331.                int var24 = this.PeekChar();
  332.                if (var24 == 33) {
  333.                   this.GetChar();
  334.                   var24 = this.PeekChar();
  335.                   if (var24 == 45) {
  336.                      this.GetChar();
  337.                      var24 = this.PeekChar();
  338.                      if (var24 == 45) {
  339.                         this.GetChar();
  340.  
  341.                         for(int var36 = this.PeekChar(); var36 != EOF && !this.TestCharFlags(var36, (short)1024); var36 = this.PeekChar()) {
  342.                            var3 = this.GetChar();
  343.                         }
  344.  
  345.                         return this.ImpNextToken(var1);
  346.                      }
  347.  
  348.                      this.PushBackChar('-');
  349.                      this.PushBackChar('!');
  350.                   } else {
  351.                      this.PushBackChar('!');
  352.                   }
  353.                }
  354.             }
  355.  
  356.             int var27 = 0;
  357.             this.aCharBuffer[var27++] = (char)var3;
  358.             String var37 = new String(this.aCharBuffer, 0, var27);
  359.             var2 = (JScriptToken)aTokenTab.get(var37);
  360.  
  361.             JScriptToken var45;
  362.             do {
  363.                var45 = null;
  364.                var3 = this.PeekChar();
  365.                if (this.TestCharFlags(var3, (short)128)) {
  366.                   this.aCharBuffer[var27] = (char)var3;
  367.                   var37 = new String(this.aCharBuffer, 0, var27 + 1);
  368.                   var45 = (JScriptToken)aTokenTab.get(var37);
  369.                   if (var45 != null) {
  370.                      var2 = var45;
  371.                      this.GetChar();
  372.                      ++var27;
  373.                   }
  374.                }
  375.             } while(var45 != null);
  376.          } else if (var3 != 46 || this.PeekChar() >= 48 && this.PeekChar() <= 57) {
  377.             if (this.TestCharFlags(var3, (short)4)) {
  378.                int var20 = 0;
  379.                byte var30 = 10;
  380.                if (var3 == 48) {
  381.                   if (this.TestCharFlags(this.PeekChar(), (short)32)) {
  382.                      for(var30 = 8; this.TestCharFlags(this.PeekChar(), (short)32); this.aCharBuffer[var20++] = (char)var3) {
  383.                         var3 = this.GetChar();
  384.                      }
  385.                   } else if (this.PeekChar() == 120 || this.PeekChar() == 88) {
  386.                      this.GetChar();
  387.  
  388.                      for(var30 = 16; this.TestCharFlags(this.PeekChar(), (short)16); this.aCharBuffer[var20++] = (char)var3) {
  389.                         var3 = this.GetChar();
  390.                      }
  391.                   }
  392.                }
  393.  
  394.                if (var30 != 10) {
  395.                   String var41 = new String(this.aCharBuffer, 0, var20);
  396.                   int var51 = Integer.parseInt(var41, var30);
  397.                   JSbxValue var55 = new JSbxValue((double)var51);
  398.                   if (var30 == 16) {
  399.                      var2 = new JScriptToken("0x" + var41, var55);
  400.                   } else {
  401.                      var2 = new JScriptToken("0" + var41, var55);
  402.                   }
  403.                } else {
  404.                   this.aCharBuffer[var20++] = (char)var3;
  405.  
  406.                   for(boolean var42 = false; this.TestCharFlags(this.PeekChar(), (short)8) || var42 && this.PeekChar() == 43 || var42 && this.PeekChar() == 45; this.aCharBuffer[var20++] = (char)var3) {
  407.                      var3 = this.GetChar();
  408.                      var42 = var3 == 101 || var3 == 69;
  409.                   }
  410.  
  411.                   String var52 = new String(this.aCharBuffer, 0, var20);
  412.  
  413.                   Double var56;
  414.                   try {
  415.                      var56 = new Double(var52);
  416.                   } catch (NumberFormatException var10) {
  417.                      throw new JScriptTokenizerException(114, "Number", this.NewTokenPos());
  418.                   }
  419.  
  420.                   JSbxValue var57 = new JSbxValue(var56);
  421.                   var2 = new JScriptToken(var52, var57);
  422.                }
  423.             } else if (!this.TestCharFlags(var3, (short)64)) {
  424.                if (this.TestCharFlags(var3, (short)1024)) {
  425.                   int var19 = this.PeekChar();
  426.                   if (var19 != var3 && this.TestCharFlags(var19, (short)1024)) {
  427.                      this.GetChar();
  428.                   }
  429.  
  430.                   this.nStartCol = 0;
  431.                   this.nCol = 0;
  432.                   ++this.nLine;
  433.                   var2 = aEndOfLineToken;
  434.                } else if (this.TestCharFlags(var3, (short)256)) {
  435.                   switch (var3) {
  436.                      case 59:
  437.                         var2 = aEndOfStmtToken;
  438.                         break;
  439.                      case 91:
  440.                         var2 = aStartIndexToken;
  441.                         break;
  442.                      case 93:
  443.                         var2 = aEndIndexToken;
  444.                         break;
  445.                      case 123:
  446.                         var2 = aStartBlockToken;
  447.                         break;
  448.                      case 125:
  449.                         var2 = aEndBlockToken;
  450.                   }
  451.                } else {
  452.                   var2 = new JScriptToken((char)var3 + " (" + var3 + ")", (byte)6, (short)0);
  453.                }
  454.             } else {
  455.                int var4 = var3;
  456.                int var5 = 0;
  457.  
  458.                while(this.PeekChar() != var4) {
  459.                   var3 = this.GetChar();
  460.                   if (var3 == EOF || this.TestCharFlags(var3, (short)1024)) {
  461.                      throw new JScriptTokenizerException(115, "unterminated string literal", this.NewTokenPos());
  462.                   }
  463.  
  464.                   if (var3 != 92) {
  465.                      this.aCharBuffer[var5++] = (char)var3;
  466.                   } else {
  467.                      int var6 = this.PeekChar();
  468.                      if (this.TestCharFlags(var6, (short)32)) {
  469.                         int var48 = 0;
  470.                         int var54 = 0;
  471.                         int var9 = 0;
  472.  
  473.                         do {
  474.                            var48 = var54;
  475.                            var54 = var9;
  476.                            var9 = this.GetChar() - 48;
  477.                         } while(this.TestCharFlags(this.PeekChar(), (short)32));
  478.  
  479.                         var3 = 64 * (var48 % 4) + 8 * var54 + var9;
  480.                         this.aCharBuffer[var5++] = (char)var3;
  481.                      } else if (var6 != 120) {
  482.                         boolean var47 = true;
  483.                         switch (var6) {
  484.                            case 34:
  485.                               var3 = 34;
  486.                               break;
  487.                            case 39:
  488.                               var3 = 39;
  489.                               break;
  490.                            case 92:
  491.                               var3 = 92;
  492.                               break;
  493.                            case 98:
  494.                               var3 = 8;
  495.                               break;
  496.                            case 102:
  497.                               var3 = 12;
  498.                               break;
  499.                            case 110:
  500.                               var3 = 10;
  501.                               break;
  502.                            case 114:
  503.                               var3 = 13;
  504.                               break;
  505.                            case 116:
  506.                               var3 = 9;
  507.                               break;
  508.                            default:
  509.                               var47 = false;
  510.                         }
  511.  
  512.                         if (var47) {
  513.                            this.aCharBuffer[var5++] = (char)var3;
  514.                            this.GetChar();
  515.                         }
  516.                      } else {
  517.                         this.GetChar();
  518.                         char[] var7 = new char[]{'0', '0'};
  519.  
  520.                         do {
  521.                            var7[0] = var7[1];
  522.                            var7[1] = (char)this.GetChar();
  523.                         } while(this.TestCharFlags(this.PeekChar(), (short)16));
  524.  
  525.                         String var8 = new String(var7, 0, 2);
  526.                         var3 = Integer.parseInt(var8, 16);
  527.                         this.aCharBuffer[var5++] = (char)var3;
  528.                      }
  529.                   }
  530.                }
  531.  
  532.                this.GetChar();
  533.                String var40 = new String(this.aCharBuffer, 0, var5);
  534.                JSbxValue var50 = new JSbxValue(var40);
  535.                var2 = new JScriptToken(var40, var50);
  536.             }
  537.          } else {
  538.             var2 = aElemPointToken;
  539.          }
  540.  
  541.          this.SetTokenPos(var1);
  542.          return var2;
  543.       }
  544.    }
  545.  
  546.    private void SetTokenPos(JScriptTokenPosition var1) {
  547.       if (var1 != null) {
  548.          var1.Set(this.nStartLine, this.nStartCol, this.nStartPos, this.nTotalPos);
  549.       }
  550.  
  551.    }
  552.  
  553.    private JScriptTokenPosition NewTokenPos() {
  554.       JScriptTokenPosition var1 = new JScriptTokenPosition();
  555.       this.SetTokenPos(var1);
  556.       return var1;
  557.    }
  558.  
  559.    private boolean TestCharFlags(int var1, short var2) {
  560.       if (var1 == -1) {
  561.          return false;
  562.       } else {
  563.          return (aCharTypeTab[var1] & var2) != 0;
  564.       }
  565.    }
  566.  
  567.    private int GetChar() throws JScriptTokenizerException {
  568.       ++this.nCol;
  569.       ++this.nTotalPos;
  570.       int var1;
  571.       if (this.nPeekCharCount > 0) {
  572.          --this.nPeekCharCount;
  573.          var1 = this.aPeekCharBuffer[this.nPeekCharCount];
  574.       } else {
  575.          var1 = this.ReadCharFromStream();
  576.       }
  577.  
  578.       return var1;
  579.    }
  580.  
  581.    private int PeekChar() throws JScriptTokenizerException {
  582.       if (this.nPeekCharCount == 0) {
  583.          this.aPeekCharBuffer[this.nPeekCharCount] = this.ReadCharFromStream();
  584.          ++this.nPeekCharCount;
  585.       }
  586.  
  587.       return this.aPeekCharBuffer[this.nPeekCharCount - 1];
  588.    }
  589.  
  590.    private void PushBackChar(char var1) {
  591.       this.aPeekCharBuffer[this.nPeekCharCount] = var1;
  592.       ++this.nPeekCharCount;
  593.       --this.nTotalPos;
  594.    }
  595.  
  596.    private int ReadCharFromStream() throws JScriptTokenizerException {
  597.       int var1 = 0;
  598.  
  599.       try {
  600.          var1 = this.aIn.read();
  601.          return var1;
  602.       } catch (IOException var2) {
  603.          throw new JScriptTokenizerException(111, "Tokenizer-IO-Error");
  604.       }
  605.    }
  606.  
  607.    public void DumpAll(PrintStream var1, boolean var2) throws JScriptTokenizerException {
  608.       this.bCommentAsToken = var2;
  609.       JScriptTokenPosition var4 = new JScriptTokenPosition();
  610.       int var5 = var4.GetLine();
  611.       int var6 = 0;
  612.       boolean var7 = false;
  613.       if (var1 != null && var2) {
  614.          var1.println("<HTML>\n<HEAD>\n<TITLE>AB-JavaScript-Tokenizer</TITLE></HEAD>\n<BODY>\n<PRE>");
  615.       }
  616.  
  617.       JScriptToken var3;
  618.       while((var3 = this.NextToken(var4)) != null) {
  619.          if (var3.GetID() == 129) {
  620.             --var6;
  621.          }
  622.  
  623.          if (var1 != null && var2 && var5 != var4.GetLine()) {
  624.             var5 = var4.GetLine();
  625.             var1.print("<BR>");
  626.             var7 = true;
  627.          }
  628.  
  629.          if (var1 != null) {
  630.             var3.DumpToken(var1, var2, var7 ? var6 : 0);
  631.             var7 = false;
  632.          }
  633.  
  634.          if (var3.GetID() == 128) {
  635.             ++var6;
  636.          }
  637.       }
  638.  
  639.       if (var1 != null && var2) {
  640.          var1.println("</PRE>\n</BODY></HTML>");
  641.       }
  642.  
  643.    }
  644.  
  645.    public static JScriptToken GetTokenFromID(short var0) {
  646.       return aTokenIDTab[var0];
  647.    }
  648.  
  649.    private static void PutKeywordToken(String var0, short var1) {
  650.       JScriptToken var2 = new JScriptToken(var0, (byte)1, var1);
  651.       aTokenTab.put(var2.GetString(), var2);
  652.       aTokenIDTab[var1] = var2;
  653.    }
  654.  
  655.    private static void PutOperatorToken(String var0, short var1) {
  656.       JScriptToken var2 = new JScriptToken(var0, (byte)4, var1);
  657.       aTokenTab.put(var2.GetString(), var2);
  658.       aTokenIDTab[var1] = var2;
  659.    }
  660.  
  661.    static {
  662.       PutKeywordToken("abstract", (short)1);
  663.       PutKeywordToken("boolean", (short)2);
  664.       PutKeywordToken("break", (short)3);
  665.       PutKeywordToken("byte", (short)4);
  666.       PutKeywordToken("case", (short)5);
  667.       PutKeywordToken("catch", (short)6);
  668.       PutKeywordToken("char", (short)7);
  669.       PutKeywordToken("class", (short)8);
  670.       PutKeywordToken("const", (short)9);
  671.       PutKeywordToken("continue", (short)10);
  672.       PutKeywordToken("default", (short)11);
  673.       PutKeywordToken("delete", (short)52);
  674.       PutKeywordToken("do", (short)12);
  675.       PutKeywordToken("double", (short)13);
  676.       PutKeywordToken("else", (short)14);
  677.       PutKeywordToken("extends", (short)15);
  678.       PutKeywordToken("final", (short)16);
  679.       PutKeywordToken("finally", (short)17);
  680.       PutKeywordToken("float", (short)18);
  681.       PutKeywordToken("for", (short)19);
  682.       PutKeywordToken("function", (short)20);
  683.       PutKeywordToken("goto", (short)21);
  684.       PutKeywordToken("if", (short)22);
  685.       PutKeywordToken("implements", (short)23);
  686.       PutKeywordToken("import", (short)24);
  687.       PutKeywordToken("in", (short)25);
  688.       PutKeywordToken("instanceof", (short)26);
  689.       PutKeywordToken("int", (short)27);
  690.       PutKeywordToken("interface", (short)28);
  691.       PutKeywordToken("long", (short)29);
  692.       PutKeywordToken("native", (short)30);
  693.       PutKeywordToken("new", (short)31);
  694.       PutKeywordToken("package", (short)32);
  695.       PutKeywordToken("private", (short)33);
  696.       PutKeywordToken("protected", (short)34);
  697.       PutKeywordToken("public", (short)35);
  698.       PutKeywordToken("return", (short)36);
  699.       PutKeywordToken("short", (short)37);
  700.       PutKeywordToken("static", (short)38);
  701.       PutKeywordToken("super", (short)39);
  702.       PutKeywordToken("switch", (short)40);
  703.       PutKeywordToken("synchronized", (short)41);
  704.       PutKeywordToken("this", (short)42);
  705.       PutKeywordToken("throw", (short)43);
  706.       PutKeywordToken("throws", (short)44);
  707.       PutKeywordToken("transient", (short)45);
  708.       PutKeywordToken("try", (short)46);
  709.       PutKeywordToken("var", (short)48);
  710.       PutKeywordToken("void", (short)49);
  711.       PutKeywordToken("while", (short)50);
  712.       PutKeywordToken("with", (short)51);
  713.       PutOperatorToken("typeof", (short)47);
  714.       PutOperatorToken("!", (short)80);
  715.       PutOperatorToken("!=", (short)81);
  716.       PutOperatorToken("%", (short)82);
  717.       PutOperatorToken("%=", (short)83);
  718.       PutOperatorToken("&", (short)84);
  719.       PutOperatorToken("&&", (short)85);
  720.       PutOperatorToken("&=", (short)86);
  721.       PutOperatorToken("(", (short)87);
  722.       PutOperatorToken(")", (short)88);
  723.       PutOperatorToken("*", (short)89);
  724.       PutOperatorToken("*=", (short)90);
  725.       PutOperatorToken("+", (short)91);
  726.       PutOperatorToken("++", (short)92);
  727.       PutOperatorToken("+=", (short)93);
  728.       PutOperatorToken(",", (short)94);
  729.       PutOperatorToken("-", (short)95);
  730.       PutOperatorToken("--", (short)96);
  731.       PutOperatorToken("-=", (short)97);
  732.       PutOperatorToken("/", (short)98);
  733.       PutOperatorToken("/=", (short)99);
  734.       PutOperatorToken(":", (short)100);
  735.       PutOperatorToken("<", (short)101);
  736.       PutOperatorToken("<<", (short)102);
  737.       PutOperatorToken("<<=", (short)103);
  738.       PutOperatorToken("<=", (short)104);
  739.       PutOperatorToken("=", (short)105);
  740.       PutOperatorToken("==", (short)106);
  741.       PutOperatorToken(">", (short)107);
  742.       PutOperatorToken(">>", (short)108);
  743.       PutOperatorToken(">>=", (short)109);
  744.       PutOperatorToken(">>>", (short)110);
  745.       PutOperatorToken(">>>=", (short)111);
  746.       PutOperatorToken(">=", (short)112);
  747.       PutOperatorToken("?", (short)113);
  748.       PutOperatorToken("^", (short)114);
  749.       PutOperatorToken("^=", (short)115);
  750.       PutOperatorToken("|", (short)116);
  751.       PutOperatorToken("|=", (short)117);
  752.       PutOperatorToken("||", (short)118);
  753.       PutOperatorToken("~", (short)119);
  754.       JScriptToken var0 = new JScriptToken("false", new JSbxValue(false));
  755.       aTokenTab.put(var0.GetString(), var0);
  756.       var0 = new JScriptToken("true", new JSbxValue(true));
  757.       aTokenTab.put(var0.GetString(), var0);
  758.       var0 = new JScriptToken("null", new JSbxValue((JSbxBase)null));
  759.       aTokenTab.put(var0.GetString(), var0);
  760.       aStartBlockToken = new JScriptToken("{", (byte)5, (short)128);
  761.       aEndBlockToken = new JScriptToken("}", (byte)5, (short)129);
  762.       aStartIndexToken = new JScriptToken("[", (byte)5, (short)130);
  763.       aEndIndexToken = new JScriptToken("]", (byte)5, (short)131);
  764.       aEndOfStmtToken = new JScriptToken(";", (byte)5, (short)132);
  765.       aElemPointToken = new JScriptToken(".", (byte)5, (short)133);
  766.       aEndOfLineToken = new JScriptToken("EOL", (byte)5, (short)134);
  767.       aCharTypeTab = new short[256];
  768.       byte var1 = 3;
  769.  
  770.       for(char var2 = 'a'; var2 <= 'z'; ++var2) {
  771.          short[] var10000 = aCharTypeTab;
  772.          var10000[var2] = (short)(var10000[var2] | var1);
  773.       }
  774.  
  775.       for(char var6 = 'A'; var6 <= 'Z'; ++var6) {
  776.          short[] var11 = aCharTypeTab;
  777.          var11[var6] = (short)(var11[var6] | var1);
  778.       }
  779.  
  780.       short[] var12 = aCharTypeTab;
  781.       var12[95] = (short)(var12[95] | var1);
  782.       var1 = 30;
  783.  
  784.       for(char var7 = '0'; var7 <= '9'; ++var7) {
  785.          var12 = aCharTypeTab;
  786.          var12[var7] = (short)(var12[var7] | var1);
  787.       }
  788.  
  789.       var12 = aCharTypeTab;
  790.       var12[101] = (short)(var12[101] | 8);
  791.       var12 = aCharTypeTab;
  792.       var12[69] = (short)(var12[69] | 8);
  793.       var12 = aCharTypeTab;
  794.       var12[46] = (short)(var12[46] | 12);
  795.  
  796.       for(char var8 = 'a'; var8 <= 'f'; ++var8) {
  797.          var12 = aCharTypeTab;
  798.          var12[var8] = (short)(var12[var8] | 16);
  799.       }
  800.  
  801.       for(char var9 = 'A'; var9 <= 'F'; ++var9) {
  802.          var12 = aCharTypeTab;
  803.          var12[var9] = (short)(var12[var9] | 16);
  804.       }
  805.  
  806.       for(char var10 = '0'; var10 <= '7'; ++var10) {
  807.          var12 = aCharTypeTab;
  808.          var12[var10] = (short)(var12[var10] | 32);
  809.       }
  810.  
  811.       var12 = aCharTypeTab;
  812.       var12[39] = (short)(var12[39] | 64);
  813.       var12 = aCharTypeTab;
  814.       var12[34] = (short)(var12[34] | 64);
  815.       var12 = aCharTypeTab;
  816.       var12[33] = (short)(var12[33] | 128);
  817.       var12 = aCharTypeTab;
  818.       var12[37] = (short)(var12[37] | 128);
  819.       var12 = aCharTypeTab;
  820.       var12[38] = (short)(var12[38] | 128);
  821.       var12 = aCharTypeTab;
  822.       var12[40] = (short)(var12[40] | 128);
  823.       var12 = aCharTypeTab;
  824.       var12[41] = (short)(var12[41] | 128);
  825.       var12 = aCharTypeTab;
  826.       var12[42] = (short)(var12[42] | 128);
  827.       var12 = aCharTypeTab;
  828.       var12[43] = (short)(var12[43] | 128);
  829.       var12 = aCharTypeTab;
  830.       var12[44] = (short)(var12[44] | 128);
  831.       var12 = aCharTypeTab;
  832.       var12[45] = (short)(var12[45] | 128);
  833.       var12 = aCharTypeTab;
  834.       var12[47] = (short)(var12[47] | 128);
  835.       var12 = aCharTypeTab;
  836.       var12[58] = (short)(var12[58] | 128);
  837.       var12 = aCharTypeTab;
  838.       var12[60] = (short)(var12[60] | 128);
  839.       var12 = aCharTypeTab;
  840.       var12[61] = (short)(var12[61] | 128);
  841.       var12 = aCharTypeTab;
  842.       var12[62] = (short)(var12[62] | 128);
  843.       var12 = aCharTypeTab;
  844.       var12[63] = (short)(var12[63] | 128);
  845.       var12 = aCharTypeTab;
  846.       var12[94] = (short)(var12[94] | 128);
  847.       var12 = aCharTypeTab;
  848.       var12[124] = (short)(var12[124] | 128);
  849.       var12 = aCharTypeTab;
  850.       var12[126] = (short)(var12[126] | 128);
  851.       var12 = aCharTypeTab;
  852.       var12[123] = (short)(var12[123] | 256);
  853.       var12 = aCharTypeTab;
  854.       var12[125] = (short)(var12[125] | 256);
  855.       var12 = aCharTypeTab;
  856.       var12[91] = (short)(var12[91] | 256);
  857.       var12 = aCharTypeTab;
  858.       var12[93] = (short)(var12[93] | 256);
  859.       var12 = aCharTypeTab;
  860.       var12[59] = (short)(var12[59] | 256);
  861.       var12 = aCharTypeTab;
  862.       var12[32] = (short)(var12[32] | 512);
  863.       var12 = aCharTypeTab;
  864.       var12[9] = (short)(var12[9] | 512);
  865.       var12 = aCharTypeTab;
  866.       var12[13] = (short)(var12[13] | 1024);
  867.       var12 = aCharTypeTab;
  868.       var12[10] = (short)(var12[10] | 1024);
  869.    }
  870. }
  871.