@aehrc/ecl-core 1.5.0 → 1.6.0
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/canonical/canonical-printer.d.ts.map +1 -1
- package/dist/canonical/normaliser.d.ts.map +1 -1
- package/dist/formatter/ast-printer.d.ts.map +1 -1
- package/dist/index.cjs +67 -22
- package/dist/index.mjs +67 -22
- package/dist/parser/ast.d.ts +13 -1
- package/dist/parser/ast.d.ts.map +1 -1
- package/dist/parser/concept-extractor.d.ts.map +1 -1
- package/dist/parser/visitor.d.ts +5 -2
- package/dist/parser/visitor.d.ts.map +1 -1
- package/dist/semantic-tokens.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canonical-printer.d.ts","sourceRoot":"","sources":["../../src/canonical/canonical-printer.ts"],"names":[],"mappings":"AAMA,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,iBAAiB,EAKtB,KAAK,oBAAoB,EAG1B,MAAM,eAAe,CAAC;AAEvB;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,GAAG,EAAE,cAAc,GAAG,iBAAiB,EACvC,UAAU,EAAE,MAAM,EAClB,aAAa,CAAC,EAAE,MAAM,GACrB,MAAM,CAKR;
|
|
1
|
+
{"version":3,"file":"canonical-printer.d.ts","sourceRoot":"","sources":["../../src/canonical/canonical-printer.ts"],"names":[],"mappings":"AAMA,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,iBAAiB,EAKtB,KAAK,oBAAoB,EAG1B,MAAM,eAAe,CAAC;AAEvB;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,GAAG,EAAE,cAAc,GAAG,iBAAiB,EACvC,UAAU,EAAE,MAAM,EAClB,aAAa,CAAC,EAAE,MAAM,GACrB,MAAM,CAKR;AAwID;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,oBAAoB,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAiBrF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normaliser.d.ts","sourceRoot":"","sources":["../../src/canonical/normaliser.ts"],"names":[],"mappings":"AAMA,OAAO,EAEL,KAAK,cAAc,
|
|
1
|
+
{"version":3,"file":"normaliser.d.ts","sourceRoot":"","sources":["../../src/canonical/normaliser.ts"],"names":[],"mappings":"AAMA,OAAO,EAEL,KAAK,cAAc,EAgBpB,MAAM,eAAe,CAAC;AAGvB;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,GAAG,cAAc,CAEpF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ast-printer.d.ts","sourceRoot":"","sources":["../../src/formatter/ast-printer.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,cAAc,EAUpB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAGnD;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,cAAc,GAAG,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,GAAG,MAAM,CAK3G;
|
|
1
|
+
{"version":3,"file":"ast-printer.d.ts","sourceRoot":"","sources":["../../src/formatter/ast-printer.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,cAAc,EAUpB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAGnD;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,cAAc,GAAG,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,GAAG,MAAM,CAK3G;AAkbD,6DAA6D;AAC7D,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAGnD"}
|
package/dist/index.cjs
CHANGED
|
@@ -41695,6 +41695,7 @@ var NodeType = /* @__PURE__ */ function(NodeType) {
|
|
|
41695
41695
|
NodeType["AttributeName"] = "AttributeName";
|
|
41696
41696
|
NodeType["AttributeValue"] = "AttributeValue";
|
|
41697
41697
|
NodeType["Wildcard"] = "Wildcard";
|
|
41698
|
+
NodeType["AlternateIdentifier"] = "AlternateIdentifier";
|
|
41698
41699
|
NodeType["FilterConstraint"] = "FilterConstraint";
|
|
41699
41700
|
NodeType["HistorySupplement"] = "HistorySupplement";
|
|
41700
41701
|
return NodeType;
|
|
@@ -41759,6 +41760,7 @@ var ECLASTVisitor = class extends import_AbstractParseTreeVisitor.AbstractParseT
|
|
|
41759
41760
|
range: this.getRange(ctx),
|
|
41760
41761
|
operator,
|
|
41761
41762
|
memberOf: memberOfCtx ? true : void 0,
|
|
41763
|
+
memberFields: memberOfCtx ? this.memberFields(memberOfCtx) : void 0,
|
|
41762
41764
|
focus: innerExpr
|
|
41763
41765
|
};
|
|
41764
41766
|
this.attachFiltersAndHistory(ctx, node);
|
|
@@ -41777,6 +41779,7 @@ var ECLASTVisitor = class extends import_AbstractParseTreeVisitor.AbstractParseT
|
|
|
41777
41779
|
range: this.getRange(ctx),
|
|
41778
41780
|
operator,
|
|
41779
41781
|
memberOf: memberOfCtx ? true : void 0,
|
|
41782
|
+
memberFields: memberOfCtx ? this.memberFields(memberOfCtx) : void 0,
|
|
41780
41783
|
focus
|
|
41781
41784
|
};
|
|
41782
41785
|
this.attachFiltersAndHistory(ctx, node);
|
|
@@ -41785,15 +41788,29 @@ var ECLASTVisitor = class extends import_AbstractParseTreeVisitor.AbstractParseT
|
|
|
41785
41788
|
visitEclfocusconcept(ctx) {
|
|
41786
41789
|
const conceptRef = ctx.eclconceptreference();
|
|
41787
41790
|
if (conceptRef) return this.visit(conceptRef);
|
|
41788
|
-
|
|
41791
|
+
const altId = ctx.altidentifier();
|
|
41792
|
+
if (altId) return this.alternateIdentifier(altId);
|
|
41793
|
+
return {
|
|
41789
41794
|
type: NodeType.Wildcard,
|
|
41790
41795
|
range: this.getRange(ctx)
|
|
41791
41796
|
};
|
|
41797
|
+
}
|
|
41798
|
+
alternateIdentifier(ctx) {
|
|
41799
|
+
const scheme = ctx.altidentifierschemealias()?.text ?? "";
|
|
41800
|
+
const quoted = ctx.altidentifiercodewithinquotes();
|
|
41801
|
+
const code = quoted ? quoted.text : ctx.altidentifiercodewithoutquotes()?.text ?? "";
|
|
41792
41802
|
return {
|
|
41793
|
-
type: NodeType.
|
|
41794
|
-
range: this.getRange(ctx)
|
|
41803
|
+
type: NodeType.AlternateIdentifier,
|
|
41804
|
+
range: this.getRange(ctx),
|
|
41805
|
+
identifier: quoted ? `"${scheme}#${code}"` : `${scheme}#${code}`,
|
|
41806
|
+
term: ctx.term()?.text
|
|
41795
41807
|
};
|
|
41796
41808
|
}
|
|
41809
|
+
/** Field names from `^ [a, b]`, `['*']` for `^ [*]`, undefined for a plain `^`. */
|
|
41810
|
+
memberFields(ctx) {
|
|
41811
|
+
if (ctx.wildcard()) return ["*"];
|
|
41812
|
+
return ctx.refsetfieldnameset()?.refsetfieldname().map((f) => f.text);
|
|
41813
|
+
}
|
|
41797
41814
|
visitEclconceptreference(ctx) {
|
|
41798
41815
|
const conceptId = ctx.conceptid().text;
|
|
41799
41816
|
const termCtx = ctx.term();
|
|
@@ -41975,7 +41992,7 @@ var ECLASTVisitor = class extends import_AbstractParseTreeVisitor.AbstractParseT
|
|
|
41975
41992
|
const nameSubExpr = nameCtx.subexpressionconstraint();
|
|
41976
41993
|
const nameNode = this.visit(nameSubExpr);
|
|
41977
41994
|
let attrName;
|
|
41978
|
-
if (nameNode?.focus?.type === NodeType.ConceptReference) {
|
|
41995
|
+
if (nameNode?.focus?.type === NodeType.ConceptReference && !nameNode.operator && !nameNode.memberOf && !nameNode.filters?.length && !nameNode.historySupplement) {
|
|
41979
41996
|
const conceptRef = nameNode.focus;
|
|
41980
41997
|
attrName = {
|
|
41981
41998
|
type: NodeType.AttributeName,
|
|
@@ -42026,12 +42043,14 @@ var ECLASTVisitor = class extends import_AbstractParseTreeVisitor.AbstractParseT
|
|
|
42026
42043
|
rawValue: ctx.text
|
|
42027
42044
|
};
|
|
42028
42045
|
const cardinalityCtx = ctx.cardinality();
|
|
42046
|
+
const comparisonCtx = exprCompOp ?? ctx.numericcomparisonoperator() ?? ctx.stringcomparisonoperator() ?? ctx.booleancomparisonoperator();
|
|
42029
42047
|
return {
|
|
42030
42048
|
type: NodeType.Attribute,
|
|
42031
42049
|
range: this.getRange(ctx),
|
|
42032
42050
|
name: attrName,
|
|
42033
42051
|
value,
|
|
42034
42052
|
reversed,
|
|
42053
|
+
comparison: comparisonCtx ? comparisonCtx.text : void 0,
|
|
42035
42054
|
cardinality: cardinalityCtx ? "[" + cardinalityCtx.text + "]" : void 0
|
|
42036
42055
|
};
|
|
42037
42056
|
}
|
|
@@ -42867,6 +42886,7 @@ function extractConceptIds(ast, options) {
|
|
|
42867
42886
|
case NodeType.ConstraintOperator:
|
|
42868
42887
|
case NodeType.LogicalOperator:
|
|
42869
42888
|
case NodeType.Wildcard:
|
|
42889
|
+
case NodeType.AlternateIdentifier:
|
|
42870
42890
|
}
|
|
42871
42891
|
}
|
|
42872
42892
|
visitNode(ast);
|
|
@@ -44695,7 +44715,7 @@ function printExpression$1(node, depth, column, opts, src, isRoot = false) {
|
|
|
44695
44715
|
function printSubExpression$1(node, depth, column, opts, src, isRoot = false) {
|
|
44696
44716
|
let result = "";
|
|
44697
44717
|
if (node.operator) result += node.operator.operator + " ";
|
|
44698
|
-
if (node.memberOf) result += "^ ";
|
|
44718
|
+
if (node.memberOf) result += node.memberFields ? `^ [${node.memberFields.join(", ")}] ` : "^ ";
|
|
44699
44719
|
switch (node.focus.type) {
|
|
44700
44720
|
case NodeType.ConceptReference:
|
|
44701
44721
|
result += printConceptReference$1(node.focus);
|
|
@@ -44703,6 +44723,9 @@ function printSubExpression$1(node, depth, column, opts, src, isRoot = false) {
|
|
|
44703
44723
|
case NodeType.Wildcard:
|
|
44704
44724
|
result += "*";
|
|
44705
44725
|
break;
|
|
44726
|
+
case NodeType.AlternateIdentifier:
|
|
44727
|
+
result += node.focus.term ? node.focus.identifier + normalizeTerm(node.focus.term) : node.focus.identifier;
|
|
44728
|
+
break;
|
|
44706
44729
|
case NodeType.ExpressionConstraint: {
|
|
44707
44730
|
const innerExpr = node.focus;
|
|
44708
44731
|
if (opts.removeRedundantParentheses && !node.operator && !node.memberOf && !node.filters && !node.historySupplement) {
|
|
@@ -44877,10 +44900,8 @@ function printAttribute$1(node, depth, column, opts, src) {
|
|
|
44877
44900
|
if (node.name.conceptId) name = node.name.term ? node.name.conceptId + normalizeTerm(node.name.term) : node.name.conceptId;
|
|
44878
44901
|
else if (node.name.expression) name = printSubExpression$1(node.name.expression, depth, column, opts, src);
|
|
44879
44902
|
else name = src.slice(node.name.range.start.offset, node.name.range.end.offset);
|
|
44880
|
-
const
|
|
44881
|
-
const
|
|
44882
|
-
const compOp = opMatch ? opMatch[1] : "=";
|
|
44883
|
-
const hasHashPrefix = between.includes("#");
|
|
44903
|
+
const compOp = node.comparison ?? "=";
|
|
44904
|
+
const hasHashPrefix = src.slice(node.name.range.end.offset, node.value.range.start.offset).includes("#");
|
|
44884
44905
|
let value;
|
|
44885
44906
|
if (node.value.expression) value = printSubExpression$1(node.value.expression, depth, column + name.length + 3, opts, src);
|
|
44886
44907
|
else if (node.value.rawValue) value = hasHashPrefix ? "#" + node.value.rawValue : node.value.rawValue;
|
|
@@ -44904,22 +44925,27 @@ function lastLineLength(text) {
|
|
|
44904
44925
|
*/
|
|
44905
44926
|
function printCanonical(ast, sourceText, outerOperator) {
|
|
44906
44927
|
if (ast.type === NodeType.SubExpressionConstraint) return printSubExpression(ast, sourceText, outerOperator);
|
|
44907
|
-
return printExpression(ast, sourceText, outerOperator);
|
|
44928
|
+
return printExpression(ast, sourceText, outerOperator, outerOperator === void 0);
|
|
44908
44929
|
}
|
|
44909
|
-
|
|
44930
|
+
/**
|
|
44931
|
+
* `topLevel` is true where a full expression constraint is legal without parentheses: the whole
|
|
44932
|
+
* expression, or directly inside a pair of parentheses. Refined and dotted expressions are only
|
|
44933
|
+
* legal unparenthesised there.
|
|
44934
|
+
*/
|
|
44935
|
+
function printExpression(node, src, outerOperator, topLevel = false) {
|
|
44910
44936
|
const inner = node.expression;
|
|
44911
44937
|
switch (inner.type) {
|
|
44912
|
-
case NodeType.SubExpressionConstraint: return printSubExpression(inner, src, outerOperator);
|
|
44938
|
+
case NodeType.SubExpressionConstraint: return printSubExpression(inner, src, outerOperator, topLevel);
|
|
44913
44939
|
case NodeType.CompoundExpression: return printCompoundExpression(inner, src);
|
|
44914
44940
|
case NodeType.RefinedExpression: return printRefinedExpression(inner, src);
|
|
44915
44941
|
case NodeType.DottedExpression: return printDottedExpression(inner, src);
|
|
44916
44942
|
default: return String(inner);
|
|
44917
44943
|
}
|
|
44918
44944
|
}
|
|
44919
|
-
function printSubExpression(node, src, outerOperator) {
|
|
44945
|
+
function printSubExpression(node, src, outerOperator, topLevel = false) {
|
|
44920
44946
|
let result = "";
|
|
44921
44947
|
if (node.operator) result += node.operator.operator;
|
|
44922
|
-
if (node.memberOf) result += "^";
|
|
44948
|
+
if (node.memberOf) result += node.memberFields ? `^[${node.memberFields.join(",")}]` : "^";
|
|
44923
44949
|
switch (node.focus.type) {
|
|
44924
44950
|
case NodeType.ConceptReference:
|
|
44925
44951
|
result += printConceptReference(node.focus);
|
|
@@ -44927,9 +44953,12 @@ function printSubExpression(node, src, outerOperator) {
|
|
|
44927
44953
|
case NodeType.Wildcard:
|
|
44928
44954
|
result += "*";
|
|
44929
44955
|
break;
|
|
44956
|
+
case NodeType.AlternateIdentifier:
|
|
44957
|
+
result += node.focus.identifier;
|
|
44958
|
+
break;
|
|
44930
44959
|
case NodeType.ExpressionConstraint: {
|
|
44931
44960
|
const innerExpr = node.focus.expression;
|
|
44932
|
-
result += parensRedundant(node, innerExpr, outerOperator) ? printExpression(node.focus, src, outerOperator) : "(" + printExpression(node.focus, src) + ")";
|
|
44961
|
+
result += parensRedundant(node, innerExpr, outerOperator, topLevel) ? printExpression(node.focus, src, outerOperator, topLevel) : "(" + printExpression(node.focus, src, void 0, true) + ")";
|
|
44933
44962
|
break;
|
|
44934
44963
|
}
|
|
44935
44964
|
}
|
|
@@ -44944,11 +44973,14 @@ function printSubExpression(node, src, outerOperator) {
|
|
|
44944
44973
|
return result;
|
|
44945
44974
|
}
|
|
44946
44975
|
/** §5.5 redundant parenthesis removal: can the parens around `inner` (the focus of `node`) be dropped? */
|
|
44947
|
-
function parensRedundant(node, inner, outerOperator) {
|
|
44976
|
+
function parensRedundant(node, inner, outerOperator, topLevel) {
|
|
44948
44977
|
if ((node.operator || node.memberOf) && !isBareFocus(inner)) return false;
|
|
44949
44978
|
if ((node.filters?.length || node.historySupplement) && inner.type !== NodeType.SubExpressionConstraint) return false;
|
|
44950
|
-
if (inner.type
|
|
44951
|
-
|
|
44979
|
+
if (inner.type === NodeType.SubExpressionConstraint) return true;
|
|
44980
|
+
const plain = !node.operator && !node.memberOf && !node.filters?.length && !node.historySupplement;
|
|
44981
|
+
if (topLevel && plain) return true;
|
|
44982
|
+
if (inner.type !== NodeType.CompoundExpression) return false;
|
|
44983
|
+
return inner.operator.operator !== "MINUS" && outerOperator !== void 0 && inner.operator.operator === outerOperator;
|
|
44952
44984
|
}
|
|
44953
44985
|
/** True when the expression is just a concept reference or wildcard, with nothing applied to it. */
|
|
44954
44986
|
function isBareFocus(expr) {
|
|
@@ -44992,10 +45024,8 @@ function printAttribute(node, src) {
|
|
|
44992
45024
|
if (node.name.conceptId) name = node.name.conceptId;
|
|
44993
45025
|
else if (node.name.expression) name = printSubExpression(node.name.expression, src);
|
|
44994
45026
|
else name = src.slice(node.name.range.start.offset, node.name.range.end.offset).trim();
|
|
44995
|
-
const
|
|
44996
|
-
const
|
|
44997
|
-
const compOp = opMatch ? opMatch[1] : "=";
|
|
44998
|
-
const hasHashPrefix = between.includes("#");
|
|
45027
|
+
const compOp = node.comparison ?? "=";
|
|
45028
|
+
const hasHashPrefix = src.slice(node.name.range.end.offset, node.value.range.start.offset).includes("#");
|
|
44999
45029
|
let value;
|
|
45000
45030
|
if (node.value.expression) value = printSubExpression(node.value.expression, src);
|
|
45001
45031
|
else if (node.value.rawValue) value = hasHashPrefix ? "#" + node.value.rawValue : node.value.rawValue;
|
|
@@ -45038,6 +45068,14 @@ function normaliseExpression(node, src) {
|
|
|
45038
45068
|
expression: normalised
|
|
45039
45069
|
};
|
|
45040
45070
|
}
|
|
45071
|
+
/**
|
|
45072
|
+
* `"LOINC#54486-6"` and `LOINC#54486-6` are the same code; quotes are only needed when the code
|
|
45073
|
+
* has characters the unquoted grammar form (alpha, digit, `-`, `.`, `_`) cannot hold.
|
|
45074
|
+
*/
|
|
45075
|
+
function unquoteIdentifier(identifier) {
|
|
45076
|
+
const unquoted = /^"([A-Za-z][A-Za-z0-9-]*#[A-Za-z0-9._-]+)"$/.exec(identifier);
|
|
45077
|
+
return unquoted ? unquoted[1] : identifier;
|
|
45078
|
+
}
|
|
45041
45079
|
function normaliseSubExpression(node, src) {
|
|
45042
45080
|
let focus;
|
|
45043
45081
|
switch (node.focus.type) {
|
|
@@ -45047,6 +45085,13 @@ function normaliseSubExpression(node, src) {
|
|
|
45047
45085
|
case NodeType.Wildcard:
|
|
45048
45086
|
focus = { ...node.focus };
|
|
45049
45087
|
break;
|
|
45088
|
+
case NodeType.AlternateIdentifier:
|
|
45089
|
+
focus = {
|
|
45090
|
+
...node.focus,
|
|
45091
|
+
identifier: unquoteIdentifier(node.focus.identifier),
|
|
45092
|
+
term: void 0
|
|
45093
|
+
};
|
|
45094
|
+
break;
|
|
45050
45095
|
case NodeType.ExpressionConstraint: focus = normaliseExpression(node.focus, src);
|
|
45051
45096
|
}
|
|
45052
45097
|
return {
|
package/dist/index.mjs
CHANGED
|
@@ -41698,6 +41698,7 @@ var NodeType = /* @__PURE__ */ function(NodeType) {
|
|
|
41698
41698
|
NodeType["AttributeName"] = "AttributeName";
|
|
41699
41699
|
NodeType["AttributeValue"] = "AttributeValue";
|
|
41700
41700
|
NodeType["Wildcard"] = "Wildcard";
|
|
41701
|
+
NodeType["AlternateIdentifier"] = "AlternateIdentifier";
|
|
41701
41702
|
NodeType["FilterConstraint"] = "FilterConstraint";
|
|
41702
41703
|
NodeType["HistorySupplement"] = "HistorySupplement";
|
|
41703
41704
|
return NodeType;
|
|
@@ -41762,6 +41763,7 @@ var ECLASTVisitor = class extends import_AbstractParseTreeVisitor.AbstractParseT
|
|
|
41762
41763
|
range: this.getRange(ctx),
|
|
41763
41764
|
operator,
|
|
41764
41765
|
memberOf: memberOfCtx ? true : void 0,
|
|
41766
|
+
memberFields: memberOfCtx ? this.memberFields(memberOfCtx) : void 0,
|
|
41765
41767
|
focus: innerExpr
|
|
41766
41768
|
};
|
|
41767
41769
|
this.attachFiltersAndHistory(ctx, node);
|
|
@@ -41780,6 +41782,7 @@ var ECLASTVisitor = class extends import_AbstractParseTreeVisitor.AbstractParseT
|
|
|
41780
41782
|
range: this.getRange(ctx),
|
|
41781
41783
|
operator,
|
|
41782
41784
|
memberOf: memberOfCtx ? true : void 0,
|
|
41785
|
+
memberFields: memberOfCtx ? this.memberFields(memberOfCtx) : void 0,
|
|
41783
41786
|
focus
|
|
41784
41787
|
};
|
|
41785
41788
|
this.attachFiltersAndHistory(ctx, node);
|
|
@@ -41788,15 +41791,29 @@ var ECLASTVisitor = class extends import_AbstractParseTreeVisitor.AbstractParseT
|
|
|
41788
41791
|
visitEclfocusconcept(ctx) {
|
|
41789
41792
|
const conceptRef = ctx.eclconceptreference();
|
|
41790
41793
|
if (conceptRef) return this.visit(conceptRef);
|
|
41791
|
-
|
|
41794
|
+
const altId = ctx.altidentifier();
|
|
41795
|
+
if (altId) return this.alternateIdentifier(altId);
|
|
41796
|
+
return {
|
|
41792
41797
|
type: NodeType.Wildcard,
|
|
41793
41798
|
range: this.getRange(ctx)
|
|
41794
41799
|
};
|
|
41800
|
+
}
|
|
41801
|
+
alternateIdentifier(ctx) {
|
|
41802
|
+
const scheme = ctx.altidentifierschemealias()?.text ?? "";
|
|
41803
|
+
const quoted = ctx.altidentifiercodewithinquotes();
|
|
41804
|
+
const code = quoted ? quoted.text : ctx.altidentifiercodewithoutquotes()?.text ?? "";
|
|
41795
41805
|
return {
|
|
41796
|
-
type: NodeType.
|
|
41797
|
-
range: this.getRange(ctx)
|
|
41806
|
+
type: NodeType.AlternateIdentifier,
|
|
41807
|
+
range: this.getRange(ctx),
|
|
41808
|
+
identifier: quoted ? `"${scheme}#${code}"` : `${scheme}#${code}`,
|
|
41809
|
+
term: ctx.term()?.text
|
|
41798
41810
|
};
|
|
41799
41811
|
}
|
|
41812
|
+
/** Field names from `^ [a, b]`, `['*']` for `^ [*]`, undefined for a plain `^`. */
|
|
41813
|
+
memberFields(ctx) {
|
|
41814
|
+
if (ctx.wildcard()) return ["*"];
|
|
41815
|
+
return ctx.refsetfieldnameset()?.refsetfieldname().map((f) => f.text);
|
|
41816
|
+
}
|
|
41800
41817
|
visitEclconceptreference(ctx) {
|
|
41801
41818
|
const conceptId = ctx.conceptid().text;
|
|
41802
41819
|
const termCtx = ctx.term();
|
|
@@ -41978,7 +41995,7 @@ var ECLASTVisitor = class extends import_AbstractParseTreeVisitor.AbstractParseT
|
|
|
41978
41995
|
const nameSubExpr = nameCtx.subexpressionconstraint();
|
|
41979
41996
|
const nameNode = this.visit(nameSubExpr);
|
|
41980
41997
|
let attrName;
|
|
41981
|
-
if (nameNode?.focus?.type === NodeType.ConceptReference) {
|
|
41998
|
+
if (nameNode?.focus?.type === NodeType.ConceptReference && !nameNode.operator && !nameNode.memberOf && !nameNode.filters?.length && !nameNode.historySupplement) {
|
|
41982
41999
|
const conceptRef = nameNode.focus;
|
|
41983
42000
|
attrName = {
|
|
41984
42001
|
type: NodeType.AttributeName,
|
|
@@ -42029,12 +42046,14 @@ var ECLASTVisitor = class extends import_AbstractParseTreeVisitor.AbstractParseT
|
|
|
42029
42046
|
rawValue: ctx.text
|
|
42030
42047
|
};
|
|
42031
42048
|
const cardinalityCtx = ctx.cardinality();
|
|
42049
|
+
const comparisonCtx = exprCompOp ?? ctx.numericcomparisonoperator() ?? ctx.stringcomparisonoperator() ?? ctx.booleancomparisonoperator();
|
|
42032
42050
|
return {
|
|
42033
42051
|
type: NodeType.Attribute,
|
|
42034
42052
|
range: this.getRange(ctx),
|
|
42035
42053
|
name: attrName,
|
|
42036
42054
|
value,
|
|
42037
42055
|
reversed,
|
|
42056
|
+
comparison: comparisonCtx ? comparisonCtx.text : void 0,
|
|
42038
42057
|
cardinality: cardinalityCtx ? "[" + cardinalityCtx.text + "]" : void 0
|
|
42039
42058
|
};
|
|
42040
42059
|
}
|
|
@@ -42870,6 +42889,7 @@ function extractConceptIds(ast, options) {
|
|
|
42870
42889
|
case NodeType.ConstraintOperator:
|
|
42871
42890
|
case NodeType.LogicalOperator:
|
|
42872
42891
|
case NodeType.Wildcard:
|
|
42892
|
+
case NodeType.AlternateIdentifier:
|
|
42873
42893
|
}
|
|
42874
42894
|
}
|
|
42875
42895
|
visitNode(ast);
|
|
@@ -44698,7 +44718,7 @@ function printExpression$1(node, depth, column, opts, src, isRoot = false) {
|
|
|
44698
44718
|
function printSubExpression$1(node, depth, column, opts, src, isRoot = false) {
|
|
44699
44719
|
let result = "";
|
|
44700
44720
|
if (node.operator) result += node.operator.operator + " ";
|
|
44701
|
-
if (node.memberOf) result += "^ ";
|
|
44721
|
+
if (node.memberOf) result += node.memberFields ? `^ [${node.memberFields.join(", ")}] ` : "^ ";
|
|
44702
44722
|
switch (node.focus.type) {
|
|
44703
44723
|
case NodeType.ConceptReference:
|
|
44704
44724
|
result += printConceptReference$1(node.focus);
|
|
@@ -44706,6 +44726,9 @@ function printSubExpression$1(node, depth, column, opts, src, isRoot = false) {
|
|
|
44706
44726
|
case NodeType.Wildcard:
|
|
44707
44727
|
result += "*";
|
|
44708
44728
|
break;
|
|
44729
|
+
case NodeType.AlternateIdentifier:
|
|
44730
|
+
result += node.focus.term ? node.focus.identifier + normalizeTerm(node.focus.term) : node.focus.identifier;
|
|
44731
|
+
break;
|
|
44709
44732
|
case NodeType.ExpressionConstraint: {
|
|
44710
44733
|
const innerExpr = node.focus;
|
|
44711
44734
|
if (opts.removeRedundantParentheses && !node.operator && !node.memberOf && !node.filters && !node.historySupplement) {
|
|
@@ -44880,10 +44903,8 @@ function printAttribute$1(node, depth, column, opts, src) {
|
|
|
44880
44903
|
if (node.name.conceptId) name = node.name.term ? node.name.conceptId + normalizeTerm(node.name.term) : node.name.conceptId;
|
|
44881
44904
|
else if (node.name.expression) name = printSubExpression$1(node.name.expression, depth, column, opts, src);
|
|
44882
44905
|
else name = src.slice(node.name.range.start.offset, node.name.range.end.offset);
|
|
44883
|
-
const
|
|
44884
|
-
const
|
|
44885
|
-
const compOp = opMatch ? opMatch[1] : "=";
|
|
44886
|
-
const hasHashPrefix = between.includes("#");
|
|
44906
|
+
const compOp = node.comparison ?? "=";
|
|
44907
|
+
const hasHashPrefix = src.slice(node.name.range.end.offset, node.value.range.start.offset).includes("#");
|
|
44887
44908
|
let value;
|
|
44888
44909
|
if (node.value.expression) value = printSubExpression$1(node.value.expression, depth, column + name.length + 3, opts, src);
|
|
44889
44910
|
else if (node.value.rawValue) value = hasHashPrefix ? "#" + node.value.rawValue : node.value.rawValue;
|
|
@@ -44907,22 +44928,27 @@ function lastLineLength(text) {
|
|
|
44907
44928
|
*/
|
|
44908
44929
|
function printCanonical(ast, sourceText, outerOperator) {
|
|
44909
44930
|
if (ast.type === NodeType.SubExpressionConstraint) return printSubExpression(ast, sourceText, outerOperator);
|
|
44910
|
-
return printExpression(ast, sourceText, outerOperator);
|
|
44931
|
+
return printExpression(ast, sourceText, outerOperator, outerOperator === void 0);
|
|
44911
44932
|
}
|
|
44912
|
-
|
|
44933
|
+
/**
|
|
44934
|
+
* `topLevel` is true where a full expression constraint is legal without parentheses: the whole
|
|
44935
|
+
* expression, or directly inside a pair of parentheses. Refined and dotted expressions are only
|
|
44936
|
+
* legal unparenthesised there.
|
|
44937
|
+
*/
|
|
44938
|
+
function printExpression(node, src, outerOperator, topLevel = false) {
|
|
44913
44939
|
const inner = node.expression;
|
|
44914
44940
|
switch (inner.type) {
|
|
44915
|
-
case NodeType.SubExpressionConstraint: return printSubExpression(inner, src, outerOperator);
|
|
44941
|
+
case NodeType.SubExpressionConstraint: return printSubExpression(inner, src, outerOperator, topLevel);
|
|
44916
44942
|
case NodeType.CompoundExpression: return printCompoundExpression(inner, src);
|
|
44917
44943
|
case NodeType.RefinedExpression: return printRefinedExpression(inner, src);
|
|
44918
44944
|
case NodeType.DottedExpression: return printDottedExpression(inner, src);
|
|
44919
44945
|
default: return String(inner);
|
|
44920
44946
|
}
|
|
44921
44947
|
}
|
|
44922
|
-
function printSubExpression(node, src, outerOperator) {
|
|
44948
|
+
function printSubExpression(node, src, outerOperator, topLevel = false) {
|
|
44923
44949
|
let result = "";
|
|
44924
44950
|
if (node.operator) result += node.operator.operator;
|
|
44925
|
-
if (node.memberOf) result += "^";
|
|
44951
|
+
if (node.memberOf) result += node.memberFields ? `^[${node.memberFields.join(",")}]` : "^";
|
|
44926
44952
|
switch (node.focus.type) {
|
|
44927
44953
|
case NodeType.ConceptReference:
|
|
44928
44954
|
result += printConceptReference(node.focus);
|
|
@@ -44930,9 +44956,12 @@ function printSubExpression(node, src, outerOperator) {
|
|
|
44930
44956
|
case NodeType.Wildcard:
|
|
44931
44957
|
result += "*";
|
|
44932
44958
|
break;
|
|
44959
|
+
case NodeType.AlternateIdentifier:
|
|
44960
|
+
result += node.focus.identifier;
|
|
44961
|
+
break;
|
|
44933
44962
|
case NodeType.ExpressionConstraint: {
|
|
44934
44963
|
const innerExpr = node.focus.expression;
|
|
44935
|
-
result += parensRedundant(node, innerExpr, outerOperator) ? printExpression(node.focus, src, outerOperator) : "(" + printExpression(node.focus, src) + ")";
|
|
44964
|
+
result += parensRedundant(node, innerExpr, outerOperator, topLevel) ? printExpression(node.focus, src, outerOperator, topLevel) : "(" + printExpression(node.focus, src, void 0, true) + ")";
|
|
44936
44965
|
break;
|
|
44937
44966
|
}
|
|
44938
44967
|
}
|
|
@@ -44947,11 +44976,14 @@ function printSubExpression(node, src, outerOperator) {
|
|
|
44947
44976
|
return result;
|
|
44948
44977
|
}
|
|
44949
44978
|
/** §5.5 redundant parenthesis removal: can the parens around `inner` (the focus of `node`) be dropped? */
|
|
44950
|
-
function parensRedundant(node, inner, outerOperator) {
|
|
44979
|
+
function parensRedundant(node, inner, outerOperator, topLevel) {
|
|
44951
44980
|
if ((node.operator || node.memberOf) && !isBareFocus(inner)) return false;
|
|
44952
44981
|
if ((node.filters?.length || node.historySupplement) && inner.type !== NodeType.SubExpressionConstraint) return false;
|
|
44953
|
-
if (inner.type
|
|
44954
|
-
|
|
44982
|
+
if (inner.type === NodeType.SubExpressionConstraint) return true;
|
|
44983
|
+
const plain = !node.operator && !node.memberOf && !node.filters?.length && !node.historySupplement;
|
|
44984
|
+
if (topLevel && plain) return true;
|
|
44985
|
+
if (inner.type !== NodeType.CompoundExpression) return false;
|
|
44986
|
+
return inner.operator.operator !== "MINUS" && outerOperator !== void 0 && inner.operator.operator === outerOperator;
|
|
44955
44987
|
}
|
|
44956
44988
|
/** True when the expression is just a concept reference or wildcard, with nothing applied to it. */
|
|
44957
44989
|
function isBareFocus(expr) {
|
|
@@ -44995,10 +45027,8 @@ function printAttribute(node, src) {
|
|
|
44995
45027
|
if (node.name.conceptId) name = node.name.conceptId;
|
|
44996
45028
|
else if (node.name.expression) name = printSubExpression(node.name.expression, src);
|
|
44997
45029
|
else name = src.slice(node.name.range.start.offset, node.name.range.end.offset).trim();
|
|
44998
|
-
const
|
|
44999
|
-
const
|
|
45000
|
-
const compOp = opMatch ? opMatch[1] : "=";
|
|
45001
|
-
const hasHashPrefix = between.includes("#");
|
|
45030
|
+
const compOp = node.comparison ?? "=";
|
|
45031
|
+
const hasHashPrefix = src.slice(node.name.range.end.offset, node.value.range.start.offset).includes("#");
|
|
45002
45032
|
let value;
|
|
45003
45033
|
if (node.value.expression) value = printSubExpression(node.value.expression, src);
|
|
45004
45034
|
else if (node.value.rawValue) value = hasHashPrefix ? "#" + node.value.rawValue : node.value.rawValue;
|
|
@@ -45041,6 +45071,14 @@ function normaliseExpression(node, src) {
|
|
|
45041
45071
|
expression: normalised
|
|
45042
45072
|
};
|
|
45043
45073
|
}
|
|
45074
|
+
/**
|
|
45075
|
+
* `"LOINC#54486-6"` and `LOINC#54486-6` are the same code; quotes are only needed when the code
|
|
45076
|
+
* has characters the unquoted grammar form (alpha, digit, `-`, `.`, `_`) cannot hold.
|
|
45077
|
+
*/
|
|
45078
|
+
function unquoteIdentifier(identifier) {
|
|
45079
|
+
const unquoted = /^"([A-Za-z][A-Za-z0-9-]*#[A-Za-z0-9._-]+)"$/.exec(identifier);
|
|
45080
|
+
return unquoted ? unquoted[1] : identifier;
|
|
45081
|
+
}
|
|
45044
45082
|
function normaliseSubExpression(node, src) {
|
|
45045
45083
|
let focus;
|
|
45046
45084
|
switch (node.focus.type) {
|
|
@@ -45050,6 +45088,13 @@ function normaliseSubExpression(node, src) {
|
|
|
45050
45088
|
case NodeType.Wildcard:
|
|
45051
45089
|
focus = { ...node.focus };
|
|
45052
45090
|
break;
|
|
45091
|
+
case NodeType.AlternateIdentifier:
|
|
45092
|
+
focus = {
|
|
45093
|
+
...node.focus,
|
|
45094
|
+
identifier: unquoteIdentifier(node.focus.identifier),
|
|
45095
|
+
term: void 0
|
|
45096
|
+
};
|
|
45097
|
+
break;
|
|
45053
45098
|
case NodeType.ExpressionConstraint: focus = normaliseExpression(node.focus, src);
|
|
45054
45099
|
}
|
|
45055
45100
|
return {
|
package/dist/parser/ast.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ export declare enum NodeType {
|
|
|
24
24
|
AttributeName = "AttributeName",
|
|
25
25
|
AttributeValue = "AttributeValue",
|
|
26
26
|
Wildcard = "Wildcard",
|
|
27
|
+
AlternateIdentifier = "AlternateIdentifier",
|
|
27
28
|
FilterConstraint = "FilterConstraint",
|
|
28
29
|
HistorySupplement = "HistorySupplement"
|
|
29
30
|
}
|
|
@@ -39,7 +40,9 @@ export interface SubExpressionNode extends ASTNode {
|
|
|
39
40
|
type: NodeType.SubExpressionConstraint;
|
|
40
41
|
operator?: OperatorNode;
|
|
41
42
|
memberOf?: boolean;
|
|
42
|
-
|
|
43
|
+
/** Member field selection (`^ [refsetId, referencedComponentId]`), `['*']` for `^ [*]`. */
|
|
44
|
+
memberFields?: string[];
|
|
45
|
+
focus: ConceptReferenceNode | WildcardNode | AlternateIdentifierNode | ExpressionNode;
|
|
43
46
|
filters?: FilterConstraintNode[];
|
|
44
47
|
historySupplement?: HistorySupplementNode;
|
|
45
48
|
}
|
|
@@ -131,6 +134,8 @@ export interface AttributeNode extends ASTNode {
|
|
|
131
134
|
name: AttributeNameNode;
|
|
132
135
|
value: AttributeValueNode;
|
|
133
136
|
reversed?: boolean;
|
|
137
|
+
/** Comparison between name and value; `=` when absent. */
|
|
138
|
+
comparison?: '=' | '!=' | '<' | '<=' | '>' | '>=';
|
|
134
139
|
/** Raw cardinality text including brackets, e.g. `[0..1]`. */
|
|
135
140
|
cardinality?: string;
|
|
136
141
|
}
|
|
@@ -148,6 +153,13 @@ export interface AttributeValueNode extends ASTNode {
|
|
|
148
153
|
export interface WildcardNode extends ASTNode {
|
|
149
154
|
type: NodeType.Wildcard;
|
|
150
155
|
}
|
|
156
|
+
/** A code from another code system, e.g. `LOINC#54486-6` or `"LOINC#54486-6"`. */
|
|
157
|
+
export interface AlternateIdentifierNode extends ASTNode {
|
|
158
|
+
type: NodeType.AlternateIdentifier;
|
|
159
|
+
/** The identifier as written, without the term: scheme alias, `#`, code, and any quotes. */
|
|
160
|
+
identifier: string;
|
|
161
|
+
term?: string;
|
|
162
|
+
}
|
|
151
163
|
export interface FilterConstraintNode extends ASTNode {
|
|
152
164
|
type: NodeType.FilterConstraint;
|
|
153
165
|
filterType: 'description' | 'concept'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a,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,iBAAiB,CAAC;CAChC;AAED,MAAM,WAAW,kBAAmB,SAAQ,OAAO;IACjD,IAAI,EAAE,QAAQ,CAAC,cAAc,CAAC;IAC9B,UAAU,CAAC,EAAE,iBAAiB,CAAC;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,YAAa,SAAQ,OAAO;IAC3C,IAAI,EAAE,QAAQ,CAAC,QAAQ,CAAC;CACzB;AAED,kFAAkF;AAClF,MAAM,WAAW,uBAAwB,SAAQ,OAAO;IACtD,IAAI,EAAE,QAAQ,CAAC,mBAAmB,CAAC;IACnC,4FAA4F;IAC5F,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,oBAAqB,SAAQ,OAAO;IACnD,IAAI,EAAE,QAAQ,CAAC,gBAAgB,CAAC;IAChC,UAAU,EAAE,aAAa,GAAG,SAAS,GAAG,QAAQ,CAAC;IACjD,kBAAkB,EAAE,iBAAiB,EAAE,CAAC;IACxC,iBAAiB,EAAE,oBAAoB,EAAE,CAAC;CAC3C;AAED,MAAM,WAAW,qBAAsB,SAAQ,OAAO;IACpD,IAAI,EAAE,QAAQ,CAAC,iBAAiB,CAAC;IACjC,OAAO,CAAC,EAAE,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;IAChC,gBAAgB,CAAC,EAAE,cAAc,CAAC;CACnC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"concept-extractor.d.ts","sourceRoot":"","sources":["../../src/parser/concept-extractor.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,cAAc,
|
|
1
|
+
{"version":3,"file":"concept-extractor.d.ts","sourceRoot":"","sources":["../../src/parser/concept-extractor.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,cAAc,EAkBd,KAAK,EACN,MAAM,OAAO,CAAC;AAsBf,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,KAAK,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE;IAAE,WAAW,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,gBAAgB,EAAE,CAqH9G;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAKhE"}
|
package/dist/parser/visitor.d.ts
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { ECLVisitor } from './generated/grammar/ECLVisitor';
|
|
2
2
|
import { AbstractParseTreeVisitor } from 'antlr4ts/tree/AbstractParseTreeVisitor';
|
|
3
|
-
import { ExpressionNode, ConceptReferenceNode, SubExpressionNode, CompoundExpressionNode, RefinedExpressionNode, DottedExpressionNode, DottedAttributeNode, OperatorNode, RefinementNode, AttributeNode, WildcardNode, FilterConstraintNode, HistorySupplementNode } from './ast';
|
|
3
|
+
import { ExpressionNode, ConceptReferenceNode, SubExpressionNode, CompoundExpressionNode, RefinedExpressionNode, DottedExpressionNode, DottedAttributeNode, OperatorNode, RefinementNode, AttributeNode, WildcardNode, AlternateIdentifierNode, FilterConstraintNode, HistorySupplementNode } from './ast';
|
|
4
4
|
import * as ECL from './generated/grammar/ECLParser';
|
|
5
5
|
export declare class ECLASTVisitor extends AbstractParseTreeVisitor<any> implements ECLVisitor<any> {
|
|
6
6
|
protected defaultResult(): any;
|
|
7
7
|
private getRange;
|
|
8
8
|
visitExpressionconstraint(ctx: ECL.ExpressionconstraintContext): ExpressionNode;
|
|
9
9
|
visitSubexpressionconstraint(ctx: ECL.SubexpressionconstraintContext): SubExpressionNode;
|
|
10
|
-
visitEclfocusconcept(ctx: ECL.EclfocusconceptContext): ConceptReferenceNode | WildcardNode;
|
|
10
|
+
visitEclfocusconcept(ctx: ECL.EclfocusconceptContext): ConceptReferenceNode | WildcardNode | AlternateIdentifierNode;
|
|
11
|
+
private alternateIdentifier;
|
|
12
|
+
/** Field names from `^ [a, b]`, `['*']` for `^ [*]`, undefined for a plain `^`. */
|
|
13
|
+
private memberFields;
|
|
11
14
|
visitEclconceptreference(ctx: ECL.EclconceptreferenceContext): ConceptReferenceNode;
|
|
12
15
|
visitConstraintoperator(ctx: ECL.ConstraintoperatorContext): OperatorNode;
|
|
13
16
|
visitCompoundexpressionconstraint(ctx: ECL.CompoundexpressionconstraintContext): CompoundExpressionNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"visitor.d.ts","sourceRoot":"","sources":["../../src/parser/visitor.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AAClF,OAAO,KAAK,GAAG,MAAM,+BAA+B,CAAC;AACrD,OAAO,EACL,cAAc,EAGd,oBAAoB,EACpB,iBAAiB,EACjB,sBAAsB,EACtB,qBAAqB,EACrB,oBAAoB,EACpB,mBAAmB,EACnB,YAAY,EACZ,cAAc,EAGd,aAAa,EAGb,YAAY,EACZ,oBAAoB,EACpB,qBAAqB,EACtB,MAAM,OAAO,CAAC;AAGf,qBAAa,aAAc,SAAQ,wBAAwB,CAAC,GAAG,CAAE,YAAW,UAAU,CAAC,GAAG,CAAC;IACzF,SAAS,CAAC,aAAa,IAAI,GAAG;IAI9B,OAAO,CAAC,QAAQ;IAiBhB,yBAAyB,CAAC,GAAG,EAAE,GAAG,CAAC,2BAA2B,GAAG,cAAc;IAoC/E,4BAA4B,CAAC,GAAG,EAAE,GAAG,CAAC,8BAA8B,GAAG,iBAAiB;
|
|
1
|
+
{"version":3,"file":"visitor.d.ts","sourceRoot":"","sources":["../../src/parser/visitor.ts"],"names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3,"file":"semantic-tokens.d.ts","sourceRoot":"","sources":["../src/semantic-tokens.ts"],"names":[],"mappings":"AAkDA,8CAA8C;AAC9C,eAAO,MAAM,aAAa,0GAUhB,CAAC;AAEX,eAAO,MAAM,iBAAiB,EAAE,MAAM,EAAO,CAAC;AAE9C,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;CACxB;AA8FD,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,EAAE,CAgNnE"}
|