#include <scripttokeniser.h>
Public Member Functions | |
ScriptTokeniser (TextInputStream &istream, bool special) | |
const std::string | getToken () |
void | ungetToken () |
std::size_t | getLine () const |
std::size_t | getColumn () const |
Private Types | |
enum | CharType { eWhitespace, eCharToken, eNewline, eCharQuote, eCharSolidus, eCharStar, eCharSpecial } |
typedef bool(ScriptTokeniser::* | Tokenise )(char c) |
Private Member Functions | |
CharType | charType (const char c) |
Tokenise | state () |
void | push (Tokenise state) |
void | pop () |
void | add (const char c) |
void | remove () |
bool | tokeniseDefault (char c) |
bool | tokeniseToken (char c) |
bool | tokeniseQuotedToken (char c) |
bool | tokeniseSolidus (char c) |
bool | tokeniseComment (char c) |
bool | tokeniseBlockComment (char c) |
bool | tokeniseEndBlockComment (char c) |
bool | tokeniseEndQuote (char c) |
bool | tokeniseSpecial (char c) |
bool | tokenise () |
Returns true if a token was successfully parsed. | |
const char * | fillToken () |
bool | eof () |
Private Attributes | |
Tokenise | m_stack [3] |
Tokenise * | m_state |
SingleCharacterInputStream < TextInputStream > | m_istream |
std::size_t | m_scriptline |
std::size_t | m_scriptcolumn |
char | m_token [MAXTOKEN] |
char * | m_write |
char | m_current |
bool | m_eof |
bool | m_unget |
bool | m_emit |
bool | m_special |
Definition at line 27 of file scripttokeniser.h.
typedef bool(ScriptTokeniser::* ScriptTokeniser::Tokenise)(char c) [private] |
Definition at line 34 of file scripttokeniser.h.
enum ScriptTokeniser::CharType [private] |
Definition at line 29 of file scripttokeniser.h.
ScriptTokeniser::ScriptTokeniser | ( | TextInputStream & | istream, | |
bool | special | |||
) | [inline] |
Definition at line 297 of file scripttokeniser.h.
References m_current, m_eof, m_istream, m_stack, m_token, MAXTOKEN, SingleCharacterInputStream< TextInputStreamType, SIZE >::readChar(), and tokeniseDefault().
void ScriptTokeniser::add | ( | const char | c | ) | [inline, private] |
Definition at line 94 of file scripttokeniser.h.
References m_token, m_write, and MAXTOKEN.
Referenced by fillToken(), tokeniseDefault(), tokeniseQuotedToken(), tokeniseSolidus(), and tokeniseToken().
CharType ScriptTokeniser::charType | ( | const char | c | ) | [inline, private] |
Definition at line 52 of file scripttokeniser.h.
References eCharQuote, eCharSolidus, eCharSpecial, eCharStar, eCharToken, eNewline, eWhitespace, and m_special.
Referenced by tokeniseDefault(), tokeniseQuotedToken(), tokeniseSolidus(), and tokeniseToken().
bool ScriptTokeniser::eof | ( | ) | [inline, private] |
const char* ScriptTokeniser::fillToken | ( | ) | [inline, private] |
Definition at line 281 of file scripttokeniser.h.
References add(), m_token, and tokenise().
Referenced by getToken().
std::size_t ScriptTokeniser::getColumn | ( | ) | const [inline, virtual] |
std::size_t ScriptTokeniser::getLine | ( | ) | const [inline, virtual] |
const std::string ScriptTokeniser::getToken | ( | ) | [inline, virtual] |
Implements Tokeniser.
Definition at line 306 of file scripttokeniser.h.
References fillToken(), m_token, m_unget, and string.
void ScriptTokeniser::pop | ( | ) | [inline, private] |
Definition at line 89 of file scripttokeniser.h.
References m_stack, and m_state.
Referenced by tokeniseBlockComment(), tokeniseComment(), tokeniseEndBlockComment(), tokeniseEndQuote(), tokeniseQuotedToken(), tokeniseSolidus(), tokeniseSpecial(), and tokeniseToken().
void ScriptTokeniser::push | ( | Tokenise | state | ) | [inline, private] |
Definition at line 84 of file scripttokeniser.h.
References m_stack, and m_state.
Referenced by tokeniseBlockComment(), tokeniseDefault(), tokeniseEndBlockComment(), tokeniseQuotedToken(), and tokeniseSolidus().
void ScriptTokeniser::remove | ( | ) | [inline, private] |
Definition at line 100 of file scripttokeniser.h.
Tokenise ScriptTokeniser::state | ( | ) | [inline, private] |
Definition at line 80 of file scripttokeniser.h.
References m_state.
Referenced by tokenise(), tokeniseComment(), and tokeniseEndBlockComment().
bool ScriptTokeniser::tokenise | ( | ) | [inline, private] |
Returns true if a token was successfully parsed.
Definition at line 253 of file scripttokeniser.h.
References eof(), m_current, m_emit, m_eof, m_istream, m_scriptcolumn, m_scriptline, m_token, m_write, SingleCharacterInputStream< TextInputStreamType, SIZE >::readChar(), and state().
Referenced by fillToken().
bool ScriptTokeniser::tokeniseBlockComment | ( | char | c | ) | [inline, private] |
Definition at line 212 of file scripttokeniser.h.
References pop(), push(), and tokeniseEndBlockComment().
Referenced by tokeniseEndBlockComment(), and tokeniseSolidus().
bool ScriptTokeniser::tokeniseComment | ( | char | c | ) | [inline, private] |
Definition at line 201 of file scripttokeniser.h.
References m_emit, pop(), state(), and tokeniseToken().
Referenced by tokeniseSolidus().
bool ScriptTokeniser::tokeniseDefault | ( | char | c | ) | [inline, private] |
Definition at line 106 of file scripttokeniser.h.
References add(), charType(), eCharQuote, eCharSolidus, eCharSpecial, eCharStar, eCharToken, eNewline, push(), tokeniseQuotedToken(), tokeniseSolidus(), tokeniseSpecial(), and tokeniseToken().
Referenced by ScriptTokeniser().
bool ScriptTokeniser::tokeniseEndBlockComment | ( | char | c | ) | [inline, private] |
Definition at line 220 of file scripttokeniser.h.
References m_emit, pop(), push(), state(), tokeniseBlockComment(), and tokeniseToken().
Referenced by tokeniseBlockComment().
bool ScriptTokeniser::tokeniseEndQuote | ( | char | c | ) | [inline, private] |
Definition at line 239 of file scripttokeniser.h.
Referenced by tokeniseQuotedToken().
bool ScriptTokeniser::tokeniseQuotedToken | ( | char | c | ) | [inline, private] |
Definition at line 151 of file scripttokeniser.h.
References add(), charType(), eCharQuote, eCharSolidus, eCharSpecial, eCharStar, eCharToken, eNewline, eWhitespace, pop(), push(), and tokeniseEndQuote().
Referenced by tokeniseDefault().
bool ScriptTokeniser::tokeniseSolidus | ( | char | c | ) | [inline, private] |
Definition at line 172 of file scripttokeniser.h.
References add(), charType(), eCharQuote, eCharSolidus, eCharSpecial, eCharStar, eCharToken, eNewline, eWhitespace, m_emit, pop(), push(), tokeniseBlockComment(), and tokeniseComment().
Referenced by tokeniseDefault().
bool ScriptTokeniser::tokeniseSpecial | ( | char | c | ) | [inline, private] |
Definition at line 245 of file scripttokeniser.h.
Referenced by tokeniseDefault().
bool ScriptTokeniser::tokeniseToken | ( | char | c | ) | [inline, private] |
Definition at line 131 of file scripttokeniser.h.
References add(), charType(), eCharQuote, eCharSolidus, eCharSpecial, eCharStar, eCharToken, eNewline, eWhitespace, m_emit, and pop().
Referenced by tokeniseComment(), tokeniseDefault(), and tokeniseEndBlockComment().
void ScriptTokeniser::ungetToken | ( | ) | [inline, virtual] |
char ScriptTokeniser::m_current [private] |
Definition at line 45 of file scripttokeniser.h.
Referenced by ScriptTokeniser(), and tokenise().
bool ScriptTokeniser::m_emit [private] |
Definition at line 48 of file scripttokeniser.h.
Referenced by tokenise(), tokeniseComment(), tokeniseEndBlockComment(), tokeniseEndQuote(), tokeniseSolidus(), tokeniseSpecial(), and tokeniseToken().
bool ScriptTokeniser::m_eof [private] |
Definition at line 46 of file scripttokeniser.h.
Referenced by eof(), ScriptTokeniser(), and tokenise().
Definition at line 38 of file scripttokeniser.h.
Referenced by ScriptTokeniser(), and tokenise().
std::size_t ScriptTokeniser::m_scriptcolumn [private] |
Definition at line 40 of file scripttokeniser.h.
Referenced by getColumn(), and tokenise().
std::size_t ScriptTokeniser::m_scriptline [private] |
Definition at line 39 of file scripttokeniser.h.
Referenced by getLine(), and tokenise().
bool ScriptTokeniser::m_special [private] |
Definition at line 50 of file scripttokeniser.h.
Referenced by charType().
Tokenise ScriptTokeniser::m_stack[3] [private] |
Definition at line 36 of file scripttokeniser.h.
Referenced by pop(), push(), and ScriptTokeniser().
Tokenise* ScriptTokeniser::m_state [private] |
Definition at line 37 of file scripttokeniser.h.
char ScriptTokeniser::m_token[MAXTOKEN] [private] |
Definition at line 42 of file scripttokeniser.h.
Referenced by add(), fillToken(), getToken(), remove(), ScriptTokeniser(), and tokenise().
bool ScriptTokeniser::m_unget [private] |
Definition at line 47 of file scripttokeniser.h.
Referenced by getToken(), and ungetToken().
char* ScriptTokeniser::m_write [private] |
Definition at line 43 of file scripttokeniser.h.
Referenced by add(), remove(), and tokenise().