@algosail/parser 0.0.2 → 0.0.3
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.
- package/index.js +19 -3
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -13,18 +13,34 @@ export async function createParser() {
|
|
|
13
13
|
parseJs,
|
|
14
14
|
sailTokenizer,
|
|
15
15
|
jsTokenizer,
|
|
16
|
-
|
|
16
|
+
getAST,
|
|
17
|
+
setAST,
|
|
18
|
+
removeAST,
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function getAST(uri) {
|
|
22
|
+
return cache.get(uri)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function setAST(uri, ast) {
|
|
26
|
+
cache.set(uri, ast)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function removeAST(uri) {
|
|
30
|
+
cache.delete(uri)
|
|
17
31
|
}
|
|
18
32
|
|
|
19
33
|
async function parseSail(uri, text) {
|
|
20
34
|
const res = await buildSymbolTable(uri, text, parser)
|
|
21
|
-
|
|
35
|
+
setAST(uri, res)
|
|
22
36
|
return res
|
|
23
37
|
}
|
|
24
38
|
|
|
25
39
|
async function parseJs(uri, text) {
|
|
26
40
|
const res = await parseJsDoc(uri, text, parser)
|
|
27
|
-
|
|
41
|
+
setAST(uri, res)
|
|
28
42
|
return res
|
|
29
43
|
}
|
|
44
|
+
|
|
45
|
+
return parser
|
|
30
46
|
}
|