@shapeshift-labs/frontier-lang-parser 0.3.37 → 0.3.38
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/dist/index.js +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -37,7 +37,7 @@ export function parseFrontierSource(source, options = {}) {
|
|
|
37
37
|
const runtimeCapabilityBlocks = [], targetProjectionTargets = [];
|
|
38
38
|
const documentId = options.id ?? readId(source) ?? 'mod_frontier';
|
|
39
39
|
const documentName = options.name ?? readName(source) ?? 'FrontierModule';
|
|
40
|
-
for (const block of readBlocks(source)) {
|
|
40
|
+
for (const block of readBlocks(source, options)) {
|
|
41
41
|
if (block.kind === 'entity') nodes.push(parseEntity(block));
|
|
42
42
|
if (block.kind === 'state') nodes.push(parseState(block));
|
|
43
43
|
if (block.kind === 'action') nodes.push(parseAction(block));
|
|
@@ -76,8 +76,8 @@ export function parseFrontierFile(name, source) { return parseFrontierSource(sou
|
|
|
76
76
|
|
|
77
77
|
function readName(source) { return /module\s+([A-Za-z_$][\w$]*)/.exec(source)?.[1]; }
|
|
78
78
|
function readId(source) { return /module\s+[A-Za-z_$][\w$]*\s+@id\(\s*["']([^"']+)["']\s*\)/.exec(source)?.[1]; }
|
|
79
|
-
function readBlocks(source) {
|
|
80
|
-
return readFrontierSourceBlocks(source);
|
|
79
|
+
function readBlocks(source, options) {
|
|
80
|
+
return readFrontierSourceBlocks(source, options);
|
|
81
81
|
}
|
|
82
82
|
function idFrom(header, fallback) { return /@id\(\s*["']([^"']+)["']\s*\)/.exec(header)?.[1] ?? fallback; }
|
|
83
83
|
function nameFrom(header) { return /^([A-Za-z_$][\w$]*)/.exec(header)?.[1] ?? 'Unnamed'; }
|