38#define TR_OP_BINARY_MASK 0x200
39#define TR_OP_UNARY_MASK 0x100
41#define TR_OP_MUL 0x201
42#define TR_OP_DIV 0x202
43#define TR_OP_ADD 0x203
44#define TR_OP_SUB 0x204
45#define TR_OP_LESS 0x205
46#define TR_OP_GREATER 0x206
47#define TR_OP_LESS_EQUAL 0x207
48#define TR_OP_GREATER_EQUAL 0x208
49#define TR_OP_EQUAL 0x209
50#define TR_OP_NOT_EQUAL 0x20a
51#define TR_OP_BOOL_AND 0x20b
52#define TR_OP_BOOL_OR 0x20c
53#define TR_OP_BOOL_NOT 0x100
54#define TR_OP_FUNC_CALL 24
55#define TR_OP_METHOD_CALL 25
56#define TR_UOP_PUSH_VAR 1
57#define TR_UOP_PUSH_VALUE 2
147 void SetUop(
int aOp,
const wxString& aValue,
bool aStringIsWildcard );
148 void SetUop(
int aOp, std::unique_ptr<VAR_REF> aRef =
nullptr );
169 static const std::vector<wxString> nullUnits;
177 static const std::vector<EDA_UNITS> nullUnits;
184 return wxEmptyString;
187 virtual double Convert(
const wxString& aString,
int unitType )
const
206 VALUE(
const wxString& aStr,
bool aIsWildcard =
false ) :
256 virtual bool EqualTo(
CONTEXT* aCtx,
const VALUE* b )
const;
259 virtual bool NotEqualTo(
CONTEXT* aCtx,
const VALUE* b )
const;
283 void Set(
const wxString& aValue )
386 void SetErrorCallback( std::function<
void(
const wxString& aMessage,
int aOffset )> aCallback )
393 void ReportError(
const wxString& aErrorMsg );
423 wxString Dump()
const;
425 virtual std::unique_ptr<VAR_REF>
CreateVarRef(
const wxString& var,
const wxString& field )
443 UOP(
int op, std::unique_ptr<VALUE> value ) :
449 UOP(
int op, std::unique_ptr<VAR_REF> vref ) :
514 wxString GetString();
516 wxString GetChars(
const std::function<
bool( wxUniChar )>& cond )
const;
518 bool MatchAhead(
const wxString& match,
519 const std::function<
bool( wxUniChar )>& stopCond )
const;
553 bool Compile(
const wxString& aString,
UCODE* aCode,
CONTEXT* aPreflightContext );
555 void SetErrorCallback( std::function<
void(
const wxString& aMessage,
int aOffset )> aCallback )
580 void newString(
const wxString& aString );
void SetErrorCallback(std::function< void(const wxString &aMessage, int aOffset)> aCallback)
bool IsErrorPending() const
std::unique_ptr< UNIT_RESOLVER > m_unitResolver
void newString(const wxString &aString)
void GcItem(wxString *aItem)
bool lexString(T_TOKEN &aToken)
void GcItem(TREE_NODE *aItem)
COMPILER(const COMPILER &)=delete
bool generateUCode(UCODE *aCode, CONTEXT *aPreflightContext)
char m_localeDecimalSeparator
std::function< void(const wxString &aMessage, int aOffset)> m_errorCallback
bool lexDefault(T_TOKEN &aToken)
std::vector< TREE_NODE * > m_gcItems
void reportError(COMPILATION_STAGE stage, const wxString &aErrorMsg, int aPos=-1)
const ERROR_STATUS & GetError() const
COMPILER & operator=(const COMPILER &)=delete
std::vector< wxString * > m_gcStrings
ERROR_STATUS m_errorStatus
void parseError(const char *s)
std::vector< VALUE * > m_ownedValues
VALUE * StoreValue(VALUE *aValue)
void ReportError(const wxString &aErrorMsg)
std::function< void(const wxString &aMessage, int aOffset)> m_errorCallback
CONTEXT(const CONTEXT &)=delete
void SetErrorCallback(std::function< void(const wxString &aMessage, int aOffset)> aCallback)
CONTEXT & operator=(const CONTEXT &)=delete
void NextChar(int aAdvance=1)
void Restart(const wxString &aStr)
void SetUop(int aOp, double aValue, EDA_UNITS aUnits)
virtual std::unique_ptr< VAR_REF > CreateVarRef(const wxString &var, const wxString &field)
UCODE(const UCODE &)=delete
std::vector< UOP * > m_ucode
virtual FUNC_CALL_REF CreateFuncCall(const wxString &name)
UCODE & operator=(const UCODE &)=delete
virtual wxString GetSupportedUnitsMessage() const
virtual const std::vector< EDA_UNITS > & GetSupportedUnitsTypes() const
virtual double Convert(const wxString &aString, int unitType) const
virtual const std::vector< wxString > & GetSupportedUnits() const
UOP(int op, FUNC_CALL_REF func, std::unique_ptr< VAR_REF > vref=nullptr)
std::unique_ptr< VAR_REF > m_ref
UOP(int op, std::unique_ptr< VALUE > value)
std::unique_ptr< VALUE > m_value
UOP(int op, std::unique_ptr< VAR_REF > vref)
virtual const wxString & AsString() const
void SetUnits(const EDA_UNITS aUnits)
void SetDeferredEval(std::function< wxString()> aLambda)
bool StringIsWildcard() const
void Set(const wxString &aValue)
static VALUE * MakeNullValue()
std::function< double()> m_lambdaDbl
virtual double AsDouble() const
EDA_UNITS GetUnits() const
VAR_TYPE_T GetType() const
void Set(const VALUE &val)
void SetDeferredEval(std::function< double()> aLambda)
std::function< wxString()> m_lambdaStr
VALUE(const wxString &aStr, bool aIsWildcard=false)
virtual VALUE * GetValue(CONTEXT *aCtx)=0
virtual VAR_TYPE_T GetType() const =0
virtual ~VAR_REF()=default
TREE_NODE * newNode(LIBEVAL::COMPILER *compiler, int op, const T_TOKEN_VALUE &value)
constexpr T_TOKEN defaultToken
constexpr T_TOKEN_VALUE defaultTokenValue
std::function< void(CONTEXT *, void *)> FUNC_CALL_REF
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
@ VALUE
Field Value of part, i.e. "3.3K".