Lexical analyzer used for splitting lexical symbols from input 'stream'. More...
#include <parser.h>
Public Types | |
typedef QMap< QString, VaucansonKeywords::Token > | TKeywordMap |
Public Member Functions | |
LexAn () | |
~LexAn () | |
int | getLineNumber () |
returns current line number | |
VaucansonKeywords::Token | getToken () |
returns last readed token | |
QString | getTokenData () |
returns token data | |
bool | openFile (const QString &fn) |
opens input file, returns false if opening fails | |
QString | readStringBetween (const QChar &opening, const QChar &closing, bool allowMatching=true) |
VaucansonKeywords::Token | readToken () |
reads single new token | |
Static Public Member Functions | |
static void | initialize () |
Static Public Attributes | |
static TKeywordMap | keywordMap |
Private Member Functions | |
bool | isAllowed (char character) |
VaucansonKeywords::Token | keyWordTest (const QString &tokenData) |
char | readChar () |
Private Attributes | |
unsigned char | character |
bool | fileOpened |
QFile * | inFile |
char | input |
char | line [1024] |
int | lineIndex |
int | lineLength |
int | lineNumber |
VaucansonKeywords::Token | token |
QString | tokenData |
Lexical analyzer used for splitting lexical symbols from input 'stream'.
Definition at line 63 of file parser.h.
typedef QMap<QString, VaucansonKeywords::Token> LexAn::TKeywordMap |
LexAn::LexAn | ( | ) |
Definition at line 143 of file parser.cpp.
References initialize().
LexAn::~LexAn | ( | ) |
Definition at line 148 of file parser.cpp.
References inFile.
int LexAn::getLineNumber | ( | ) |
returns current line number
Definition at line 432 of file parser.cpp.
References lineNumber.
Referenced by Parser::ChgParam(), Parser::Element(), Parser::EndTransitionDeclaration(), Parser::errorReportUTOKEN(), Parser::FillStatus(), Parser::Label_r(), Parser::LineStyle(), Parser::Name(), Parser::Numb(), Parser::NumberNextPart(), Parser::OneStateTransition(), Parser::run(), Parser::StateDeclaration(), Parser::Switch(), and Parser::VCPut().
Token LexAn::getToken | ( | ) |
returns last readed token
Definition at line 427 of file parser.cpp.
References token.
Referenced by Parser::Arc(), Parser::ChgParam(), Parser::Color(), Parser::Dir(), Parser::DirParam(), Parser::Edge(), Parser::Element(), Parser::FillStatus(), Parser::Label_r(), Parser::LineStyle(), Parser::Loop(), Parser::matching(), Parser::NameAllowedToken(), Parser::NameNextPart(), Parser::NoBracesToken(), Parser::NoBracketsToken(), Parser::Numb(), Parser::NumberNextPart(), Parser::OneStateTransition(), Parser::Pos(), Parser::PosParam(), Parser::Predeclaration(), Parser::Sign(), Parser::State_r(), Parser::StateDeclaration(), Parser::Switch(), Parser::Transition_r(), Parser::TwoStateTransition(), Parser::VArc(), Parser::VArcParam(), Parser::VArcParamIdent(), Parser::VArcParamNext(), Parser::VCPicture(), Parser::VCPut(), Parser::VCurve(), Parser::VCurveParam(), Parser::VCurveParamIdent(), and Parser::VCurveParamNext().
QString LexAn::getTokenData | ( | ) |
returns token data
Definition at line 422 of file parser.cpp.
References tokenData.
Referenced by Parser::ChgParam(), Parser::Color(), Parser::Dir(), Parser::errorReportUTOKEN(), Parser::FillStatus(), Parser::LineStyle(), Parser::NameAllowedToken(), Parser::NoBracesToken(), Parser::NoBracketsToken(), Parser::Numb(), Parser::NumberNextPart(), Parser::OneStateTransition(), Parser::State_r(), Parser::Switch(), Parser::VArcParamIdent(), Parser::VCPicture(), and Parser::VCurveParamIdent().
void LexAn::initialize | ( | ) | [static] |
Definition at line 40 of file parser.cpp.
References ADD_KEYWORD, VaucansonKeywords::chgEdgeLabelColor, VaucansonKeywords::chgEdgeLabelScale, VaucansonKeywords::chgEdgeLineColor, VaucansonKeywords::chgEdgeLineStyle, VaucansonKeywords::chgEdgeLineWidth, VaucansonKeywords::chgStateFillColor, VaucansonKeywords::chgStateFillStatus, VaucansonKeywords::chgStateLabelColor, VaucansonKeywords::chgStateLabelScale, VaucansonKeywords::chgStateLineColor, VaucansonKeywords::chgStateLineStyle, VaucansonKeywords::chgStateLineWidth, VaucansonKeywords::fixDimEdge, VaucansonKeywords::fixDimState, VaucansonKeywords::fixEdgeBorder, VaucansonKeywords::fixEdgeLineDouble, VaucansonKeywords::fixStateLineDouble, keywordMap, VaucansonKeywords::kwArcL, VaucansonKeywords::kwArcR, VaucansonKeywords::kwBegin, VaucansonKeywords::kwCLoopE, VaucansonKeywords::kwCLoopN, VaucansonKeywords::kwCLoopNE, VaucansonKeywords::kwCLoopNW, VaucansonKeywords::kwCLoopS, VaucansonKeywords::kwCLoopSE, VaucansonKeywords::kwCLoopSW, VaucansonKeywords::kwCLoopW, VaucansonKeywords::kwDimEdge, VaucansonKeywords::kwDimState, VaucansonKeywords::kwEdgeBorder, VaucansonKeywords::kwEdgeBorderOff, VaucansonKeywords::kwEdgeL, VaucansonKeywords::kwEdgeLineDouble, VaucansonKeywords::kwEdgeLineSimple, VaucansonKeywords::kwEdgeR, VaucansonKeywords::kwEnd, VaucansonKeywords::kwFinal, VaucansonKeywords::kwFinalState, VaucansonKeywords::kwFinalStateVar, VaucansonKeywords::kwHideFrame, VaucansonKeywords::kwHideGrid, VaucansonKeywords::kwInitial, VaucansonKeywords::kwLabelL, VaucansonKeywords::kwLabelR, VaucansonKeywords::kwLArcL, VaucansonKeywords::kwLArcR, VaucansonKeywords::kwLoopE, VaucansonKeywords::kwLoopN, VaucansonKeywords::kwLoopNE, VaucansonKeywords::kwLoopNW, VaucansonKeywords::kwLoopS, VaucansonKeywords::kwLoopSE, VaucansonKeywords::kwLoopSW, VaucansonKeywords::kwLoopVarN, VaucansonKeywords::kwLoopVarS, VaucansonKeywords::kwLoopW, VaucansonKeywords::kwRstEdge, VaucansonKeywords::kwRstState, VaucansonKeywords::kwShowFrame, VaucansonKeywords::kwShowGrid, VaucansonKeywords::kwState, VaucansonKeywords::kwStateLineDouble, VaucansonKeywords::kwStateLineSimple, VaucansonKeywords::kwStateVar, VaucansonKeywords::kwVArcL, VaucansonKeywords::kwVArcR, VaucansonKeywords::kwVarLoopOff, VaucansonKeywords::kwVarLoopOn, VaucansonKeywords::kwVCPut, VaucansonKeywords::kwVCurveL, VaucansonKeywords::kwVCurveR, VaucansonKeywords::rstEdgeLabelColor, VaucansonKeywords::rstEdgeLabelScale, VaucansonKeywords::rstEdgeLineColor, VaucansonKeywords::rstEdgeLineStyle, VaucansonKeywords::rstEdgeLineWidth, VaucansonKeywords::rstStateFillColor, VaucansonKeywords::rstStateFillStatus, VaucansonKeywords::rstStateLabelColor, VaucansonKeywords::rstStateLabelScale, VaucansonKeywords::rstStateLineColor, VaucansonKeywords::rstStateLineStyle, VaucansonKeywords::rstStateLineWidth, VaucansonKeywords::setEdgeLabelColor, VaucansonKeywords::setEdgeLabelScale, VaucansonKeywords::setEdgeLineColor, VaucansonKeywords::setEdgeLineStyle, VaucansonKeywords::setEdgeLineWidth, VaucansonKeywords::setStateFillColor, VaucansonKeywords::setStateFillStatus, VaucansonKeywords::setStateLabelColor, VaucansonKeywords::setStateLabelScale, VaucansonKeywords::setStateLineColor, VaucansonKeywords::setStateLineStyle, and VaucansonKeywords::setStateLineWidth.
Referenced by LexAn().
bool LexAn::isAllowed | ( | char | character | ) | [private] |
Token LexAn::keyWordTest | ( | const QString & | tokenData | ) | [private] |
Definition at line 412 of file parser.cpp.
References DBGLOG_LEX, and keywordMap.
Referenced by readToken().
bool LexAn::openFile | ( | const QString & | fn | ) |
opens input file, returns false if opening fails
Definition at line 157 of file parser.cpp.
References DBGLOG_LEX, fileOpened, and inFile.
Referenced by Parser::run().
char LexAn::readChar | ( | ) | [private] |
Definition at line 171 of file parser.cpp.
References character, inFile, input, line, lineIndex, lineLength, and lineNumber.
Referenced by readStringBetween(), and readToken().
QString LexAn::readStringBetween | ( | const QChar & | opening, | |
const QChar & | closing, | |||
bool | allowMatching = true | |||
) |
reads string between characters pair, if allowMatching is false, first closing character stops reading, otherwise balances matching is used never call matching on opening character, but ever call matching to closing character!
Definition at line 208 of file parser.cpp.
References character, input, readChar(), RELLOG, token, and tokenData.
Referenced by Parser::StateLabel(), Parser::TransitionLabel(), and Parser::VCPut().
Token LexAn::readToken | ( | ) |
reads single new token
Definition at line 249 of file parser.cpp.
References character, DBGLOG_LEX, VaucansonKeywords::ERR, fileOpened, input, keyWordTest(), VaucansonKeywords::kwBegin, readChar(), token, and tokenData.
Referenced by Parser::Element(), Parser::matching(), Parser::Numb(), Parser::Predeclaration(), and Parser::run().
unsigned char LexAn::character [private] |
Definition at line 94 of file parser.h.
Referenced by readChar(), readStringBetween(), and readToken().
bool LexAn::fileOpened [private] |
Definition at line 91 of file parser.h.
Referenced by openFile(), and readToken().
QFile* LexAn::inFile [private] |
Definition at line 90 of file parser.h.
Referenced by openFile(), readChar(), and ~LexAn().
char LexAn::input [private] |
Definition at line 93 of file parser.h.
Referenced by readChar(), readStringBetween(), and readToken().
LexAn::TKeywordMap LexAn::keywordMap [static] |
Definition at line 67 of file parser.h.
Referenced by initialize(), and keyWordTest().
char LexAn::line[1024] [private] |
Definition at line 96 of file parser.h.
Referenced by readChar().
int LexAn::lineIndex [private] |
Definition at line 97 of file parser.h.
Referenced by readChar().
int LexAn::lineLength [private] |
Definition at line 98 of file parser.h.
Referenced by readChar().
int LexAn::lineNumber [private] |
Definition at line 95 of file parser.h.
Referenced by getLineNumber(), and readChar().
VaucansonKeywords::Token LexAn::token [private] |
Definition at line 99 of file parser.h.
Referenced by getToken(), readStringBetween(), and readToken().
QString LexAn::tokenData [private] |
Definition at line 100 of file parser.h.
Referenced by getTokenData(), readStringBetween(), and readToken().