In message "Re: [kaffe] Bug report (java.io.StreamTokenizer)" on 03/07/01, Ito Kazumitsu <[EMAIL PROTECTED]> writes:
> (From the API doc) Each byte read from the input stream is regarded > as a character in the range '\u0000' through '\u00FF'. The character > value is used to look up five possible attributes of the character: > white space, alphabetic, numeric, string quote, and comment character. > Each character can have zero or more of these attributes. > (And I guess) BUT ONLY THE ATTRIBUTE MOST RECENTLY ASSIGNED IS EFFECTIVE. And additionally, THE NUMERIC ATTRIBUTE IS KEPT EFFECTIVE EVEN IF OTHER ATTIBUTES ARE ASSIGNED. Applying the attached patch, I am getting the same results as Sun's. --- java/io/StreamTokenizer.java.orig Tue Feb 19 09:47:49 2002 +++ java/io/StreamTokenizer.java Tue Jul 1 10:02:54 2003 @@ -74,6 +74,7 @@ public void commentChar(int ch) { if (ch >= 0 && ch <= 255) { + ordinaryCharKeepNumeric(ch); lookup(ch).isComment = true; } } @@ -430,11 +431,24 @@ } } +private void ordinaryCharKeepNumeric(int c) { + if (c >= 0 && c <= 255) { + TableEntry e = lookup(c); + e.isAlphabetic = false; + e.isStringQuote = false; + e.isComment = false; + e.isWhitespace = false; + } +} + public void parseNumbers() { for (int letter = '0'; letter <= '9'; letter++) { + ordinaryChar(letter); lookup(letter).isNumeric = true; } + ordinaryChar('.'); lookup('.').isNumeric = true; + ordinaryChar('-'); lookup('-').isNumeric = true; } @@ -444,6 +458,7 @@ public void quoteChar(int ch) { if (ch >= 0 && ch <= 255) { + ordinaryCharKeepNumeric(ch); lookup(ch).isStringQuote = true; } } @@ -545,10 +560,8 @@ } for (int letter = low; letter <= hi; letter++) { - TableEntry e = lookup(letter); - e.isWhitespace = true; - e.isAlphabetic = false; - e.isNumeric = false; + ordinaryCharKeepNumeric(letter); + lookup(letter).isWhitespace = true; } } @@ -562,6 +575,7 @@ } for (int letter = low; letter <= hi; letter++) { + ordinaryCharKeepNumeric(letter); lookup(letter).isAlphabetic = true; } } _______________________________________________ kaffe mailing list [EMAIL PROTECTED] http://kaffe.org/cgi-bin/mailman/listinfo/kaffe