template<typename Ch>
class fcppt::parse::basic_stream< Ch >
The stream class used while parsing.
This class is the base class for all input streams. Semantically, a basic_stream
points to an index 0 <= i <= n in a string a_1...a_n
of type vector<Ch>
. This index is before the next character that will be read, or in case i = n the end of the string is reached.
The position of a stream is an index plus the current line number l and column number c. These can be obtained as follows:
-
The current line number l is the number of newline characters plus one between c_1 and c_i (inclusive).
-
Let j <= i be the last newline character, or j=0 in case this does not exist. Then the current column number is c = i - j + 1.
An actual implementation would keep track of these numbers when get_char
and set_position
are called. This is also the reason why std::basic_istream
is not used, since implementing this with streambufs alone is impossible.