Doesn't work right in ScriptManager, looks like a conflict with JSDoc
Showing the changes to libraries/script-engine/src/ScriptProgram.h (1 of 5 files). Show all
Unified · Split
| @@ -4,6 +4,7 @@ · 3 unmodified lines | |||
| 4 | // | 4 | // |
| 5 | // Created by Heather Anderson on 5/2/21. | 5 | // Created by Heather Anderson on 5/2/21. |
| 6 | // Copyright 2021 Vircadia contributors. | 6 | // Copyright 2021 Vircadia contributors. |
| 7 | // Copyright 2023 Overte e.V. | ||
| 7 | // | 8 | // |
| 8 | // Distributed under the Apache License, Version 2.0. | 9 | // Distributed under the Apache License, Version 2.0. |
| 9 | // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html | 10 | // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html |
| @@ -22,32 +23,93 @@ class ScriptSyntaxCheckResult; · 12 unmodified lines | |||
| 22 | using ScriptProgramPointer = std::shared_ptr<ScriptProgram>; | 23 | using ScriptProgramPointer = std::shared_ptr<ScriptProgram>; |
| 23 | using ScriptSyntaxCheckResultPointer = std::shared_ptr<ScriptSyntaxCheckResult>; | 24 | using ScriptSyntaxCheckResultPointer = std::shared_ptr<ScriptSyntaxCheckResult>; |
| 24 | 25 | ||
| 25 | /// [ScriptInterface] Provides an engine-independent interface for QScriptProgram | 26 | /** |
| 27 | * @brief Engine-independent representation of a script program | ||
| 28 | * | ||
| 29 | * This is an analog of QScriptProgram from Qt5. | ||
| 30 | * | ||
| 31 | * It's used to pre-compile scripts, and to check their syntax. | ||
| 32 | * | ||
| 33 | */ | ||
| 26 | class ScriptProgram { | 34 | class ScriptProgram { |
| 27 | public: | 35 | public: |
| 28 | virtual ScriptSyntaxCheckResultPointer checkSyntax() = 0; //It cannot be const anymore because V8 doesn't have separate syntax checking function | 36 | virtual ScriptSyntaxCheckResultPointer checkSyntax() = 0; //It cannot be const anymore because V8 doesn't have separate syntax checking function |
| 37 | |||
| 38 | /** | ||
| 39 | * @brief Returns the filename associated with this program. | ||
| 40 | * | ||
| 41 | * @return QString | ||
| 42 | */ | ||
| 29 | virtual QString fileName() const = 0; | 43 | virtual QString fileName() const = 0; |
| 44 | |||
| 45 | /** | ||
| 46 | * @brief Returns the source code of this program. | ||
| 47 | * | ||
| 48 | * @return QString | ||
| 49 | */ | ||
| 30 | virtual QString sourceCode() const = 0; | 50 | virtual QString sourceCode() const = 0; |
| 31 | 51 | ||
| 32 | protected: | 52 | protected: |
| 33 | ~ScriptProgram() {} // prevent explicit deletion of base class | 53 | ~ScriptProgram() {} // prevent explicit deletion of base class |
| 34 | }; | 54 | }; |
| 35 | 55 | ||
| 36 | /// [ScriptInterface] Provides an engine-independent interface for QScriptSyntaxCheckResult | 56 | |
| 57 | /** | ||
| 58 | * @brief Engine-independent representation of a script syntax check | ||
| 59 | * | ||
| 60 | * This is an analog of QScriptSyntaxCheckResult from Qt5. | ||
| 61 | * | ||
| 62 | * | ||
| 63 | */ | ||
| 37 | class ScriptSyntaxCheckResult { | 64 | class ScriptSyntaxCheckResult { |
| 38 | public: | 65 | public: |
| 66 | |||
| 67 | /** | ||
| 68 | * @brief State of the syntax check | ||
| 69 | * | ||
| 70 | */ | ||
| 39 | enum State | 71 | enum State |
| 40 | { | 72 | { |
| 41 | Error = 0, | 73 | Error = 0, /** The program contains a syntax error. */ |
| 42 | Intermediate = 1, | 74 | Intermediate = 1, /** The program is incomplete. */ |
| 43 | Valid = 2 | 75 | Valid = 2 /** The program is a syntactically correct program. */ |
| 44 | }; | 76 | }; |
| 45 | 77 | ||
| 46 | public: | 78 | public: |
| 79 | |||
| 80 | /** | ||
| 81 | * @brief Returns the error column number of this ScriptSyntaxCheckResult, or -1 if there is no error. | ||
| 82 | * | ||
| 83 | * @return int | ||
| 84 | */ | ||
| 47 | virtual int errorColumnNumber() const = 0; | 85 | virtual int errorColumnNumber() const = 0; |
| 86 | |||
| 87 | /** | ||
| 88 | * @brief Returns the error line number of this ScriptSyntaxCheckResult, or -1 if there is no error. | ||
| 89 | * | ||
| 90 | * @return int | ||
| 91 | */ | ||
| 48 | virtual int errorLineNumber() const = 0; | 92 | virtual int errorLineNumber() const = 0; |
| 93 | |||
| 94 | /** | ||
| 95 | * @brief Returns the error message of this ScriptSyntaxCheckResult, or an empty string if there is no error. | ||
| 96 | * | ||
| 97 | * @return QString | ||
| 98 | */ | ||
| 49 | virtual QString errorMessage() const = 0; | 99 | virtual QString errorMessage() const = 0; |
| 100 | |||
| 101 | /** | ||
| 102 | * @brief | ||
| 103 | * | ||
| 104 | * @return QString | ||
| 105 | */ | ||
| 50 | virtual QString errorBacktrace() const = 0; | 106 | virtual QString errorBacktrace() const = 0; |
| 107 | |||
| 108 | /** | ||
| 109 | * @brief Returns the state of this ScriptSyntaxCheckResult. | ||
| 110 | * | ||
| 111 | * @return State | ||
| 112 | */ | ||
| 51 | virtual State state() const = 0; | 113 | virtual State state() const = 0; |
| 52 | 114 | ||
| 53 | protected: | 115 | protected: |