@sdeverywhere/compile 0.7.17 → 0.7.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,36 +0,0 @@
1
- // Copyright (c) 2022 Climate Interactive / New Venture Fund
2
-
3
- import antlr4 from 'antlr4'
4
- import { ModelLexer, ModelParser } from 'antlr4-vensim'
5
-
6
- /**
7
- * @typedef {object} VensimModelParseTree
8
- */
9
-
10
- /**
11
- * Create a `ModelParser` for the given model text, which can be the
12
- * contents of an entire `mdl` file, or a portion of one (e.g., an
13
- * expression or definition).
14
- *
15
- * @param {string} input The string containing the model text.
16
- * @return {ModelParser} A `ModelParser` from which a parse tree can be obtained.
17
- */
18
- export function createParser(input) {
19
- let chars = new antlr4.InputStream(input)
20
- let lexer = new ModelLexer(chars)
21
- let tokens = new antlr4.CommonTokenStream(lexer)
22
- let parser = new ModelParser(tokens)
23
- parser.buildParseTrees = true
24
- return parser
25
- }
26
-
27
- /**
28
- * Read the given model text and return a parse tree.
29
- *
30
- * @param {string} input The string containing the model text.
31
- * @return {VensimModelParseTree} A parse tree representation of the model.
32
- */
33
- export function parseModel(input) {
34
- let parser = createParser(input)
35
- return parser.model()
36
- }