9 |
|
|
10 |
// This header defines data types shared between the VM core implementation |
// This header defines data types shared between the VM core implementation |
11 |
// (inside the current source directory) and other parts of the sampler |
// (inside the current source directory) and other parts of the sampler |
12 |
// (located at other source directories). |
// (located at other source directories). It also acts as public API of the |
13 |
|
// Real-Time script engine for other applications. |
14 |
|
|
15 |
#ifndef LS_INSTR_SCRIPT_PARSER_COMMON_H |
#ifndef LS_INSTR_SCRIPT_PARSER_COMMON_H |
16 |
#define LS_INSTR_SCRIPT_PARSER_COMMON_H |
#define LS_INSTR_SCRIPT_PARSER_COMMON_H |
645 |
struct VMInt8Array { |
struct VMInt8Array { |
646 |
int8_t* data; |
int8_t* data; |
647 |
int size; |
int size; |
648 |
|
bool readonly; ///< Whether the array data may be modified or just be read. |
649 |
|
|
650 |
VMInt8Array() : data(NULL), size(0) {} |
VMInt8Array() : data(NULL), size(0), readonly(false) {} |
651 |
}; |
}; |
652 |
|
|
653 |
/** @brief Virtual machine script variable. |
/** @brief Virtual machine script variable. |
872 |
* ScriptVM::exec() call. |
* ScriptVM::exec() call. |
873 |
*/ |
*/ |
874 |
virtual size_t instructionsPerformed() const = 0; |
virtual size_t instructionsPerformed() const = 0; |
875 |
|
|
876 |
|
/** |
877 |
|
* Sends a signal to this script execution instance to abort its script |
878 |
|
* execution as soon as possible. This method is called i.e. when one |
879 |
|
* script execution instance intends to stop another script execution |
880 |
|
* instance. |
881 |
|
*/ |
882 |
|
virtual void signalAbort() = 0; |
883 |
}; |
}; |
884 |
|
|
885 |
/** @brief Script callback for a certain event. |
/** @brief Script callback for a certain event. |
911 |
}; |
}; |
912 |
|
|
913 |
/** |
/** |
914 |
|
* Reflects the precise position and span of a specific code block within |
915 |
|
* a script. This is currently only used for the locations of commented |
916 |
|
* code blocks due to preprocessor statements, and for parser errors and |
917 |
|
* parser warnings. |
918 |
|
* |
919 |
|
* @see ParserIssue for code locations of parser errors and parser warnings |
920 |
|
* |
921 |
|
* @see VMParserContext::preprocessorComments() for locations of code which |
922 |
|
* have been filtered out by preprocessor statements |
923 |
|
*/ |
924 |
|
struct CodeBlock { |
925 |
|
int firstLine; ///< The first line number of this code block within the script (indexed with 1 being the very first line). |
926 |
|
int lastLine; ///< The last line number of this code block within the script. |
927 |
|
int firstColumn; ///< The first column of this code block within the script (indexed with 1 being the very first column). |
928 |
|
int lastColumn; ///< The last column of this code block within the script. |
929 |
|
}; |
930 |
|
|
931 |
|
/** |
932 |
* Encapsulates a noteworty parser issue. This encompasses the type of the |
* Encapsulates a noteworty parser issue. This encompasses the type of the |
933 |
* issue (either a parser error or parser warning), a human readable |
* issue (either a parser error or parser warning), a human readable |
934 |
* explanation text of the error or warning and the location of the |
* explanation text of the error or warning and the location of the |
936 |
* |
* |
937 |
* @see VMSourceToken for processing syntax highlighting instead. |
* @see VMSourceToken for processing syntax highlighting instead. |
938 |
*/ |
*/ |
939 |
struct ParserIssue { |
struct ParserIssue : CodeBlock { |
940 |
String txt; ///< Human readable explanation text of the parser issue. |
String txt; ///< Human readable explanation text of the parser issue. |
|
int firstLine; ///< The first line number within the script where this issue was encountered (indexed with 1 being the very first line). |
|
|
int lastLine; ///< The last line number within the script where this issue was encountered. |
|
|
int firstColumn; ///< The first column within the script where this issue was encountered (indexed with 1 being the very first column). |
|
|
int lastColumn; ///< The last column within the script where this issue was encountered. |
|
941 |
ParserIssueType_t type; ///< Whether this issue is either a parser error or just a parser warning. |
ParserIssueType_t type; ///< Whether this issue is either a parser error or just a parser warning. |
942 |
|
|
943 |
/** |
/** |
1017 |
virtual std::vector<ParserIssue> warnings() const = 0; |
virtual std::vector<ParserIssue> warnings() const = 0; |
1018 |
|
|
1019 |
/** |
/** |
1020 |
|
* Returns all code blocks of the script which were filtered out by the |
1021 |
|
* preprocessor. |
1022 |
|
*/ |
1023 |
|
virtual std::vector<CodeBlock> preprocessorComments() const = 0; |
1024 |
|
|
1025 |
|
/** |
1026 |
* Returns the translated virtual machine representation of an event |
* Returns the translated virtual machine representation of an event |
1027 |
* handler block (i.e. "on note ... end on" code block) within the |
* handler block (i.e. "on note ... end on" code block) within the |
1028 |
* parsed script. This translated representation of the event handler |
* parsed script. This translated representation of the event handler |