OMCompiler/Compiler/FrontEnd/ParserExt.mo
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /* | ||
| 2 | * This file is part of OpenModelica. | ||
| 3 | * | ||
| 4 | * Copyright (c) 1998-2026, Open Source Modelica Consortium (OSMC), | ||
| 5 | * c/o Linköpings universitet, Department of Computer and Information Science, | ||
| 6 | * SE-58183 Linköping, Sweden. | ||
| 7 | * | ||
| 8 | * All rights reserved. | ||
| 9 | * | ||
| 10 | * THIS PROGRAM IS PROVIDED UNDER THE TERMS OF AGPL VERSION 3 LICENSE OR | ||
| 11 | * THIS OSMC PUBLIC LICENSE (OSMC-PL) VERSION 1.8. | ||
| 12 | * ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS PROGRAM CONSTITUTES | ||
| 13 | * RECIPIENT'S ACCEPTANCE OF THE OSMC PUBLIC LICENSE OR THE GNU AGPL | ||
| 14 | * VERSION 3, ACCORDING TO RECIPIENTS CHOICE. | ||
| 15 | * | ||
| 16 | * The OpenModelica software and the OSMC (Open Source Modelica Consortium) | ||
| 17 | * Public License (OSMC-PL) are obtained from OSMC, either from the above | ||
| 18 | * address, from the URLs: | ||
| 19 | * http://www.openmodelica.org or | ||
| 20 | * https://github.com/OpenModelica/ or | ||
| 21 | * http://www.ida.liu.se/projects/OpenModelica, | ||
| 22 | * and in the OpenModelica distribution. | ||
| 23 | * | ||
| 24 | * GNU AGPL version 3 is obtained from: | ||
| 25 | * https://www.gnu.org/licenses/licenses.html#GPL | ||
| 26 | * | ||
| 27 | * This program is distributed WITHOUT ANY WARRANTY; without | ||
| 28 | * even the implied warranty of MERCHANTABILITY or FITNESS | ||
| 29 | * FOR A PARTICULAR PURPOSE, EXCEPT AS EXPRESSLY SET FORTH | ||
| 30 | * IN THE BY RECIPIENT SELECTED SUBSIDIARY LICENSE CONDITIONS OF OSMC-PL. | ||
| 31 | * | ||
| 32 | * See the full OSMC Public License conditions for more details. | ||
| 33 | * | ||
| 34 | */ | ||
| 35 | |||
| 36 | encapsulated package ParserExt | ||
| 37 | " file: Parser.mo | ||
| 38 | package: Parser | ||
| 39 | description: Interface to external code for parsing | ||
| 40 | |||
| 41 | $Id$ | ||
| 42 | |||
| 43 | The parser module is used for both parsing of files and statements in | ||
| 44 | interactive mode." | ||
| 45 | |||
| 46 | public import Absyn; | ||
| 47 | public import GlobalScript; | ||
| 48 | |||
| 49 | ✗ | public function parse "Parse a mo-file" | |
| 50 | input String filename; | ||
| 51 | input String infoFilename; | ||
| 52 | input Integer acceptedGram; | ||
| 53 | input String encoding; | ||
| 54 | input Integer languageStandardInt; | ||
| 55 | input Boolean strict; | ||
| 56 | input Boolean runningTestsuite; | ||
| 57 | input String libraryPath; | ||
| 58 | input Option<Integer> lveInstance; | ||
| 59 | output Absyn.Program outProgram; | ||
| 60 | |||
| 61 | external "C" outProgram=ParserExt_parse(filename, infoFilename, acceptedGram, languageStandardInt, strict, encoding, runningTestsuite, libraryPath, lveInstance) annotation(Library = {"omparse","omantlr3","omcruntime"}); | ||
| 62 | end parse; | ||
| 63 | |||
| 64 | 1265803 | public function parseexp "Parse a mos-file" | |
| 65 | input String filename; | ||
| 66 | input String infoFilename; | ||
| 67 | input Integer acceptedGram; | ||
| 68 | input Integer languageStandardInt; | ||
| 69 | input Boolean runningTestsuite; | ||
| 70 | output GlobalScript.Statements outStatements; | ||
| 71 | |||
| 72 | external "C" outStatements=ParserExt_parseexp(filename, infoFilename, acceptedGram, languageStandardInt, runningTestsuite) annotation(Library = {"omparse","omantlr3","omcruntime"}); | ||
| 73 | end parseexp; | ||
| 74 | |||
| 75 | 1683 | public function parsestring "Parse a string as if it were a stored definition" | |
| 76 | input String str; | ||
| 77 | input String infoFilename = "<interactive>"; | ||
| 78 | input Integer acceptedGram; | ||
| 79 | input Integer languageStandardInt; | ||
| 80 | input Boolean strict; | ||
| 81 | input Boolean runningTestsuite; | ||
| 82 | output Absyn.Program outProgram; | ||
| 83 | external "C" outProgram=ParserExt_parsestring(str,infoFilename, acceptedGram, languageStandardInt, strict, runningTestsuite) annotation(Library = {"omparse","omantlr3","omcruntime"}); | ||
| 84 | end parsestring; | ||
| 85 | |||
| 86 | 859 | public function parsestringexp "Parse a string as if it was a sequence of statements" | |
| 87 | input String str; | ||
| 88 | input String infoFilename = "<interactive>"; | ||
| 89 | input Integer acceptedGram; | ||
| 90 | input Integer languageStandardInt; | ||
| 91 | input Boolean runningTestsuite; | ||
| 92 | output GlobalScript.Statements outStatements; | ||
| 93 | external "C" outStatements=ParserExt_parsestringexp(str,infoFilename, acceptedGram, languageStandardInt, runningTestsuite) annotation(Library = {"omparse","omantlr3","omcruntime"}); | ||
| 94 | end parsestringexp; | ||
| 95 | |||
| 96 | 479 | public function stringPath | |
| 97 | input String str; | ||
| 98 | input String infoFilename; | ||
| 99 | input Integer acceptedGram; | ||
| 100 | input Integer languageStandardInt; | ||
| 101 | input Boolean runningTestsuite; | ||
| 102 | output Absyn.Path path; | ||
| 103 | external "C" path=ParserExt_stringPath(str, infoFilename, acceptedGram, languageStandardInt, runningTestsuite) annotation(Library = {"omparse","omantlr3","omcruntime"}); | ||
| 104 | end stringPath; | ||
| 105 | |||
| 106 | ✗ | public function stringCref | |
| 107 | input String str; | ||
| 108 | input String infoFilename; | ||
| 109 | input Integer acceptedGram; | ||
| 110 | input Integer languageStandardInt; | ||
| 111 | input Boolean runningTestsuite; | ||
| 112 | output Absyn.ComponentRef cref; | ||
| 113 | external "C" cref=ParserExt_stringCref(str, infoFilename, acceptedGram, languageStandardInt, runningTestsuite) annotation(Library = {"omparse","omantlr3","omcruntime"}); | ||
| 114 | end stringCref; | ||
| 115 | |||
| 116 | 4 | public function stringMod | |
| 117 | input String str; | ||
| 118 | input String infoFilename; | ||
| 119 | input Integer acceptedGram; | ||
| 120 | input Integer languageStandardInt; | ||
| 121 | input Boolean runningTestsuite; | ||
| 122 | output Absyn.ElementArg cref; | ||
| 123 | external "C" cref=ParserExt_stringMod(str, infoFilename, acceptedGram, languageStandardInt, runningTestsuite) annotation(Library = {"omparse","omantlr3","omcruntime"}); | ||
| 124 | end stringMod; | ||
| 125 | |||
| 126 | 51 | public function stringEq | |
| 127 | input String str; | ||
| 128 | input String infoFilename; | ||
| 129 | input Integer acceptedGram; | ||
| 130 | input Integer languageStandardInt; | ||
| 131 | input Boolean runningTestsuite; | ||
| 132 | output Absyn.EquationItem eq; | ||
| 133 | external "C" eq=ParserExt_stringEq(str, infoFilename, acceptedGram, languageStandardInt, runningTestsuite) annotation(Library = {"omparse","omantlr3","omcruntime"}); | ||
| 134 | end stringEq; | ||
| 135 | |||
| 136 | 17 | public function startLibraryVendorExecutable "Starts the library vendor executable" | |
| 137 | input String lvePath; | ||
| 138 | output Boolean success; | ||
| 139 | output Option<Integer> lveInstance "Stores a pointer. If it is declared as Integer, it is truncated to 32-bit."; | ||
| 140 | |||
| 141 | external "C" success=ParserExt_startLibraryVendorExecutable(lvePath, lveInstance) annotation(Library = {"omparse","omantlr3","omcruntime"}); | ||
| 142 | end startLibraryVendorExecutable; | ||
| 143 | |||
| 144 | ✗ | public function checkLVEToolLicense | |
| 145 | input Option<Integer> lveInstance; | ||
| 146 | input String packageName; | ||
| 147 | output Boolean status; | ||
| 148 | |||
| 149 | external "C" status=ParserExt_checkLVEToolLicense(lveInstance, packageName) annotation(Library = {"omparse","omantlr3","omcruntime"}); | ||
| 150 | end checkLVEToolLicense; | ||
| 151 | |||
| 152 | ✗ | public function checkLVEToolFeature | |
| 153 | input Option<Integer> lveInstance; | ||
| 154 | input String feature; | ||
| 155 | output Boolean status; | ||
| 156 | |||
| 157 | external "C" status=ParserExt_checkLVEToolFeature(lveInstance, feature) annotation(Library = {"omparse","omantlr3","omcruntime"}); | ||
| 158 | end checkLVEToolFeature; | ||
| 159 | |||
| 160 | ✗ | public function stopLibraryVendorExecutable | |
| 161 | input Option<Integer> lveInstance "Stores a pointer. If it is declared as Integer, it is truncated to 32-bit."; | ||
| 162 | |||
| 163 | external "C" ParserExt_stopLibraryVendorExecutable(lveInstance) annotation(Library = {"omparse","omantlr3","omcruntime"}); | ||
| 164 | end stopLibraryVendorExecutable; | ||
| 165 | |||
| 166 | annotation(__OpenModelica_Interface="parser"); | ||
| 167 | end ParserExt; | ||
| 168 |