Class for a lexer used for implementing domain specific languages of strus.
More...
#include <programLexer.hpp>
Class for a lexer used for implementing domain specific languages of strus.
Enumerator |
---|
KeepStringEscaping |
|
strus::ProgramLexer::ProgramLexer |
( |
const char * |
src, |
|
|
const char * |
eolncomment_, |
|
|
const char ** |
tokens, |
|
|
const char ** |
errtokens, |
|
|
ErrorBufferInterface * |
errhnd_ |
|
) |
| |
Constructor.
- Parameters
-
[in] | src | pointer to source to parse |
[in] | eolncomment_ | operator used for comments (end of line comments) |
[in] | errtokens | illegal lexems defined as regular expressions (leading to a syntax error) |
[in] | tokens | lexems defined as regular expressions with the position in the array as associated id |
[in] | errhnd_ | error buffer interface to use for reporting errors |
strus::ProgramLexer::~ProgramLexer |
( |
| ) |
|
bool strus::ProgramLexer::consumeToken |
( |
int |
tokid | ) |
|
|
inline |
Skip to next and return true if the current lexem is a token with a defined id.
std::string strus::ProgramLexer::currentLocationString |
( |
int |
posincr, |
|
|
int |
size, |
|
|
const char * |
marker |
|
) |
| const |
Get an excerpt of the current source location starting from a position with a marker inserted.
- Parameters
-
[in] | posincr | increment of the current position to show |
[in] | marker | marker to insert in the result at the current position |
[in] | size | size of excerpt to show |
const char* strus::ProgramLexer::currentpos |
( |
| ) |
|
Get the start of the current token.
- Returns
- the position of the current token or NULL, if an error occurred or if we got to the end of source
std::size_t strus::ProgramLexer::len |
( |
| ) |
const |
|
inline |
Get the rest length to parse.
int strus::ProgramLexer::lineno |
( |
| ) |
const |
Get the current line number.
const char* strus::ProgramLexer::nextpos |
( |
| ) |
|
Get the start of the next token.
- Returns
- the position of the next token or NULL, if an error occurred or if we got to the end of source
const char* strus::ProgramLexer::pos |
( |
| ) |
const |
|
inline |
Get the current source pointer.
Rescan the current lexem (with different options)
bool strus::ProgramLexer::setOption |
( |
Option |
opt_, |
|
|
bool |
value |
|
) |
| |
Switch lexer option on/off.
- Parameters
-
[in] | opt | option identifier |
[in] | value | true=on, false=off |
- Returns
- previous option value
bool strus::ProgramLexer::skipto |
( |
char const * |
pos | ) |
|
Skip to a defined position is the parsed source and scan the next token.
- Parameters
-
[in] | pos | pointer to position to set scanner to for restart scanning |
The documentation for this class was generated from the following file: