Name: vi73552 Date: 05/18/99
StreamTokenizer does not support quoted strings over multiple lines.
I know that the Java Language Specification says that '\r' and '\n' delimits a qouted string but I am using StreamTokenizer to parse a MIB file where a string can fill several lines.
I would like an option to support quoted strings over multiple lines.
See also bug report 4028917 where you'll find further description.
-------------------------------------------------------------
When parsing a quoted string that bridges multiple lines with
end of line not significant (eolIsSignificant() = false),
nextToken returns only the substring ont he first line in
the sval variable. For example, when reading the following
line from a file:
"This is a long quoted string in a file that bridges
multiple lines and should be returned as a single quoted
word token by nextToken when eol is not significant."
The following is returned in sval:
sval = This is a long quoted string in a file that bridges
Given that end of lines are not significant according to the
eolIsSignificant() setting of false, this is incorrect. The
entire quoted string including the eol character(s) should
be returned in sval in this case.
The problem is due to line 356 in StreamTokenizer.nextToken:
while ((c = is.read()) >= 0 && c != ttype && c != '\n' && c != '\r') {
The entire string between quotes is returned properly when
this line is modified as follows:
while ((c = is.read()) >= 0 && c != ttype) {
The latter form should be used when eolIsSignificant() = false
and the former (current) form when eolIsSignificant = true.
(Review ID: 83190)
======================================================================