KiCad PCB EDA Suite
Loading...
Searching...
No Matches
LIBEVAL::COMPILER Class Reference

#include <libeval_compiler.h>

Inheritance diagram for LIBEVAL::COMPILER:
PCBEXPR_COMPILER

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_STATUSGetError () 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_RESOLVERm_unitResolver
 
int m_sourcePos
 
bool m_parseFinished
 
ERROR_STATUS m_errorStatus
 
std::function< void(const wxString &aMessage, int aOffset)> m_errorCallback
 
TREE_NODEm_tree
 
std::vector< TREE_NODE * > m_gcItems
 
std::vector< wxString * > m_gcStrings
 

Detailed Description

Definition at line 491 of file libeval_compiler.h.

Member Enumeration Documentation

◆ LEXER_STATE

Enumerator
LS_DEFAULT 
LS_STRING 

Definition at line 526 of file libeval_compiler.h.

Constructor & Destructor Documentation

◆ COMPILER()

◆ ~COMPILER()

LIBEVAL::COMPILER::~COMPILER ( )
virtual

Definition at line 264 of file libeval_compiler.cpp.

References Clear(), freeTree(), m_parser, and m_tree.

Member Function Documentation

◆ Clear()

void LIBEVAL::COMPILER::Clear ( )

Definition at line 281 of file libeval_compiler.cpp.

References LIBEVAL::TOKENIZER::Clear(), freeTree(), m_gcItems, m_gcStrings, m_tokenizer, and m_tree.

Referenced by newString(), and ~COMPILER().

◆ Compile()

◆ freeTree()

void LIBEVAL::COMPILER::freeTree ( LIBEVAL::TREE_NODE tree)

Definition at line 705 of file libeval_compiler.cpp.

References freeTree(), LIBEVAL::TREE_NODE::leaf, and LIBEVAL::TREE_NODE::uop.

Referenced by Clear(), Compile(), freeTree(), and ~COMPILER().

◆ GcItem() [1/2]

void LIBEVAL::COMPILER::GcItem ( TREE_NODE aItem)
inline

Definition at line 522 of file libeval_compiler.h.

Referenced by Compile(), and LIBEVAL::newNode().

◆ GcItem() [2/2]

void LIBEVAL::COMPILER::GcItem ( wxString *  aItem)
inline

Definition at line 523 of file libeval_compiler.h.

◆ generateUCode()

◆ GetError()

const ERROR_STATUS & LIBEVAL::COMPILER::GetError ( ) const
inline

Definition at line 520 of file libeval_compiler.h.

Referenced by testEvalExpr().

◆ GetSourcePos()

int LIBEVAL::COMPILER::GetSourcePos ( ) const
inline

Definition at line 507 of file libeval_compiler.h.

Referenced by LIBEVAL::newNode().

◆ getToken()

T_TOKEN LIBEVAL::COMPILER::getToken ( )
protected

◆ IsErrorPending()

bool LIBEVAL::COMPILER::IsErrorPending ( ) const
inline

Definition at line 519 of file libeval_compiler.h.

◆ lexDefault()

◆ lexString()

bool LIBEVAL::COMPILER::lexString ( T_TOKEN aToken)
protected

◆ newString()

void LIBEVAL::COMPILER::newString ( const wxString &  aString)
protected

◆ parseError()

void LIBEVAL::COMPILER::parseError ( const char *  s)

Definition at line 305 of file libeval_compiler.cpp.

References LIBEVAL::CST_PARSE, and reportError().

◆ parseOk()

void LIBEVAL::COMPILER::parseOk ( )

Definition at line 311 of file libeval_compiler.cpp.

References m_parseFinished.

◆ reportError()

void LIBEVAL::COMPILER::reportError ( COMPILATION_STAGE  stage,
const wxString &  aErrorMsg,
int  aPos = -1 
)
protected

◆ resolveUnits()

int LIBEVAL::COMPILER::resolveUnits ( )
protected

◆ SetErrorCallback()

void LIBEVAL::COMPILER::SetErrorCallback ( std::function< void(const wxString &aMessage, int aOffset)>  aCallback)
inline

◆ setRoot()

void LIBEVAL::COMPILER::setRoot ( LIBEVAL::TREE_NODE root)

Definition at line 699 of file libeval_compiler.cpp.

References m_tree.

Member Data Documentation

◆ m_errorCallback

std::function<void( const wxString& aMessage, int aOffset )> LIBEVAL::COMPILER::m_errorCallback
protected

Definition at line 560 of file libeval_compiler.h.

Referenced by reportError().

◆ m_errorStatus

ERROR_STATUS LIBEVAL::COMPILER::m_errorStatus
protected

Definition at line 558 of file libeval_compiler.h.

Referenced by Compile(), COMPILER(), and reportError().

◆ m_gcItems

std::vector<TREE_NODE*> LIBEVAL::COMPILER::m_gcItems
protected

Definition at line 564 of file libeval_compiler.h.

Referenced by Clear().

◆ m_gcStrings

std::vector<wxString*> LIBEVAL::COMPILER::m_gcStrings
protected

Definition at line 565 of file libeval_compiler.h.

Referenced by Clear().

◆ m_lexerState

LEXER_STATE LIBEVAL::COMPILER::m_lexerState
protected

Definition at line 532 of file libeval_compiler.h.

Referenced by getToken(), lexDefault(), lexString(), and newString().

◆ m_localeDecimalSeparator

char LIBEVAL::COMPILER::m_localeDecimalSeparator
protected

Definition at line 552 of file libeval_compiler.h.

Referenced by COMPILER(), and lexDefault().

◆ m_parseFinished

bool LIBEVAL::COMPILER::m_parseFinished
protected

Definition at line 557 of file libeval_compiler.h.

Referenced by Compile(), COMPILER(), newString(), and parseOk().

◆ m_parser

void* LIBEVAL::COMPILER::m_parser
protected

Definition at line 550 of file libeval_compiler.h.

Referenced by Compile(), COMPILER(), and ~COMPILER().

◆ m_sourcePos

int LIBEVAL::COMPILER::m_sourcePos
protected

Definition at line 556 of file libeval_compiler.h.

Referenced by Compile(), COMPILER(), and reportError().

◆ m_tokenizer

TOKENIZER LIBEVAL::COMPILER::m_tokenizer
protected

Definition at line 551 of file libeval_compiler.h.

Referenced by Clear(), Compile(), lexDefault(), lexString(), newString(), and resolveUnits().

◆ m_tree

TREE_NODE* LIBEVAL::COMPILER::m_tree
protected

Definition at line 562 of file libeval_compiler.h.

Referenced by Clear(), Compile(), COMPILER(), generateUCode(), setRoot(), and ~COMPILER().

◆ m_unitResolver

std::unique_ptr<UNIT_RESOLVER> LIBEVAL::COMPILER::m_unitResolver
protected

The documentation for this class was generated from the following files: