2
0
mirror of git://gcc.gnu.org/git/gcc.git synced 2024-12-28 10:15:01 +08:00
gcc/libjava/testsuite/libjava.lang/PR141.java
Anthony Green 8cf870df7b re GNATS java.io/141 (StreamTokenizer doesn't scan mixed token types correctly)
2000-03-05  Anthony Green  <green@redhat.com>

        * libjava.lang/PR141.java: New file.
        * libjava.lang/PR141.out: New file.
	For PR java.io/141.

From-SVN: r32352
2000-03-06 03:48:33 +00:00

42 lines
944 B
Java

import java.io.IOException;
import java.io.StreamTokenizer;
import java.io.StringReader;
public class PR141 {
public static void test(String str) throws IOException {
StringReader reader = new StringReader(str);
StreamTokenizer st = new StreamTokenizer(reader);
int t = 0;
do {
t = st.nextToken();
switch (t) {
case StreamTokenizer.TT_WORD:
System.out.println("[TT_WORD]: " + st.sval);
break;
case StreamTokenizer.TT_NUMBER:
System.out.println("[TT_NUMBER]: " + st.nval);
break;
case StreamTokenizer.TT_EOL:
System.out.println("[TT_EOL]");
break;
case StreamTokenizer.TT_EOF:
System.out.println("[TT_EOF]");
break;
default:
System.out.println((char)t);
break;
}
} while (t != StreamTokenizer.TT_EOF);
}
public static void main(String[] args) {
try {
test("(a).(b)");
} catch (Throwable t) {
t.printStackTrace();
}
}
}