Zen
A cross-platform functional programming language
|
Class for scanning the input stream and feeding into the lexer. More...
#include <Scanner.hpp>
Classes | |
class | cursor |
Class for maintaining cursor in input stream. More... | |
Public Member Functions | |
Scanner (z::stream &stream) | |
Default constructor. | |
const z::string & | getString () const |
Get current string. | |
const int & | getLine () const |
Get current line number. | |
const int & | getCol () const |
Get current column number. | |
z::string | getToken () |
Get current token. | |
Token | createToken (const int &id, const z::string &s, const bool &hidden) |
Create token. | |
Token | createToken (const int &id, const bool &hidden) |
Create token. | |
Token | createQuotedToken (const int &id, const bool &hidden) |
Create token, eliminate first and last char, so "xyz" becomes xyz. | |
Token | createTrimmedToken (const int &id, const bool &hidden) |
Create token, eliminate first char, e.g. @id becomes id. | |
Public Attributes | |
cursor | start |
start cursor | |
cursor | marker |
position marker cursor | |
cursor | end |
end cursor | |
Private Member Functions | |
int | read () |
Read one character from the input stream. | |
int | get (const int &pos) |
Get current character that has been read from the input stream. | |
bool | next () |
Advance input stream. | |
z::string | resetToken () |
Reset the token data. | |
Private Attributes | |
z::stream & | _stream |
Input stream. | |
z::queue< int > | _queue |
Input queue. | |
z::string | _string |
Current string. | |
int | _ch |
Current character. | |
int | _tokenPos |
Current token position. | |
int | _npos |
Previous position. | |
int | _line |
row number of current character | |
int | _col |
column number of current character read | |
int | _ccol |
column number of start of current token | |
int | _tcol |
column number of start of token |
Class for scanning the input stream and feeding into the lexer.
Token createQuotedToken | ( | const int & | id, |
const bool & | hidden | ||
) | [inline] |
Create token, eliminate first and last char, so "xyz" becomes xyz.
id | ID for token |
hidden | True if this is a hidden token |
Token createToken | ( | const int & | id, |
const bool & | hidden | ||
) | [inline] |
Create token.
id | ID for token |
hidden | True if this is a hidden token |
Token createTrimmedToken | ( | const int & | id, |
const bool & | hidden | ||
) | [inline] |
Create token, eliminate first char, e.g. @id becomes id.
id | ID for token |
hidden | True if this is a hidden token |
int get | ( | const int & | pos | ) | [inline, private] |
Get current character that has been read from the input stream.
pos | The current position |
const int& getCol | ( | ) | const [inline] |
Get current column number.
const int& getLine | ( | ) | const [inline] |
Get current line number.
const z::string& getString | ( | ) | const [inline] |
Get current string.
z::string getToken | ( | ) | [inline] |
Get current token.
bool next | ( | ) | [inline, private] |
Advance input stream.
int read | ( | ) | [inline, private] |
Read one character from the input stream.
z::string resetToken | ( | ) | [inline, private] |
Reset the token data.