Java Reference
In-Depth Information
Equivalent to
ordinaryChars(ch,ch)
.
public void
commentChar(int ch)
The character
ch
starts a single-line commentcharacters after
ch
up to the next end-of-line are treated as one run of
whitespace.
public void
quoteChar(int ch)
Matching pairs of the character
ch
delimit
String
constants.
When a
String
constant is recognized, the character
ch
is re-
turned as the token, and the field
sval
contains the body
of the string with surrounding
ch
characters removed. When
string constants are read, some of the standard
\
processing
is applied (for example,
\t
can be in the string). The string
processing in
StreamTokenizer
is a subset of the language's
strings. In particular, you cannot use
\u
xxxx
,
\'
,
\"
, or (un-
fortunately)
\Q
, where
Q
is the quote character
ch
. You can
have more than one quote character at a time on a stream,
but strings must start and end with the same quote character.
In other words, a string that starts with one quote character
ends when the next instance of that same quote character is
found. If a different quote character is found in between, it is
simply part of the string.
public void
parseNumbers()
Specifies that numbers should be parsed as double-precision
floating-point numbers. When a number is found, the stream
returns a type of
TT_NUMBER
, leaving the value in
nval
. There
is no way to turn off just this featureto turn it off you must
either invoke
ordinaryChars
for all the number-related charac-
ters (don't forget the decimal point and minus sign) or invoke
resetSyntax
.
public void
resetSyntax()