Java Reference
In-Depth Information
The attribute file uses
'#'
to mark comments. Ignoring these comments,
the stream is searched for a string token followed by an optional
'='
followed by a word or number. Each such attribute is put into an
Attr
object, which is added to a set of attributes in an
AttributedImpl
object.
When the file has been parsed, the set of attributes is returned.
Setting the comment character to
'#'
sets its character class. The token-
izer recognizes several character classes that are set by the following
methods:
public void
wordChars(int low, int hi)
Characters in this range are word characters: They can be
part of a
TT_WORD
token. You can invoke this several times with
different ranges. A word consists of one or more characters
inside any of the legal ranges.
public void
whitespaceChars(int low, int hi)
Characters in this range are whitespace. Whitespace is ig-
nored, except to separate tokens such as two consecutive
words. As with the
wordChars
range, you can make several
invocations, and the union of the invocations is the set of
whitespace characters.
public void
ordinaryChars(int low, int hi)
Characters in this range are ordinary. An ordinary character
is returned as itself, not as a token. This removes any special
significance the characters may have had as comment char-
acters, delimiters, word components, whitespace, or number
characters. In the above example, we used
ordinaryChar
to re-
move the special comment significance of the
'/'
character.
public void
ordinaryChar(int ch)