JavaCC [tm]: CharStream Classes MiniTutorial

This document describes in some detail the methods of the CharStream classes. Note that some of the details may not be relevant for the CharStream interface (to be used with USER_CHAR_STREAM).

There are 4 different kinds of char stream classes that are generated based on combinations of various options.

Note : None of the above classes can be used to read characters in a mixed mode, i.e., some characters given as 1-byte characters and others as 2-byte characters. To do this, you need to set USER_CHAR_STREAM option to true and define your own char stream.


(Throughout the following, we use the notation XXXCharStream that stands for any of the above described 4 classes.)

Constructors


Methods

All the following methods will be static or nonstatic depending on whether the STATIC option is true or false at the generation time. Also only those methods that users can use in their lexical actions (using the input_stream variable of the lexical analyzer) are documented here. Rest of the (public) methods are very tightly coupled with the implementation of the lexical analyzer and thus should not be used in lexical actions. In the future when we adopt version 1.1 of the Java [tm] programming language, we will streamline this by making that part of the interface an innerclass to the lexical analyzer.