KiCad PCB EDA Suite
|
#include <libeval_compiler.h>
Public Member Functions | |
COMPILER () | |
virtual | ~COMPILER () |
void | Clear () |
void | parseError (const char *s) |
void | parseOk () |
int | GetSourcePos () const |
void | setRoot (LIBEVAL::TREE_NODE *root) |
void | freeTree (LIBEVAL::TREE_NODE *tree) |
bool | Compile (const wxString &aString, UCODE *aCode, CONTEXT *aPreflightContext) |
void | SetErrorCallback (std::function< void(const wxString &aMessage, int aOffset)> aCallback) |
bool | IsErrorPending () const |
const ERROR_STATUS & | GetError () const |
void | GcItem (TREE_NODE *aItem) |
void | GcItem (wxString *aItem) |
Protected Types | |
enum | LEXER_STATE { LS_DEFAULT = 0 , LS_STRING = 1 } |
Protected Member Functions | |
bool | generateUCode (UCODE *aCode, CONTEXT *aPreflightContext) |
void | reportError (COMPILATION_STAGE stage, const wxString &aErrorMsg, int aPos=-1) |
void | newString (const wxString &aString) |
T_TOKEN | getToken () |
bool | lexDefault (T_TOKEN &aToken) |
bool | lexString (T_TOKEN &aToken) |
int | resolveUnits () |
Protected Attributes | |
LEXER_STATE | m_lexerState |
void * | m_parser |
TOKENIZER | m_tokenizer |
char | m_localeDecimalSeparator |
std::unique_ptr< UNIT_RESOLVER > | m_unitResolver |
int | m_sourcePos |
bool | m_parseFinished |
ERROR_STATUS | m_errorStatus |
std::function< void(const wxString &aMessage, int aOffset)> | m_errorCallback |
TREE_NODE * | m_tree |
std::vector< TREE_NODE * > | m_gcItems |
std::vector< wxString * > | m_gcStrings |
Definition at line 499 of file libeval_compiler.h.
|
protected |
Enumerator | |
---|---|
LS_DEFAULT | |
LS_STRING |
Definition at line 534 of file libeval_compiler.h.
LIBEVAL::COMPILER::COMPILER | ( | ) |
Definition at line 254 of file libeval_compiler.cpp.
References m_errorStatus, m_localeDecimalSeparator, m_parseFinished, m_parser, m_sourcePos, m_tree, m_unitResolver, and LIBEVAL::ERROR_STATUS::pendingError.
|
virtual |
Definition at line 267 of file libeval_compiler.cpp.
References Clear(), freeTree(), m_parser, and m_tree.
void LIBEVAL::COMPILER::Clear | ( | ) |
Definition at line 284 of file libeval_compiler.cpp.
References LIBEVAL::TOKENIZER::Clear(), freeTree(), m_gcItems, m_gcStrings, m_tokenizer, and m_tree.
Referenced by newString(), and ~COMPILER().
bool LIBEVAL::COMPILER::Compile | ( | const wxString & | aString, |
UCODE * | aCode, | ||
CONTEXT * | aPreflightContext | ||
) |
Definition at line 320 of file libeval_compiler.cpp.
References LIBEVAL::defaultToken, freeTree(), GcItem(), generateUCode(), LIBEVAL::TOKENIZER::GetPos(), getToken(), libeval_dbg, m_errorStatus, m_parseFinished, m_parser, m_sourcePos, m_tokenizer, m_tree, newString(), LIBEVAL::ERROR_STATUS::pendingError, LIBEVAL::T_TOKEN_VALUE::str, LIBEVAL::T_TOKEN::token, and LIBEVAL::T_TOKEN::value.
Referenced by DRC_RULE_CONDITION::Compile(), PCBEXPR_EVALUATOR::Evaluate(), MULTICHANNEL_TOOL::findOtherItemsInRuleArea(), MULTICHANNEL_TOOL::findRoutedConnections(), MULTICHANNEL_TOOL::identifyComponentsInRuleArea(), and testEvalExpr().
void LIBEVAL::COMPILER::freeTree | ( | LIBEVAL::TREE_NODE * | tree | ) |
Definition at line 708 of file libeval_compiler.cpp.
References freeTree(), LIBEVAL::TREE_NODE::leaf, and LIBEVAL::TREE_NODE::uop.
Referenced by Clear(), Compile(), freeTree(), and ~COMPILER().
|
inline |
Definition at line 530 of file libeval_compiler.h.
Referenced by Compile(), and LIBEVAL::newNode().
|
inline |
Definition at line 531 of file libeval_compiler.h.
Definition at line 813 of file libeval_compiler.cpp.
References _, LIBEVAL::UCODE::AddOp(), LIBEVAL::CONTEXT::AllocValue(), LIBEVAL::UCODE::CreateFuncCall(), LIBEVAL::UCODE::CreateVarRef(), LIBEVAL::CST_CODEGEN, EDA_UNIT_UTILS::UI::DoubleValueFromString(), LIBEVAL::UCODE::Dump(), dump(), LIBEVAL::dumpNode(), LIBEVAL::formatNode(), LIBEVAL::T_TOKEN_VALUE::idx, LIBEVAL::TREE_NODE::isTerminal, LIBEVAL::TREE_NODE::isVisited, LIBEVAL::TREE_NODE::leaf, libeval_dbg, m_tree, m_unitResolver, LIBEVAL::TREE_NODE::op, LIBEVAL::CONTEXT::Pop(), LIBEVAL::prepareTree(), LIBEVAL::CONTEXT::Push(), reportError(), LIBEVAL::VALUE::Set(), LIBEVAL::CONTEXT::SetErrorCallback(), LIBEVAL::TREE_NODE::SetUop(), LIBEVAL::squashParamList(), LIBEVAL::TREE_NODE::srcPos, LIBEVAL::T_TOKEN_VALUE::str, LIBEVAL::TR_IDENTIFIER, LIBEVAL::TR_NUMBER, TR_OP_FUNC_CALL, TR_OP_METHOD_CALL, LIBEVAL::TR_STRING, LIBEVAL::TR_STRUCT_REF, LIBEVAL::TR_UNIT, TR_UOP_PUSH_VALUE, TR_UOP_PUSH_VAR, LIBEVAL::TREE_NODE::uop, LIBEVAL::TREE_NODE::value, and LIBEVAL::VT_PARSE_ERROR.
Referenced by Compile().
|
inline |
Definition at line 528 of file libeval_compiler.h.
Referenced by testEvalExpr().
|
inline |
Definition at line 515 of file libeval_compiler.h.
Referenced by LIBEVAL::newNode().
|
protected |
Definition at line 381 of file libeval_compiler.cpp.
References LIBEVAL::defaultTokenValue, lexDefault(), lexString(), LS_DEFAULT, LS_STRING, m_lexerState, and LIBEVAL::T_TOKEN::value.
Referenced by Compile().
|
inline |
Definition at line 527 of file libeval_compiler.h.
|
protected |
Definition at line 435 of file libeval_compiler.cpp.
References _, LIBEVAL::CST_PARSE, LIBEVAL::TOKENIZER::Done(), LIBEVAL::TOKENIZER::GetChar(), LIBEVAL::TOKENIZER::GetChars(), LIBEVAL::TOKENIZER::GetPos(), LIBEVAL::T_TOKEN_VALUE::idx, libeval_dbg, LS_STRING, m_lexerState, m_localeDecimalSeparator, m_tokenizer, LIBEVAL::TOKENIZER::MatchAhead(), LIBEVAL::TOKENIZER::NextChar(), LIBEVAL::T_TOKEN_VALUE::num, reportError(), resolveUnits(), LIBEVAL::T_TOKEN_VALUE::str, LIBEVAL::T_TOKEN::token, and LIBEVAL::T_TOKEN::value.
Referenced by getToken().
|
protected |
Definition at line 405 of file libeval_compiler.cpp.
References LIBEVAL::TOKENIZER::GetString(), LS_DEFAULT, m_lexerState, m_tokenizer, LIBEVAL::T_TOKEN_VALUE::str, LIBEVAL::T_TOKEN::token, and LIBEVAL::T_TOKEN::value.
Referenced by getToken().
|
protected |
Definition at line 371 of file libeval_compiler.cpp.
References Clear(), LS_DEFAULT, m_lexerState, m_parseFinished, m_tokenizer, and LIBEVAL::TOKENIZER::Restart().
Referenced by Compile().
void LIBEVAL::COMPILER::parseError | ( | const char * | s | ) |
Definition at line 308 of file libeval_compiler.cpp.
References LIBEVAL::CST_PARSE, and reportError().
void LIBEVAL::COMPILER::parseOk | ( | ) |
Definition at line 314 of file libeval_compiler.cpp.
References m_parseFinished.
|
protected |
Definition at line 687 of file libeval_compiler.cpp.
References m_errorCallback, m_errorStatus, m_sourcePos, LIBEVAL::ERROR_STATUS::message, LIBEVAL::ERROR_STATUS::pendingError, LIBEVAL::ERROR_STATUS::srcPos, and LIBEVAL::ERROR_STATUS::stage.
Referenced by generateUCode(), lexDefault(), and parseError().
|
protected |
Definition at line 415 of file libeval_compiler.cpp.
References libeval_dbg, m_tokenizer, m_unitResolver, LIBEVAL::TOKENIZER::MatchAhead(), and LIBEVAL::TOKENIZER::NextChar().
Referenced by lexDefault().
|
inline |
Definition at line 522 of file libeval_compiler.h.
Referenced by DRC_RULE_CONDITION::Compile(), MULTICHANNEL_TOOL::findOtherItemsInRuleArea(), MULTICHANNEL_TOOL::findRoutedConnections(), MULTICHANNEL_TOOL::identifyComponentsInRuleArea(), and PCBEXPR_EVALUATOR::SetErrorCallback().
void LIBEVAL::COMPILER::setRoot | ( | LIBEVAL::TREE_NODE * | root | ) |
Definition at line 702 of file libeval_compiler.cpp.
References m_tree.
|
protected |
Definition at line 568 of file libeval_compiler.h.
Referenced by reportError().
|
protected |
Definition at line 566 of file libeval_compiler.h.
Referenced by Compile(), COMPILER(), and reportError().
|
protected |
Definition at line 572 of file libeval_compiler.h.
Referenced by Clear().
|
protected |
Definition at line 573 of file libeval_compiler.h.
Referenced by Clear().
|
protected |
Definition at line 540 of file libeval_compiler.h.
Referenced by getToken(), lexDefault(), lexString(), and newString().
|
protected |
Definition at line 560 of file libeval_compiler.h.
Referenced by COMPILER(), and lexDefault().
|
protected |
Definition at line 565 of file libeval_compiler.h.
Referenced by Compile(), COMPILER(), newString(), and parseOk().
|
protected |
Definition at line 558 of file libeval_compiler.h.
Referenced by Compile(), COMPILER(), and ~COMPILER().
|
protected |
Definition at line 564 of file libeval_compiler.h.
Referenced by Compile(), COMPILER(), and reportError().
|
protected |
Definition at line 559 of file libeval_compiler.h.
Referenced by Clear(), Compile(), lexDefault(), lexString(), newString(), and resolveUnits().
|
protected |
Definition at line 570 of file libeval_compiler.h.
Referenced by Clear(), Compile(), COMPILER(), generateUCode(), setRoot(), and ~COMPILER().
|
protected |
Definition at line 562 of file libeval_compiler.h.
Referenced by COMPILER(), generateUCode(), PCBEXPR_COMPILER::PCBEXPR_COMPILER(), and resolveUnits().