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 |
880 |
* instance. |
* instance. |
881 |
*/ |
*/ |
882 |
virtual void signalAbort() = 0; |
virtual void signalAbort() = 0; |
883 |
|
|
884 |
|
/** |
885 |
|
* Copies the current entire execution state from this object to the |
886 |
|
* given object. So this can be used to "fork" a new script thread which |
887 |
|
* then may run independently with its own polyphonic data for instance. |
888 |
|
*/ |
889 |
|
virtual void forkTo(VMExecContext* ectx) const = 0; |
890 |
}; |
}; |
891 |
|
|
892 |
/** @brief Script callback for a certain event. |
/** @brief Script callback for a certain event. |
918 |
}; |
}; |
919 |
|
|
920 |
/** |
/** |
921 |
|
* Reflects the precise position and span of a specific code block within |
922 |
|
* a script. This is currently only used for the locations of commented |
923 |
|
* code blocks due to preprocessor statements, and for parser errors and |
924 |
|
* parser warnings. |
925 |
|
* |
926 |
|
* @see ParserIssue for code locations of parser errors and parser warnings |
927 |
|
* |
928 |
|
* @see VMParserContext::preprocessorComments() for locations of code which |
929 |
|
* have been filtered out by preprocessor statements |
930 |
|
*/ |
931 |
|
struct CodeBlock { |
932 |
|
int firstLine; ///< The first line number of this code block within the script (indexed with 1 being the very first line). |
933 |
|
int lastLine; ///< The last line number of this code block within the script. |
934 |
|
int firstColumn; ///< The first column of this code block within the script (indexed with 1 being the very first column). |
935 |
|
int lastColumn; ///< The last column of this code block within the script. |
936 |
|
}; |
937 |
|
|
938 |
|
/** |
939 |
* Encapsulates a noteworty parser issue. This encompasses the type of the |
* Encapsulates a noteworty parser issue. This encompasses the type of the |
940 |
* issue (either a parser error or parser warning), a human readable |
* issue (either a parser error or parser warning), a human readable |
941 |
* explanation text of the error or warning and the location of the |
* explanation text of the error or warning and the location of the |
943 |
* |
* |
944 |
* @see VMSourceToken for processing syntax highlighting instead. |
* @see VMSourceToken for processing syntax highlighting instead. |
945 |
*/ |
*/ |
946 |
struct ParserIssue { |
struct ParserIssue : CodeBlock { |
947 |
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. |
|
948 |
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. |
949 |
|
|
950 |
/** |
/** |
1024 |
virtual std::vector<ParserIssue> warnings() const = 0; |
virtual std::vector<ParserIssue> warnings() const = 0; |
1025 |
|
|
1026 |
/** |
/** |
1027 |
|
* Returns all code blocks of the script which were filtered out by the |
1028 |
|
* preprocessor. |
1029 |
|
*/ |
1030 |
|
virtual std::vector<CodeBlock> preprocessorComments() const = 0; |
1031 |
|
|
1032 |
|
/** |
1033 |
* Returns the translated virtual machine representation of an event |
* Returns the translated virtual machine representation of an event |
1034 |
* handler block (i.e. "on note ... end on" code block) within the |
* handler block (i.e. "on note ... end on" code block) within the |
1035 |
* parsed script. This translated representation of the event handler |
* parsed script. This translated representation of the event handler |