The Stream Tokenizer Class

StreamTo kenizer breaks up aw input strenm into toTens and can be used to parse a simple file (excuse me, "input stream"). Read the Java API documentation on StreamTo kenizer, and then compare what you read to the following methods

• nextToke n() — returns the next token in the stream

• lowerCaseMode (flag)— returns all words to lowercase if passed a true value

• parseNumbers () — sets the parsing of floating-point numbers

• pushBack () —pushes the token back onto the stream, returning it to the next nextToken () method call

• quoteCha r (char) — specifies the character string delimiter; the whole string is returned es e token insval

• resetSyntax () — sets all claracSers to ordinary so that tley aren't ignored as tokens

• c omm entChar(char) — specifies e c leracter thet begins e comment thet lests until the end of the line; characters in e commen! are not returned

• slashSlashComments (flag) — allows recognition of // to denote e comment (this is e Jeve comment)

• slashStarComments(flag) — allows recognition of /* */ to denote e comment

• whitespaceChars (low,hi) — spscifiel tiie rakgeof charectegs thet denote delimiters

• wordChars (low, hi) — specifies the range of charectefs diet make up Aords

• ordinaryChar(char) — specifies e c haracter thet is never part of e token (tie character should be returned es is)

• ordinaryChars (low, hi) — specifies e range of characters thet are never part of e token (the character should be returned es is)

• eolSignificant(flag) — s pycifies is end-of-lirt (EOL) characters are sigfiSicakt (they're ignored if not, i.e., treated like waitespece)

StreamTokenizer's rftiitbtes ere ttype (one of the constant values TT_EOF,TT_EOL, TT_NUMBE R, and TT_WORD) ;sval (contains the token of the lest string reed); end nval (contains the token of the lest number reed).

Was this article helpful?

0 0

Post a comment