aboutsummaryrefslogtreecommitdiff
path: root/libjava
diff options
context:
space:
mode:
authorOskar Liljeblad <osk@hem.passagen.se>2001-01-09 12:21:12 +0100
committerWarren Levy <warrenl@gcc.gnu.org>2001-01-09 11:21:12 +0000
commit10a855c7f4b3347a55198395ff12f8847f0c33c6 (patch)
treefea566a4cc1e53463bd374ccc3a5e377e5076266 /libjava
parent9f56ed15ce8b4fbacd1a4e1474cca34761ad8f0f (diff)
downloadgcc-10a855c7f4b3347a55198395ff12f8847f0c33c6.zip
gcc-10a855c7f4b3347a55198395ff12f8847f0c33c6.tar.gz
gcc-10a855c7f4b3347a55198395ff12f8847f0c33c6.tar.bz2
re PR libgcj/1338 (StreamTokenizer does not handle /* comments correctly)
2001-01-09 Oskar Liljeblad <osk@hem.passagen.se> Fix for PR libgcj/1338: * java/io/StreamTokenizer.java (nextToken): Handle // and /* before commentChar. Fixed typos in comments. From-SVN: r38830
Diffstat (limited to 'libjava')
-rw-r--r--libjava/ChangeLog6
-rw-r--r--libjava/java/io/StreamTokenizer.java98
2 files changed, 55 insertions, 49 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index 22d7826..880d2d7 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,9 @@
+2001-01-09 Oskar Liljeblad <osk@hem.passagen.se>
+
+ Fix for PR libgcj/1338:
+ * java/io/StreamTokenizer.java (nextToken): Handle // and /* before
+ commentChar. Fixed typos in comments.
+
2001-01-08 Warren Levy <warrenl@redhat.com>
Fix for PR libgcj/1411:
diff --git a/libjava/java/io/StreamTokenizer.java b/libjava/java/io/StreamTokenizer.java
index b3c8003..347f193 100644
--- a/libjava/java/io/StreamTokenizer.java
+++ b/libjava/java/io/StreamTokenizer.java
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999, 2000 Free Software Foundation
+/* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation
This file is part of libgcj.
@@ -231,7 +231,7 @@ public class StreamTokenizer
* The start of a comment also terminates a word. Any character with a
* non-alphabetic and non-numeric attribute (such as white space, a quote,
* or a commet) are treated as non-alphabetic and terminate the word.
- * <li>If a comment charcters is parsed, then all remaining characters on
+ * <li>If a comment character is parsed, then all remaining characters on
* the current line are skipped and another token is parsed. Any EOL or
* EOF's encountered are not discarded, but rather terminate the comment.
* <li>If a quote character is parsed, then all characters up to the
@@ -289,6 +289,50 @@ public class StreamTokenizer
return (ttype = TT_EOL);
}
+ if (ch == '/')
+ if ((ch = in.read()) == '/' && slashSlash)
+ {
+ while ((ch = in.read()) != '\n' && ch != '\r' && ch != TT_EOF)
+ ;
+ if (ch != TT_EOF)
+ in.unread(ch);
+ return nextToken(); // Recursive, but not too deep in normal cases
+ }
+ else if (ch == '*' && slashStar)
+ {
+ while (true)
+ {
+ ch = in.read();
+ if (ch == '*')
+ {
+ if ((ch = in.read()) == '/')
+ break;
+ else if (ch != TT_EOF)
+ in.unread(ch);
+ }
+ else if (ch == '\n' || ch == '\r')
+ {
+ lineNumber++;
+ if (ch == '\r' && (ch = in.read()) != '\n')
+ {
+ if (ch != TT_EOF)
+ in.unread(ch);
+ }
+ }
+ else if (ch == TT_EOF)
+ {
+ break;
+ }
+ }
+ return nextToken(); // Recursive, but not too deep in normal cases
+ }
+ else
+ {
+ if (ch != TT_EOF)
+ in.unread(ch);
+ ch = '/';
+ }
+
if (ch == TT_EOF)
ttype = TT_EOF;
else if (isNumeric(ch))
@@ -419,50 +463,6 @@ public class StreamTokenizer
}
else
{
- if (ch == '/')
- if ((ch = in.read()) == '/' && slashSlash)
- {
- while ((ch = in.read()) != '\n' && ch != '\r' && ch != TT_EOF)
- ;
- if (ch != TT_EOF)
- in.unread(ch);
- return nextToken(); // Recursive, but not too deep in normal cases
- }
- else if (ch == '*' && slashStar)
- {
- while (true)
- {
- ch = in.read();
- if (ch == '*')
- {
- if ((ch = in.read()) == '/')
- break;
- else if (ch != TT_EOF)
- in.unread(ch);
- }
- else if (ch == '\n' || ch == '\r')
- {
- lineNumber++;
- if (ch == '\r' && (ch = in.read()) != '\n')
- {
- if (ch != TT_EOF)
- in.unread(ch);
- }
- }
- else if (ch == TT_EOF)
- {
- break;
- }
- }
- return nextToken(); // Recursive, but not too deep in normal cases
- }
- else
- {
- if (ch != TT_EOF)
- in.unread(ch);
- ch = '/';
- }
-
ttype = ch;
}
@@ -481,7 +481,7 @@ public class StreamTokenizer
* quote, or comment) will be set on this character. This character will
* parse as its own token.
*
- * @param c The charcter to make ordinary, passed as an int
+ * @param c The character to make ordinary, passed as an int
*/
public void ordinaryChar(int ch)
{
@@ -626,7 +626,7 @@ public class StreamTokenizer
}
/**
- * This method sets the whitespace attribute for all charcters in the
+ * This method sets the whitespace attribute for all characters in the
* specified range, range terminators included.
*
* @param low The low end of the range of values to set the whitespace
@@ -645,7 +645,7 @@ public class StreamTokenizer
}
/**
- * This method sets the alphabetic attribute for all charcters in the
+ * This method sets the alphabetic attribute for all characters in the
* specified range, range terminators included.
*
* @param low The low end of the range of values to set the alphabetic