MinitScript
0.9.31 PRE-BETA
|
#include <minitscript/minitscript/MinitScript.h>
Classes | |
class | DataType |
Data type. More... | |
struct | GarbageCollectionDataType |
Garbage collection data type. More... | |
class | Method |
Method. More... | |
struct | ParserArgument |
Parser argument. More... | |
struct | Script |
Script. More... | |
struct | ScriptState |
Script state. More... | |
class | ShutdownRAII |
Shutdown RAII. More... | |
class | StateMachineState |
State Machine State. More... | |
struct | Statement |
Statement. More... | |
struct | SubStatement |
Sub statement. More... | |
struct | SyntaxTreeNode |
Syntax Tree Node. More... | |
class | Variable |
Variable. More... | |
Public Member Functions | |
const string | getArgumentsAsString (const vector< SyntaxTreeNode > &arguments) |
Returns arguments as string. More... | |
DataType::ScriptContext * | getDataTypeScriptContext (VariableType type) |
Return data type script context. More... | |
_Context * | getContext () |
void | setContext (_Context *context) |
Set context. More... | |
_Library * | getLibrary () |
void | setLibrary (_Library *library) |
Set library. More... | |
const string & | getErrorMessage () |
const SubStatement & | getErrorSubStatement () |
void | complain (const string &methodName, const SubStatement &subStatement) |
Complain about method usage. More... | |
void | complain (const string &methodName, const SubStatement &subStatement, const string &message) |
Complain about method usage. More... | |
void | complainOperator (const string &methodName, const string &operatorString, const SubStatement &subStatement) |
Complain about operator usage. More... | |
void | complainOperator (const string &methodName, const string &operatorString, const SubStatement &subStatement, const string &message) |
Complain about operator usage. More... | |
MinitScript () | |
Default constructor. More... | |
virtual | ~MinitScript () |
Destructor. More... | |
virtual const string | getBaseClassHeader () |
virtual const string | getBaseClass () |
virtual const vector< string > | getTranspilationUnits () |
const vector< string > & | getParseErrors () |
bool | isValid () |
bool | isNative () |
const string & | getNativeHash () |
const string & | getScriptPathName () |
const string & | getScriptFileName () |
const vector< Script > & | getScripts () |
ScriptState & | getRootScriptState () |
ScriptState & | getScriptState () |
MathMethods * | getMathMethods () |
void | startErrorScript () |
Start error script. More... | |
bool | hasMethod (const string &methodName) |
Returns if method with given name does exist. More... | |
bool | hasFunction (const string &functionName) |
Returns if function with given name does exist. More... | |
virtual void | registerStateMachineStates () |
Register state machine states. More... | |
virtual void | registerMethods () |
Register methods. More... | |
virtual void | registerVariables () |
Register variables. More... | |
int | getStatementSubLineIdx (const string &statement, int idx) |
Get statement sub line index. More... | |
const string | getStatementInformation (const Statement &statement, int subLineIdx=-1) |
Return statement information. More... | |
const string | getSubStatementInformation (const SubStatement &subStatement) |
Return sub statement information. More... | |
const string | getArgumentsInformation (const string &methodName) |
Get arguments information. More... | |
void | registerStateMachineState (StateMachineState *state) |
Register state machine state. More... | |
void | registerMethod (Method *method) |
Register method. More... | |
bool | isVariableAccess (const string &candidate, const SubStatement *subStatement=nullptr) |
Returns if a given string is a variable name. More... | |
bool | hasVariable (const string &variableStatement, const SubStatement *subStatement=nullptr) |
Returns if variable determined by given variable statement exists. More... | |
const Variable | getMethodArgumentVariable (const string &variableStatement, const SubStatement *subStatement=nullptr) |
Returns variable determined by given variable statement optimized for method argument usage. More... | |
const Variable | getMethodArgumentVariable (Variable *variablePtr, const string &variableStatement, const SubStatement *subStatement=nullptr) |
Returns variable determined by given variable statement and variable pointer optimized for method argument usage. More... | |
const Variable | getVariable (const string &variableStatement, const SubStatement *subStatement=nullptr, bool createReference=false) |
Returns variable determined by given variable statement. More... | |
const Variable | getVariable (Variable *variablePtr, const string &variableStatement, const SubStatement *subStatement=nullptr, bool createReference=false) |
Returns variable determined by given variable statement and variable pointer. More... | |
void | unsetVariable (Variable *variablePtr, const string &variableStatement, const SubStatement *subStatement=nullptr) |
Unsets variable determined by given variable statement and variable pointer. More... | |
void | unsetVariable (const string &variableStatement, const SubStatement *subStatement=nullptr) |
Unsets variable determined by given variable statement. More... | |
void | setConstant (const string &variableStatement, const Variable &variable) |
Set constant by given variable statement and variable. More... | |
void | setVariable (const string &variableStatement, const Variable &variable, const SubStatement *subStatement=nullptr, bool createReference=false) |
Set variable by given variable statement and variable. More... | |
void | setVariable (Variable *variablePtr, const string &variableStatement, const Variable &variable, const SubStatement *subStatement=nullptr, bool createReference=false) |
Set variable by given variable pointer, variable statement and variable. More... | |
void | parseScript (const string &pathName, const string &fileName, bool nativeOnly=false) |
Parse script. More... | |
virtual void | startScript () |
Start script. More... | |
bool | hasCondition (const string &condition) |
Check if condition with given name exists. More... | |
virtual void | emit (const string &condition) |
Emit. More... | |
virtual void | execute () |
Execute. More... | |
int | getFunctionScriptIdx (const string &function) |
Return function script index by function name. More... | |
bool | call (int scriptIdx, span< Variable > &arguments, Variable &returnValue) |
Call function. More... | |
bool | call (const string &function, span< Variable > &arguments, Variable &returnValue) |
Call function. More... | |
bool | callStacklet (int scriptIdx, span< Variable > &arguments, Variable &returnValue) |
Call stacklet. More... | |
bool | callStacklet (const string &stacklet, span< Variable > &arguments, Variable &returnValue) |
Call stacklet. More... | |
bool | evaluate (const string &evaluateStatement, Variable &returnValue) |
Evaluate statement. More... | |
bool | isRunning () |
Method * | getMethod (const string &methodName) |
Get method by method name. More... | |
const vector< Method * > | getMethods () |
Method * | getOperatorMethod (Operator operator_) |
Get method by operator. More... | |
const vector< Method * > | getOperatorMethods () |
const string | getScriptInformation (int scriptIdx, bool includeStatements=true) |
Get script information for a specific script index. More... | |
const string | getInformation () |
Get MinitScript instance information. More... | |
Static Public Member Functions | |
static void | initialize () |
Initialize. More... | |
static void | setConstant (Variable &variable) |
Set variable recursively to be a constant. More... | |
static void | unsetConstant (Variable &variable) |
Set variable recursively to be a non constant. More... | |
static const string | getArgumentIndicesAsString (const vector< int > &argumentIndices, const string &delimiter) |
Returns string representation of given argument indices. More... | |
static const vector< DataType * > & | getDataTypes () |
static DataType * | getDataTypeByClassName (const string &className) |
Returns data type by class name or nullptr. More... | |
static void | registerDataType (DataType *dataType) |
Register data type. More... | |
static string | getOperatorAsString (Operator operator_) |
Get operator as string. More... | |
static bool | isOperator (const string &candidate) |
Is given candidate a operator string. More... | |
static bool | hasType (const span< Variable > &arguments, VariableType type) |
Check if arguments contain argument with given type. More... | |
static bool | hasTypeForOperatorArguments (const span< Variable > &arguments, VariableType type) |
Checks if left and right operator arguments have given type. More... | |
static bool | getBooleanValue (const span< Variable > &arguments, int idx, bool &value, bool optional=false) |
Get boolean value from given variable. More... | |
static bool | getIntegerValue (const span< Variable > &arguments, int idx, int64_t &value, bool optional=false) |
Get integer value from given variable. More... | |
static bool | getFloatValue (const span< Variable > &arguments, int idx, float &value, bool optional=false) |
Get float value from given variable. More... | |
static bool | getFunctionValue (const span< Variable > &arguments, int idx, string &function, int &scriptIdx, bool optional=false) |
Get function value from given variable. More... | |
static bool | getStackletValue (const span< Variable > &arguments, int idx, string &stacklet, int &scriptIdx, bool optional=false) |
Get stacklet value from given variable. More... | |
static bool | getStringValue (const span< Variable > &arguments, int idx, string &value, bool optional=false) |
Get string value from given variable. More... | |
Static Public Attributes | |
static constexpr int | SCRIPTIDX_NONE { -1 } |
static constexpr int | LINE_NONE { -1 } |
static constexpr int | STATEMENTIDX_NONE { -1 } |
static constexpr int | STATEMENTIDX_FIRST { 0 } |
static constexpr int | ARGUMENTIDX_NONE { -1 } |
static MINITSCRIPT_STATIC_DLL_IMPEXT const string | METHOD_SCRIPTCALL = "script.call" |
static MINITSCRIPT_STATIC_DLL_IMPEXT const string | METHOD_SCRIPTCALLSTACKLET = "script.callStacklet" |
static MINITSCRIPT_STATIC_DLL_IMPEXT const string | METHOD_SCRIPTCALLBYINDEX = "script.callByIndex" |
static MINITSCRIPT_STATIC_DLL_IMPEXT const string | METHOD_SCRIPTCALLSTACKLETBYINDEX = "script.callStackletByIndex" |
static MINITSCRIPT_STATIC_DLL_IMPEXT const string | METHOD_ENABLENAMEDCONDITION = "script.enableNamedCondition" |
static MINITSCRIPT_STATIC_DLL_IMPEXT const string | METHOD_DISABLENAMEDCONDITION = "script.disableNamedCondition" |
Protected Member Functions | |
bool | hasEmitted () |
virtual void | initializeNative () |
Initialize native mini script. More... | |
void | setNative (bool native) |
Set native. More... | |
void | setNativeHash (const string &nativeHash) |
Set native hash. More... | |
void | gotoStatement (const Statement &statement) |
Go to statement. More... | |
void | gotoStatementGoto (const Statement &statement) |
Go to statement goto from given statement. More... | |
vector< Script > | getNativeScripts () |
void | setNativeScripts (const vector< Script > &nativeScripts) |
Set native scripts. More... | |
void | setNativeFunctions (const unordered_map< string, int > &nativeFunctions) |
Set native functions. More... | |
void | executeStateMachine () |
Execute state machine. More... | |
void | dumpScriptState (ScriptState &scriptState, const string &message=string()) |
Dump script state. More... | |
void | pushScriptState () |
Push a new script state. More... | |
void | popScriptState () |
Pop script state. More... | |
bool | isFunctionRunning () |
void | resetScriptExecutationState (int scriptIdx, StateMachineStateId stateMachineState) |
Reset script execution state. More... | |
void | resetStackletScriptExecutationState (int scriptIdx, StateMachineStateId stateMachineState) |
Reset stacklet script execution state. More... | |
void | stopRunning () |
Set running flag to false. More... | |
void | stopScriptExecution () |
Stop script execution. More... | |
void | setScriptStateState (int state) |
Set script state machine state. More... | |
virtual int | determineScriptIdxToStart () |
Determine script index to start. More... | |
virtual int | determineNamedScriptIdxToStart () |
Determine named script index to start. More... | |
void | createLamdaFunction (Variable &variable, const vector< string_view > &arguments, const string_view &functionScriptCode, int lineIdx, bool populateThis, const Statement &statement, const string &nameHint=string()) |
void | createStacklet (Variable &variable, const string &scopeName, const vector< string_view > &arguments, const string_view &stackletScriptCode, int lineIdx, const Statement &statement) |
void | tryGarbageCollection () |
Try garbage collection. More... | |
void | garbageCollection () |
Issue garbage collection. More... | |
Static Protected Member Functions | |
static const string | escapeString (const string &str) |
Escape string variable. More... | |
static const string | decodeOperator (const span< MinitScript::Variable > &arguments, int operatorValueIdx, const string &defaultOperatorString) |
Decode operator. More... | |
static const Variable | initializeArray (const string_view &initializerString, MinitScript *minitScript, int scriptIdx, const Statement &statement) |
Initialize array by initializer string. More... | |
static const Variable | initializeMapSet (const string_view &initializerString, MinitScript *minitScript, int scriptIdx, const Statement &statement) |
Initialize map/set by initializer string. More... | |
Protected Attributes | |
bool | native |
_Context * | context { nullptr } |
_Library * | library { nullptr } |
vector< Script > | scripts |
string | nativeHash |
vector< Script > | nativeScripts |
vector< unique_ptr< ScriptState > > | scriptStateStack |
vector< string > | enabledNamedConditions |
int64_t | timeEnabledConditionsCheckLast { TIME_NONE } |
vector< string > | parseErrors |
vector< pair< int, string > > | deferredInlineScriptCodes |
int | inlineFunctionIdx { 0 } |
int | inlineStackletIdx { 0 } |
unique_ptr< MathMethods > | minitScriptMath |
SubStatement | errorSubStatement |
string | errorMessage |
string | deferredEmit |
bool | emitted { false } |
Static Protected Attributes | |
static constexpr int | SETACCESSBOOL_NONE { -1 } |
static constexpr int | SETACCESSBOOL_TRUE { 0 } |
static constexpr int | SETACCESSBOOL_FALSE { 1 } |
static constexpr int | ARRAYIDX_NONE { -1 } |
static constexpr int | ARRAYIDX_ADD { -2 } |
static constexpr int | ARRAYIDX_FIRST { 0 } |
static constexpr int | STATE_NONE { -1 } |
static constexpr int | OPERATORIDX_NONE { -1 } |
static constexpr int | LINE_FIRST { 1 } |
static constexpr int64_t | TIME_NONE { -1LL } |
Private Member Functions | |
bool | parseScriptInternal (const string &scriptCode, int lineIdxOffset=0) |
Parse script code into this MinitScript instance. More... | |
void | executeNextStatement () |
Execute next statement. More... | |
bool | getNextStatement (const string &scriptCode, int &i, int &line, string &statement) |
Get next statement from script code. More... | |
bool | parseStatement (const string_view &executableStatement, string_view &methodName, vector< ParserArgument > &arguments, const Statement &statement, string &accessObjectMemberStatement) |
Parse a statement. More... | |
Variable | executeStatement (const SyntaxTreeNode &syntaxTree, const Statement &statement) |
Execute a statement. More... | |
bool | createStatementSyntaxTree (int scriptIdx, const string_view &methodName, const vector< ParserArgument > &arguments, const Statement &statement, SyntaxTreeNode &syntaxTree, int subLineIdx=0) |
Create statement syntax tree. More... | |
bool | setupFunctionAndStackletScriptIndices (int scriptIdx) |
Setup function and stacket script indices. More... | |
bool | setupFunctionAndStackletScriptIndices (SyntaxTreeNode &syntaxTreeNode, const Statement &statement) |
Setup function and stacket script indices. More... | |
bool | setupFunctionAndStackletScriptIndices (Variable &variable, const Statement &statement, int subLineIdx) |
Setup function and stacket script indices. More... | |
int | getStackletScopeScriptIdx (int scriptIdx) |
Return stacklet scope script index. More... | |
bool | validateStacklets (int scriptIdx) |
Validate stacklets. More... | |
bool | validateStacklets (const string &function, int scopeScriptIdx=MinitScript::SCRIPTIDX_NONE) |
Validate stacklets. More... | |
bool | validateStacklets (int scopeScriptIdx, const SyntaxTreeNode &syntaxTreeNode, const Statement &statement) |
Validate stacklets. More... | |
bool | validateCallable (const string &function) |
Validate callabe. More... | |
bool | validateCallable (const SyntaxTreeNode &syntaxTreeNode, const Statement &statement) |
Validate callable. More... | |
bool | validateContextFunctions (const string &function, vector< string > &functionStack) |
Validate context functions. More... | |
bool | validateContextFunctions (const SyntaxTreeNode &syntaxTreeNode, vector< string > &functionStack, const Statement &statement) |
Validate context functions. More... | |
const string | doStatementPreProcessing (const string &processedStatement, const Statement &statement) |
Do statement pre processing, 1) replace operators with corresponding methods. More... | |
bool | getObjectMemberAccess (const string_view &executableStatement, string_view &object, string_view &method, int &methodStartIdx, const Statement &statement) |
Returns if statement has a object member access. More... | |
bool | getVariableAccessOperatorLeftRightIndices (const string &variableStatement, const string &callerMethod, string::size_type &accessOperatorLeftIdx, string::size_type &accessOperatorRightIdx, const SubStatement *subStatement=nullptr, int startIdx=0) |
Get access operator left and right indices. More... | |
bool | evaluateAccess (const string &variableStatement, const string &callerMethod, string::size_type &arrayAccessOperatorLeftIdx, string::size_type &arrayAccessOperatorRightIdx, int64_t &arrayIdx, string &key, const SubStatement *subStatement=nullptr) |
Evaluate access. More... | |
Variable * | evaluateVariableAccessIntern (Variable *variablePtr, const string &variableStatement, const string &callerMethod, Variable *&parentVariable, int64_t &arrayIdx, string &key, int &setAccessBool, const SubStatement *subStatement=nullptr, bool expectVariable=true) |
Returns pointer of variable with given name or nullptr. More... | |
Variable * | getVariableIntern (const string &variableStatement, const string &callerMethod, string &variableName, Variable *&parentVariable, int64_t &arrayIdx, string &key, int &setAccessBool, const SubStatement *subStatement=nullptr, bool expectVariable=true, bool global=false) |
Returns pointer of variable with given name or nullptr. More... | |
void | setVariableInternal (const string &variableStatement, Variable *parentVariable, Variable *variablePtr, int64_t arrayIdx, const string &key, const Variable &variable, const SubStatement *subStatement=nullptr, bool createReference=false) |
Set variable internal. More... | |
bool | evaluateInternal (const string &statement, const string &executableStatement, Variable &returnValue, bool pushScriptState=true) |
Evaluate given statement without executing preprocessor run. More... | |
bool | call (int scriptIdx, span< Variable > &arguments, Variable &returnValue, bool pushScriptState) |
Call function. More... | |
bool | call (const string &function, span< Variable > &arguments, Variable &returnValue, bool pushScriptState) |
Call function. More... | |
const Variable | initializeVariable (const Variable &variable) |
Initialize variable. More... | |
const string | deescape (const string_view &str, const Statement &statement) |
Deescape string. More... | |
Static Private Member Functions | |
static const bool | isOperatorChar (char c) |
Returns if char is operator char. More... | |
static bool | viewIsLamdaFunction (const string_view &candidate, vector< string_view > &arguments, string_view &functionScriptCode, int &lineIdx) |
Returns if a given string is a lambda function. More... | |
static bool | viewIsStacklet (const string_view &candidate, vector< string_view > &arguments, string_view &stackletScriptCode, int &lineIdx) |
Returns if a given string is a stacklet. More... | |
static bool | viewIsVariableAccess (const string_view &candidate) |
Returns if a given string is a variable name. More... | |
static bool | viewIsKey (const string_view &candidate) |
Returns if a given string is a valid map key name. More... | |
static bool | viewIsKeyPrivate (const string_view &candidate) |
Returns if a given key candidate is marked as private by head '-'. More... | |
static const string_view | viewGetPrivateKey (const string_view &candidate) |
Returns private key. More... | |
static bool | viewIsStringLiteral (const string_view &candidate) |
Returns if a given string is a string literal. More... | |
static string_view | dequote (const string_view &str) |
Dequote a string. More... | |
static bool | viewIsInitializer (const string_view &candidate) |
Returns if a given string is a array/map/set initializer. More... | |
static bool | viewIsCall (const string_view &candidate) |
Returns if a given string is a method/function call. More... | |
static void | setConstantInternal (Variable &variable) |
Set variable recursively to be a constant. More... | |
static void | unsetConstantInternal (Variable &variable) |
Set variable recursively to be a non constant. More... | |
Private Attributes | |
int64_t | dataTypesGCTime { -1ll } |
unordered_map< string, int > | functions |
unordered_map< string, Method * > | methods |
unordered_map< int, StateMachineState * > | stateMachineStates |
unordered_map< uint8_t, Method * > | operators |
string | scriptPathName |
string | scriptFileName |
bool | scriptValid { false } |
vector< GarbageCollectionDataType > | garbageCollectionDataTypes |
unordered_map< VariableType, DataType::ScriptContext * > | garbageCollectionScriptContextsByDataType |
unordered_set< int > | garbageCollectionDataTypesIndices |
Static Private Attributes | |
static constexpr bool | VERBOSE { false } |
static constexpr bool | VALIDATION { false } |
static constexpr int64_t | GARBAGE_COLLECTION_INTERVAL { 1000ll } |
static MINITSCRIPT_STATIC_DLL_IMPEXT const string | OPERATOR_CHARS = "+-!~/%<>=&^|" |
static MINITSCRIPT_STATIC_DLL_IMPEXT vector< DataType * > | dataTypes |
static MINITSCRIPT_STATIC_DLL_IMPEXT ShutdownRAII | shutdownRAII |
Friends | |
class | ApplicationMethods |
class | BaseMethods |
class | JSONMethods |
class | MathMethods |
class | ScriptMethods |
class | Transpiler |
Definition at line 68 of file MinitScript.h.
enum Operator |
Definition at line 77 of file MinitScript.h.
enum StateMachineStateId |
Enumerator | |
---|---|
STATEMACHINESTATE_NONE | |
STATEMACHINESTATE_NEXT_STATEMENT | |
STATEMACHINESTATE_WAIT | |
STATEMACHINESTATE_WAIT_FOR_CONDITION |
Definition at line 119 of file MinitScript.h.
enum VariableType |
Definition at line 184 of file MinitScript.h.
MinitScript | ( | ) |
Default constructor.
Definition at line 178 of file MinitScript.cpp.
|
virtual |
Destructor.
Definition at line 194 of file MinitScript.cpp.
|
inline |
Returns arguments as string.
arguments | arguments |
Definition at line 3006 of file MinitScript.h.
|
inlinestaticprotected |
Escape string variable.
str | string |
Definition at line 3147 of file MinitScript.h.
|
inlinestaticprotected |
Decode operator.
arguments | arguments |
operatorValueIdx | operator value index |
defaultOperatorString | default operator string |
Definition at line 3192 of file MinitScript.h.
|
inlineprotected |
Definition at line 3209 of file MinitScript.h.
|
protectedvirtual |
Initialize native mini script.
Definition at line 211 of file MinitScript.cpp.
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
Go to statement goto from given statement.
statement | statement |
Definition at line 3247 of file MinitScript.h.
|
inlineprotected |
Definition at line 3255 of file MinitScript.h.
|
inlineprotected |
Set native scripts.
nativeScripts | native scripts |
Definition at line 3263 of file MinitScript.h.
|
inlineprotected |
Set native functions.
nativeFunctions | native functions |
Definition at line 3271 of file MinitScript.h.
|
protected |
Execute state machine.
Definition at line 1593 of file MinitScript.cpp.
|
protected |
Dump script state.
scriptState | script state |
message | message |
Definition at line 3542 of file MinitScript.cpp.
|
inlineprotected |
Push a new script state.
Definition at line 3290 of file MinitScript.h.
|
inlineprotected |
Pop script state.
Definition at line 3297 of file MinitScript.h.
|
inlineprotected |
Definition at line 3319 of file MinitScript.h.
|
inlineprotected |
Reset script execution state.
scriptIdx | script index |
stateMachineState | state machine state |
Definition at line 3335 of file MinitScript.h.
|
inlineprotected |
Reset stacklet script execution state.
scriptIdx | script index |
stateMachineState | state machine state |
Definition at line 3373 of file MinitScript.h.
|
inlineprotected |
Set running flag to false.
Definition at line 3392 of file MinitScript.h.
|
inlineprotected |
Stop script execution.
Definition at line 3399 of file MinitScript.h.
|
inlineprotected |
Set script state machine state.
state | state |
Definition at line 3416 of file MinitScript.h.
|
protectedvirtual |
Determine script index to start.
Definition at line 2835 of file MinitScript.cpp.
|
protectedvirtual |
Determine named script index to start.
Definition at line 2880 of file MinitScript.cpp.
|
protected |
Definition at line 4125 of file MinitScript.cpp.
|
protected |
Definition at line 4149 of file MinitScript.cpp.
|
staticprotected |
Initialize array by initializer string.
initializerString | initializer string |
minitScript | mini script |
scriptIdx | script index |
statement | statement |
Definition at line 4165 of file MinitScript.cpp.
|
staticprotected |
Initialize map/set by initializer string.
initializerString | initializer string |
minitScript | mini script |
scriptIdx | script index |
statement | statement |
Definition at line 4374 of file MinitScript.cpp.
|
inlineprotected |
Try garbage collection.
Definition at line 3481 of file MinitScript.h.
|
protected |
Issue garbage collection.
Definition at line 5241 of file MinitScript.cpp.
|
private |
Parse script code into this MinitScript instance.
scriptCode | script code |
lineIdxOffset | line index offset |
Definition at line 1876 of file MinitScript.cpp.
|
private |
Execute next statement.
Definition at line 286 of file MinitScript.cpp.
|
private |
Get next statement from script code.
scriptCode | script code |
i | character index |
line | line |
statement | statement |
Definition at line 1673 of file MinitScript.cpp.
|
private |
Parse a statement.
executableStatement | executable statement |
methodName | method name |
arguments | arguments |
statement | statment |
accessObjectMember | generated access object member statement |
Definition at line 315 of file MinitScript.cpp.
|
private |
Execute a statement.
syntaxTree | syntax tree |
statement | statement |
Definition at line 597 of file MinitScript.cpp.
|
private |
Create statement syntax tree.
scriptIdx | script index |
methodName | method name |
arguments | arguments |
statement | statement |
syntaxTree | syntax tree |
subLineIdx | sub line index |
Definition at line 777 of file MinitScript.cpp.
|
private |
Setup function and stacket script indices.
scriptIdx | script index |
Definition at line 985 of file MinitScript.cpp.
|
private |
Setup function and stacket script indices.
syntaxTreeNode | syntax tree node |
statement | statement |
Definition at line 1003 of file MinitScript.cpp.
|
private |
Setup function and stacket script indices.
variable | variable |
statement | statement |
subLineIdx | sub line index |
Definition at line 1089 of file MinitScript.cpp.
|
private |
Return stacklet scope script index.
scriptIdx | stacklet script index |
Definition at line 1170 of file MinitScript.cpp.
|
private |
Validate stacklets.
scriptIdx | script index |
Definition at line 1194 of file MinitScript.cpp.
|
private |
Validate stacklets.
function | function |
scopeScriptIdx | scope script index or MinitScript::SCRIPTIDX_NONE for the function itself |
Definition at line 1211 of file MinitScript.cpp.
|
private |
Validate stacklets.
scopeScriptIdx | scope script index |
syntaxTreeNode | syntax tree node |
statement | statement |
Definition at line 1233 of file MinitScript.cpp.
|
private |
Validate callabe.
function | function |
Definition at line 1395 of file MinitScript.cpp.
|
private |
Validate callable.
syntaxTreeNode | syntax tree node |
statement | statement |
Definition at line 1417 of file MinitScript.cpp.
|
private |
Validate context functions.
function | function |
functionStack | function stack |
Definition at line 1468 of file MinitScript.cpp.
|
private |
Validate context functions.
syntaxTreeNode | syntax tree node |
functionStack | function stack |
statement | statement |
Definition at line 1494 of file MinitScript.cpp.
|
inlinestaticprivate |
Returns if char is operator char.
c | char to test |
Definition at line 3736 of file MinitScript.h.
|
private |
Do statement pre processing, 1) replace operators with corresponding methods.
processedStatement | statement that is currently being processed |
statement | statement |
Definition at line 2922 of file MinitScript.cpp.
|
private |
Returns if statement has a object member access.
executableStatement | executable statement |
object | object |
method | method |
methodStartIdx | method start index |
statement | statement |
Definition at line 3458 of file MinitScript.cpp.
|
inlineprivate |
Get access operator left and right indices.
variableStatement | variable statement |
callerMethod | caller method |
accessOperatorLeftIdx | access operator left idx |
accessOperatorRightIdx | access operator right idx |
subStatement | sub statement |
startIdx | startIdx |
Definition at line 5080 of file MinitScript.cpp.
|
inlineprivate |
Evaluate access.
variableStatement | variable statement |
callerMethod | caller method |
arrayAccessOperatorLeftIdx | array access operator left idx |
arrayAccessOperatorRightIdx | array access operator right idx |
arrayIdx | array index |
key | map key |
subStatement | sub statement |
Definition at line 5151 of file MinitScript.cpp.
|
inlineprivate |
Returns pointer of variable with given name or nullptr.
variablePtr | pointer to variable |
variableStatement | variable statement |
callerMethod | caller method |
parentVariable | parent variable |
arrayIdx | array index whereas there is ARRAYIDX_ADD for [] or ARRAYIDX_NONE for no array access |
key | key |
setAccessBool | set access bool which returns one of SETACCESSBOOL_NONE, *_TRUE, *_FALSE |
subStatement | optional sub statement the variable is read in |
expectVariable | expect variable which controls verbosity |
Definition at line 4779 of file MinitScript.cpp.
|
inlineprivate |
Returns pointer of variable with given name or nullptr.
variableStatement | variable statement |
callerMethod | caller method |
variableName | variable name |
parentVariable | parent variable |
arrayIdx | array index whereas there is ARRAYIDX_ADD for [] or ARRAYIDX_NONE for no array access |
key | key |
setAccessBool | set access bool which returns one of SETACCESSBOOL_NONE, *_TRUE, *_FALSE |
subStatement | optional sub statement the variable is read in |
expectVariable | expect variable which controls verbosity |
global | use global context instead of current context |
Definition at line 3810 of file MinitScript.h.
|
inlineprivate |
Set variable internal.
variableStatement | variable statement |
parentVariable | parent variable |
variablePtr | variable pointer |
arrayIdx | array index |
key | key |
variable | variable |
subStatement | optional sub statement the variable is written in |
createReference | optional flag for creating variable references |
Definition at line 4909 of file MinitScript.cpp.
|
inlineprivate |
Evaluate given statement without executing preprocessor run.
statement | statement |
executableStatement | executable statement |
returnValue | return value |
pushScriptState | push script state |
Definition at line 4979 of file MinitScript.cpp.
|
private |
Call function.
scriptIdx | script index |
arguments | argument values |
returnValue | return value |
pushScriptState | push script state |
Definition at line 3569 of file MinitScript.cpp.
|
inlineprivate |
Call function.
function | function |
arguments | argument values |
returnValue | return value |
pushScriptState | push script state |
Definition at line 3898 of file MinitScript.h.
|
inlineprivate |
Initialize variable.
variable | variable |
Definition at line 5019 of file MinitScript.cpp.
|
inlineprivate |
Deescape string.
str | string |
statement | statement |
Definition at line 3923 of file MinitScript.h.
|
inlinestaticprivate |
Returns if a given string is a lambda function.
candidate | candidate |
arguments | arguments |
functionScriptCode | function script code |
lineIdx | start line index |
Definition at line 3982 of file MinitScript.h.
|
inlinestaticprivate |
Returns if a given string is a stacklet.
candidate | candidate |
arguments | arguments |
stackletScriptCode | stacklet script code |
lineIdx | start line index |
Definition at line 4084 of file MinitScript.h.
|
inlinestaticprivate |
Returns if a given string is a variable name.
candidate | candidate |
Definition at line 4132 of file MinitScript.h.
|
inlinestaticprivate |
Returns if a given string is a valid map key name.
candidate | candidate |
Definition at line 5059 of file MinitScript.cpp.
|
inlinestaticprivate |
Returns if a given key candidate is marked as private by head '-'.
candidate | candidate |
Definition at line 5070 of file MinitScript.cpp.
|
inlinestaticprivate |
Returns private key.
candidate | candidate |
Definition at line 5076 of file MinitScript.cpp.
|
inlinestaticprivate |
Returns if a given string is a string literal.
candidate | candidate |
Definition at line 4179 of file MinitScript.h.
|
inlinestaticprivate |
Dequote a string.
str | string |
Definition at line 4205 of file MinitScript.h.
|
inlinestaticprivate |
Returns if a given string is a array/map/set initializer.
candidate | candidate |
Definition at line 4214 of file MinitScript.h.
|
inlinestaticprivate |
Returns if a given string is a method/function call.
candidate | candidate |
Definition at line 4226 of file MinitScript.h.
|
staticprivate |
Set variable recursively to be a constant.
variable | variable |
Definition at line 5181 of file MinitScript.cpp.
|
staticprivate |
Set variable recursively to be a non constant.
variable | variable |
Definition at line 5209 of file MinitScript.cpp.
|
static |
Initialize.
Definition at line 138 of file MinitScript.cpp.
|
inlinestatic |
Set variable recursively to be a constant.
variable | variable |
Definition at line 4255 of file MinitScript.h.
|
inlinestatic |
Set variable recursively to be a non constant.
variable | variable |
Definition at line 4264 of file MinitScript.h.
|
inline |
Return data type script context.
type | data type |
Definition at line 4274 of file MinitScript.h.
|
inline |
Definition at line 4285 of file MinitScript.h.
|
inline |
|
inline |
Definition at line 4300 of file MinitScript.h.
|
inline |
|
inlinestatic |
Returns string representation of given argument indices.
argumentIndices | argument indices |
delimiter | delimiter |
Definition at line 4318 of file MinitScript.h.
|
inline |
Definition at line 4330 of file MinitScript.h.
|
inline |
Definition at line 4337 of file MinitScript.h.
void complain | ( | const string & | methodName, |
const SubStatement & | subStatement | ||
) |
Complain about method usage.
methodName | method mame |
subStatement | sub statement |
Definition at line 214 of file MinitScript.cpp.
void complain | ( | const string & | methodName, |
const SubStatement & | subStatement, | ||
const string & | message | ||
) |
Complain about method usage.
methodName | method mame |
subStatement | sub statement |
message | message |
Definition at line 228 of file MinitScript.cpp.
void complainOperator | ( | const string & | methodName, |
const string & | operatorString, | ||
const SubStatement & | subStatement | ||
) |
Complain about operator usage.
methodName | method mame |
operatorString | operator string |
subStatement | sub statement |
Definition at line 240 of file MinitScript.cpp.
void complainOperator | ( | const string & | methodName, |
const string & | operatorString, | ||
const SubStatement & | subStatement, | ||
const string & | message | ||
) |
Complain about operator usage.
methodName | method mame |
operatorString | operator string |
subStatement | sub statement |
message | message |
Definition at line 257 of file MinitScript.cpp.
|
inlinestatic |
Definition at line 4376 of file MinitScript.h.
|
inlinestatic |
Returns data type by class name or nullptr.
className | class name |
Definition at line 4385 of file MinitScript.h.
|
static |
|
virtual |
Definition at line 147 of file MinitScript.cpp.
|
virtual |
Definition at line 151 of file MinitScript.cpp.
|
virtual |
Definition at line 155 of file MinitScript.cpp.
|
inline |
Definition at line 4429 of file MinitScript.h.
|
inline |
Definition at line 4436 of file MinitScript.h.
|
inline |
Definition at line 4443 of file MinitScript.h.
|
inline |
Definition at line 4450 of file MinitScript.h.
|
inline |
Definition at line 4457 of file MinitScript.h.
|
inline |
Definition at line 4464 of file MinitScript.h.
|
inline |
Definition at line 4471 of file MinitScript.h.
|
inline |
Definition at line 4478 of file MinitScript.h.
|
inline |
Definition at line 4485 of file MinitScript.h.
|
inline |
Definition at line 4492 of file MinitScript.h.
|
inline |
Start error script.
Definition at line 4499 of file MinitScript.h.
|
inline |
Returns if method with given name does exist.
methodName | method name |
Definition at line 4508 of file MinitScript.h.
|
inline |
Returns if function with given name does exist.
functionName | function name |
Definition at line 4517 of file MinitScript.h.
|
virtual |
Register state machine states.
Definition at line 3899 of file MinitScript.cpp.
|
virtual |
Register methods.
Definition at line 3983 of file MinitScript.cpp.
|
virtual |
Register variables.
Definition at line 4063 of file MinitScript.cpp.
|
inline |
Get statement sub line index.
statement | statement |
idx | index |
Definition at line 4542 of file MinitScript.h.
|
inline |
Return statement information.
statement | statement |
subLineIdx | sub line index |
Definition at line 4556 of file MinitScript.h.
|
inline |
Return sub statement information.
subStatement | sub statement |
Definition at line 4576 of file MinitScript.h.
|
inline |
Get arguments information.
methodName | method name |
Definition at line 4585 of file MinitScript.h.
|
inlinestatic |
Get operator as string.
operator_ | operator |
Definition at line 4599 of file MinitScript.h.
|
inlinestatic |
Is given candidate a operator string.
candidate | candidate |
Definition at line 4635 of file MinitScript.h.
|
inlinestatic |
Check if arguments contain argument with given type.
arguments | arguments |
type | type |
Definition at line 4648 of file MinitScript.h.
|
inlinestatic |
Checks if left and right operator arguments have given type.
arguments | arguments |
type | type |
Definition at line 4659 of file MinitScript.h.
|
inlinestatic |
Get boolean value from given variable.
arguments | arguments |
idx | argument index |
value | value |
optional | optionalfalse |
Definition at line 4674 of file MinitScript.h.
|
inlinestatic |
Get integer value from given variable.
arguments | arguments |
idx | argument index |
value | value |
optional | optional |
Definition at line 4688 of file MinitScript.h.
|
inlinestatic |
Get float value from given variable.
arguments | arguments |
idx | argument index |
value | value |
optional | optional |
Definition at line 4702 of file MinitScript.h.
|
inlinestatic |
Get function value from given variable.
arguments | arguments |
idx | argument index |
function | function |
scriptIdx | script index |
optional | optional |
Definition at line 4717 of file MinitScript.h.
|
inlinestatic |
Get stacklet value from given variable.
arguments | arguments |
idx | argument index |
stacklet | stacklet |
scriptIdx | script index |
optional | optional |
Definition at line 4732 of file MinitScript.h.
|
inlinestatic |
Get string value from given variable.
arguments | arguments |
idx | argument index |
value | value |
optional | optional |
Definition at line 4746 of file MinitScript.h.
void registerStateMachineState | ( | StateMachineState * | state | ) |
void registerMethod | ( | Method * | method | ) |
|
inline |
Returns if a given string is a variable name.
candidate | candidate |
statement | statement |
Definition at line 4770 of file MinitScript.h.
|
inline |
Returns if variable determined by given variable statement exists.
variableStatement | variable statement |
subStatement | optional sub statement the variable is read in |
Definition at line 4813 of file MinitScript.h.
|
inline |
Returns variable determined by given variable statement optimized for method argument usage.
variableStatement | variable statement |
subStatement | optional sub statement the variable is read in |
Definition at line 4848 of file MinitScript.h.
|
inline |
Returns variable determined by given variable statement and variable pointer optimized for method argument usage.
variablePtr | variable pointer |
variableStatement | variable statement |
subStatement | optional sub statement the variable is read in |
Definition at line 4891 of file MinitScript.h.
|
inline |
Returns variable determined by given variable statement.
variableStatement | variable statement |
subStatement | optional sub statement the variable is read in |
createReference | optional flag for creating variable references |
Definition at line 4923 of file MinitScript.h.
|
inline |
Returns variable determined by given variable statement and variable pointer.
variablePtr | variable pointer |
variableStatement | variable statement |
subStatement | optional sub statement the variable is read in |
createReference | optional flag for creating variable references |
Definition at line 4967 of file MinitScript.h.
|
inline |
Unsets variable determined by given variable statement and variable pointer.
variablePtr | variable pointer |
variableStatement | variable statement |
subStatement | optional sub statement the variable is read in |
createReference | optional flag for creating variable references |
Definition at line 5000 of file MinitScript.h.
|
inline |
Unsets variable determined by given variable statement.
variableStatement | variable statement |
subStatement | optional sub statement the variable is read in |
Definition at line 5025 of file MinitScript.h.
|
inline |
Set constant by given variable statement and variable.
variableStatement | variable statement |
variable | variable |
Definition at line 5060 of file MinitScript.h.
|
inline |
Set variable by given variable statement and variable.
variableStatement | variable statement |
variable | variable |
subStatement | optional sub statement the variable is written in |
createReference | optional flag for creating variable references |
Definition at line 5073 of file MinitScript.h.
|
inline |
Set variable by given variable pointer, variable statement and variable.
variablePtr | variable pointer |
variableStatement | variable statement |
variable | variable |
subStatement | optional sub statement the variable is written in |
createReference | optional flag for creating variable references |
Definition at line 5130 of file MinitScript.h.
void parseScript | ( | const string & | pathName, |
const string & | fileName, | ||
bool | nativeOnly = false |
||
) |
Parse script.
pathName | path name |
fileName | file name |
nativeOnly | native only |
Definition at line 2658 of file MinitScript.cpp.
|
virtual |
Start script.
Definition at line 2820 of file MinitScript.cpp.
|
inline |
Check if condition with given name exists.
condition | condition |
Definition at line 5173 of file MinitScript.h.
|
virtual |
|
virtual |
Execute.
Definition at line 1647 of file MinitScript.cpp.
|
inline |
Return function script index by function name.
function | function |
Definition at line 5204 of file MinitScript.h.
Call function.
scriptIdx | script index |
arguments | argument values |
returnValue | return value |
Definition at line 5223 of file MinitScript.h.
Call function.
function | function |
arguments | argument values |
returnValue | return value |
Definition at line 5234 of file MinitScript.h.
Call stacklet.
scriptIdx | script index |
arguments | argument values |
returnValue | return value |
Definition at line 5245 of file MinitScript.h.
|
inline |
Call stacklet.
stacklet | stacklet |
arguments | argument values |
returnValue | return value |
Definition at line 5256 of file MinitScript.h.
|
inline |
Evaluate statement.
evaluateStatement | evaluate statement |
returnValue | return value |
Definition at line 5266 of file MinitScript.h.
|
inline |
Definition at line 5280 of file MinitScript.h.
|
inline |
Get method by method name.
methodName | method name |
Definition at line 5289 of file MinitScript.h.
const vector< MinitScript::Method * > getMethods | ( | ) |
Definition at line 3664 of file MinitScript.cpp.
Get method by operator.
operator_ | operator |
Definition at line 5308 of file MinitScript.h.
const vector< MinitScript::Method * > getOperatorMethods | ( | ) |
Definition at line 3722 of file MinitScript.cpp.
const string getScriptInformation | ( | int | scriptIdx, |
bool | includeStatements = true |
||
) |
Get script information for a specific script index.
scriptIdx | script index |
includeStatements | include statements |
Definition at line 3730 of file MinitScript.cpp.
const string getInformation | ( | ) |
Get MinitScript instance information.
Definition at line 3812 of file MinitScript.cpp.
|
friend |
Definition at line 69 of file MinitScript.h.
|
friend |
Definition at line 70 of file MinitScript.h.
|
friend |
Definition at line 71 of file MinitScript.h.
|
friend |
Definition at line 72 of file MinitScript.h.
|
friend |
Definition at line 73 of file MinitScript.h.
|
friend |
Definition at line 74 of file MinitScript.h.
|
staticconstexpr |
Definition at line 2988 of file MinitScript.h.
|
staticconstexpr |
Definition at line 2989 of file MinitScript.h.
|
staticconstexpr |
Definition at line 2990 of file MinitScript.h.
|
staticconstexpr |
Definition at line 2991 of file MinitScript.h.
|
staticconstexpr |
Definition at line 2992 of file MinitScript.h.
|
static |
Definition at line 2994 of file MinitScript.h.
|
static |
Definition at line 2995 of file MinitScript.h.
|
static |
Definition at line 2996 of file MinitScript.h.
|
static |
Definition at line 2997 of file MinitScript.h.
|
static |
Definition at line 2998 of file MinitScript.h.
|
static |
Definition at line 2999 of file MinitScript.h.
|
staticconstexprprotected |
Definition at line 3048 of file MinitScript.h.
|
staticconstexprprotected |
Definition at line 3049 of file MinitScript.h.
|
staticconstexprprotected |
Definition at line 3050 of file MinitScript.h.
|
staticconstexprprotected |
Definition at line 3051 of file MinitScript.h.
|
staticconstexprprotected |
Definition at line 3052 of file MinitScript.h.
|
staticconstexprprotected |
Definition at line 3053 of file MinitScript.h.
|
staticconstexprprotected |
Definition at line 3054 of file MinitScript.h.
|
staticconstexprprotected |
Definition at line 3055 of file MinitScript.h.
|
staticconstexprprotected |
Definition at line 3056 of file MinitScript.h.
|
staticconstexprprotected |
Definition at line 3057 of file MinitScript.h.
|
protected |
Definition at line 3116 of file MinitScript.h.
|
protected |
Definition at line 3117 of file MinitScript.h.
|
protected |
Definition at line 3118 of file MinitScript.h.
|
protected |
Definition at line 3119 of file MinitScript.h.
|
protected |
Definition at line 3120 of file MinitScript.h.
|
protected |
Definition at line 3121 of file MinitScript.h.
|
protected |
Definition at line 3122 of file MinitScript.h.
|
protected |
Definition at line 3125 of file MinitScript.h.
|
protected |
Definition at line 3126 of file MinitScript.h.
|
protected |
Definition at line 3128 of file MinitScript.h.
|
protected |
Definition at line 3129 of file MinitScript.h.
|
protected |
Definition at line 3131 of file MinitScript.h.
|
protected |
Definition at line 3132 of file MinitScript.h.
|
protected |
Definition at line 3134 of file MinitScript.h.
|
protected |
Definition at line 3136 of file MinitScript.h.
|
protected |
Definition at line 3137 of file MinitScript.h.
|
protected |
Definition at line 3139 of file MinitScript.h.
|
protected |
Definition at line 3140 of file MinitScript.h.
|
staticconstexprprivate |
Definition at line 3495 of file MinitScript.h.
|
staticconstexprprivate |
Definition at line 3496 of file MinitScript.h.
|
staticconstexprprivate |
Definition at line 3497 of file MinitScript.h.
|
staticprivate |
Definition at line 3522 of file MinitScript.h.
|
staticprivate |
Definition at line 3523 of file MinitScript.h.
|
staticprivate |
Definition at line 3524 of file MinitScript.h.
|
private |
Definition at line 3527 of file MinitScript.h.
|
private |
Definition at line 3531 of file MinitScript.h.
|
private |
Definition at line 3533 of file MinitScript.h.
|
private |
Definition at line 3535 of file MinitScript.h.
|
private |
Definition at line 3537 of file MinitScript.h.
|
private |
Definition at line 3539 of file MinitScript.h.
|
private |
Definition at line 3540 of file MinitScript.h.
|
private |
Definition at line 3542 of file MinitScript.h.
|
private |
Definition at line 3566 of file MinitScript.h.
|
private |
Definition at line 3567 of file MinitScript.h.
|
private |
Definition at line 3568 of file MinitScript.h.