2003/11/18 10:47:26
[org.ibex.core.git] / src / org / xwt / js / Lexer.java
index 1e2494e..5a6e02e 100644 (file)
@@ -77,6 +77,7 @@ class Lexer implements Tokens {
     
     // Token Subtype Handlers /////////////////////////////////////////////////////////
 
+    // FIXME: convert to a string switch
     private int getKeyword(String s) throws IOException {
         char c;
         switch (s.length()) {
@@ -224,11 +225,8 @@ class Lexer implements Tokens {
             }
         }
         
-        if (!isInteger) this.number = new Double(dval);
-        else if (Byte.MIN_VALUE <= longval && longval <= Byte.MAX_VALUE) this.number = new Byte((byte)longval);
-        else if (Short.MIN_VALUE <= longval && longval <= Short.MAX_VALUE) this.number = new Short((short)longval);
-        else if (Integer.MIN_VALUE <= longval && longval <= Integer.MAX_VALUE) this.number = new Integer((int)longval);
-        else this.number = new Double(longval);
+        if (!isInteger) this.number = JS.N(dval);
+        else this.number = JS.N(longval);
         return NUMBER;
     }
     
@@ -370,7 +368,7 @@ class Lexer implements Tokens {
             accumulator.append((char)lastread);
         }
         public String getString() throws IOException {
-            String ret = accumulator.toString();
+            String ret = accumulator.toString().intern();
             accumulator = null;
             return ret;
         }