@valtzu/codemirror-lang-el 0.7.0 → 0.9.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/index.cjs CHANGED
@@ -1,7 +1,5 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
3
  var lr = require('@lezer/lr');
6
4
  var language = require('@codemirror/language');
7
5
  var highlight = require('@lezer/highlight');
@@ -16,35 +14,55 @@ const t = {
16
14
  };
17
15
 
18
16
  // This file was generated by lezer-generator. You probably shouldn't edit it.
19
- const spec_word = {__proto__:null,true:92, TRUE:94, false:96, FALSE:98, null:100, NULL:102, starts:112, with:114, ends:116, contains:118, matches:120, not:122, in:124, and:126, or:128, xor:130};
20
- const spec_Operator = {__proto__:null,"?":111, "!":133, "+":135, "-":137};
17
+ const spec_word = {__proto__:null,true:90, TRUE:92, false:94, FALSE:96, null:98, NULL:100, starts:110, with:112, ends:114, contains:116, matches:118, not:120, in:122, and:124, or:126, xor:128};
18
+ const spec_Operator = {__proto__:null,"?":109, "!":131, "~":133, "+":135, "-":137};
21
19
  const parser = lr.LRParser.deserialize({
22
20
  version: 14,
23
- states: ")rOYQPOOP!^OPOOQ!cQPOOO#aQPO'#CeO$tQPO'#CnO${QPO'#CoOYQPO'#CuOYQPO'#CwOOQO'#DS'#DSO%SQPO'#CdO%XQPO'#CdOOQO'#Cl'#ClOOQO'#Cm'#CmOOQO'#Cv'#CvP%^OQO'#C]POOO)C>r)C>rO%iQPO,58yOYQPO,58}OYQPO,59_OYQPO,59]O%nQPO'#CtOOQO'#Ct'#CtO%sQPO'#CtO&zQPO,59YOOQO,59Y,59YO'RQPO'#DYO'`QPO,59ZO'eQPO,59aO'{QPO,59cO(SQPO'#CfOOQO,59O,59OO(SQPO'#CiPOOO'#Cx'#CxP(ZOQO,58wPOOO,58w,58wO(fQPO'#CbOOQO1G.e1G.eOOQO1G.m1G.mO)yQPO1G.iO*QQPO1G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!]!cRt`oXOSTUVabcmoz{!U!]!cRnXoYOSTUVabcmoz{!U!]!cRu`RnYkbQgiklvwx!V!W![!`!doUOSTUVabcmoz{!U!]!cQq^R!RqQ|iR!X|Q!^!VR!a!^QQOQgSUiTmoQkUQlVQvaQwbQxcQ!VzQ!W{Q![!UQ!`!]R!d!cQjTQ!PmR!Qo",
26
- nodeNames: "⚠ BlockComment Expression ObjectAccess MemberOf NullSafeMemberOf Property ArrayAccess Call Function Arguments ObjectAccess Method Arguments Number String Boolean Null Object Array Variable TernaryExpression Operator BinaryExpression OperatorKeyword UnaryExpression UnaryOperator Application",
21
+ states: ")YOYQPOOP!aOPOOQ!fQPOOO#dQPO'#CeO$wQPO'#CmO%OQPO'#CnOYQPO'#CtOYQPO'#CvOOQO'#DR'#DRO%VQPO'#CdOOQO'#Ck'#CkOOQO'#Cl'#ClOOQO'#Cu'#CuP%[OQO'#C]POOO)C>q)C>qO%gQPO,58yOYQPO,58}OYQPO,59^OYQPO,59[O%lQPO'#CsOOQO'#Cs'#CsO%qQPO'#CsO&{QPO,59XOOQO,59X,59XO'SQPO'#DXO'aQPO,59YO'fQPO,59`O'|QPO,59bO(TQPO'#CfOOQO,59O,59OPOOO'#Cw'#CwP([OQO,58wPOOO,58w,58wO(gQPO'#CbOOQO1G.e1G.eOOQO1G.m1G.mO)zQPO1G.iO*RQPO1G.xO*iQPO1G.vOOQO,59_,59_OYQPO1G.sOYQPO'#CxO*pQPO,59sOOQO1G.t1G.tOOQO1G.|1G.|O*{QPO,59QPOOO-E6u-E6uPOOO1G.c1G.cOOQO7+$T7+$TOYQPO7+$bO+QQPO7+$_O+[QPO,59dOOQO-E6v-E6vOOQO1G.l1G.lO+iQPO<<G|OYQPO'#CyO,PQPO<<GyOOQO<<Gy<<GyO,XQPO,59eOOQO-E6w-E6wOOQOAN=eAN=eOYQPO1G/PO,`QPO7+$k",
22
+ stateData: ",r~OpOSqPQ~O]WO^WOvROxTOzVO}YO!OYO!PYO!QYO!RZO!SZO!USO!^[O!c[O!d[O!e[O!f[O~Oq]O~OS_OT_OeaOx`O!WbO!XcO!ZcO![dO!]dO!^eO!_dO!`dO!adO!bdO~OScXTcXecXncXxcXzXX!WcX!XcX!ZcX![cX!]cX!^cX!_cX!`cX!acX!bcX!VcXwcX|cXycX!TcX~O!TgO~PYOw{P~PYOzlO~OrnOsnOtpO~OvqO~O!YwO~O!_wO]gX^gXvgXxgXzgX}gX!OgX!PgX!QgX!RgX!SgX!UgX!^gX!cgX!dgX!egX!fgX~O!VxO~P!fO|yOw{Xy{X~P!fOw{O~Onha!Vhawha|hayha!Tha~P!fOy|O~P!fOy{P~PYOrnOsnOt!PO~OSUXTUXeUXnUXxUXz[X!WUX!XUX!ZUX![UX!]UX!^UX!_UX!`UX!aUX!bUX!VUXwUX|UXyUX!TUX~Ow!QO~P!fOnfi!Vfiwfi|fiyfi!Tfi~P!fO!V!RO~P!fO|yOw{ay{a~Oy!VO~O|!XO!T!ZO~P!fOwla|layla~P!fOndy!Vdywdy|dyydy!Tdy~P!fO|!XO!T!^O~O!V!_O~P!fO|mq!Tmq~P!fO^TeS]vS~",
23
+ goto: "%O|P}P!QPP!b!Q!Q!e!u!e!xPP!Q!Q!Q!Q!Q!QP!Q!{!Q#[!Q#l#r#xPPPPPPP$OPPPPP$xR^PmWOSTUV`ablxy!R!X!_Rr_mXOSTUV`ablxy!R!X!_RmXRs_kaQfhjktuv!S!T!W![!`mUOSTUV`ablxy!R!X!_Qo]R!OoQzhR!UzQ!Y!SR!]!YQQOQfSShTlQjUQkVQt`QuaQvbQ!SxQ!TyQ!W!RQ![!XR!`!_QiTR}l",
24
+ nodeNames: "⚠ BlockComment Expression PropertyAccess MemberOf NullSafeMemberOf Property ArrayAccess Call Function Arguments MethodAccess Method Number String Boolean Null Object Array Variable TernaryExpression Operator BinaryExpression OperatorKeyword UnaryExpression UnaryOperator Application",
27
25
  maxTerm: 68,
28
26
  nodeProps: [
29
- [t, 14,"number",15,"string",16,"bool",17,"null"]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#{~,SRe~!O!P,]![!]#{!a!b#{~,bOT~~,gSv~!Q![,b!c!},b#R#S,b#T#o,b~,xOx~~,}Ow~~-SO!U~~-XPe~#p#q#{~-aO!T~",
32
+ tokenizers: [1, new lr.LocalTokenGroup("j~RQYZXz{^~^Os~~aP!P!Qd~iOt~~", 25, 34)],
35
33
  topRules: {"Expression":[0,2]},
36
- specialized: [{term: 39, get: (value) => spec_word[value] || -1},{term: 22, get: (value) => spec_Operator[value] || -1}],
37
- tokenPrec: 536
34
+ specialized: [{term: 38, get: (value) => spec_word[value] || -1},{term: 21, get: (value) => spec_Operator[value] || -1}],
35
+ tokenPrec: 532
38
36
  });
39
37
 
40
- var ELScalar;
38
+ exports.ELScalar = void 0;
41
39
  (function (ELScalar) {
42
40
  ELScalar["Bool"] = "bool";
43
41
  ELScalar["Number"] = "number";
44
42
  ELScalar["String"] = "string";
45
43
  ELScalar["Null"] = "null";
46
44
  ELScalar["Any"] = "any";
47
- })(ELScalar || (ELScalar = {}));
45
+ })(exports.ELScalar || (exports.ELScalar = {}));
46
+
47
+ // This file was generated by lezer-generator. You probably shouldn't edit it.
48
+ const BlockComment = 1,
49
+ Expression = 2,
50
+ PropertyAccess = 3,
51
+ Property = 6,
52
+ ArrayAccess = 7,
53
+ Call = 8,
54
+ Function = 9,
55
+ Arguments = 10,
56
+ MethodAccess = 11,
57
+ Method = 12,
58
+ String = 14,
59
+ Array$1 = 18,
60
+ Variable = 19,
61
+ TernaryExpression = 20,
62
+ BinaryExpression = 22,
63
+ OperatorKeyword = 23,
64
+ UnaryExpression = 24,
65
+ Application = 26;
48
66
 
49
67
  const createInfoElement = (html) => {
50
68
  const dom = document.createElement("div");
@@ -58,30 +76,30 @@ function resolveFunctionDefinition(node, state, config) {
58
76
  return undefined;
59
77
  }
60
78
  let identifier;
61
- if (node.name === 'ObjectAccess' && node.lastChild) {
62
- const leftArgument = (_a = node.firstChild) === null || _a === void 0 ? void 0 : _a.node;
79
+ if ((node.type.is(PropertyAccess) || node.type.is(MethodAccess)) && node.lastChild) {
80
+ const leftArgument = (_a = node.firstChild) === null || _a === undefined ? undefined : _a.node;
63
81
  const types = Array.from(resolveTypes(state, leftArgument, config));
64
82
  identifier = state.sliceDoc(node.lastChild.from, node.lastChild.to);
65
- return types.map(type => { var _a; return resolveCallable(identifier, (_a = config.types) === null || _a === void 0 ? void 0 : _a[type]); }).find(x => x);
83
+ return types.map(type => { var _a; return resolveCallable(identifier, (_a = config.types) === null || _a === undefined ? undefined : _a[type]); }).find(x => x);
66
84
  }
67
- else if (node.name === 'Function') {
85
+ else if (node.type.is(Function)) {
68
86
  identifier = state.sliceDoc(node.from, node.node.firstChild ? node.node.firstChild.from - 1 : node.to);
69
87
  return resolveCallable(identifier, config);
70
88
  }
71
89
  }
72
- const resolveCallable = (identifier, config) => { var _a; return (_a = config === null || config === void 0 ? void 0 : config.functions) === null || _a === void 0 ? void 0 : _a.find(x => x.name === identifier); };
73
- const resolveIdentifier = (nodeName, identifier, config) => {
90
+ const resolveCallable = (identifier, config) => { var _a; return (_a = config === null || config === undefined ? undefined : config.functions) === null || _a === undefined ? undefined : _a.find(x => x.name === identifier); };
91
+ const resolveIdentifier = (nodeTypeId, identifier, config) => {
74
92
  var _a;
75
- switch (nodeName) {
76
- case 'Method':
77
- case 'Function':
93
+ switch (nodeTypeId) {
94
+ case Method:
95
+ case Function:
78
96
  return resolveCallable(identifier, config);
79
- case 'Property':
80
- case 'Variable':
81
- return (_a = config === null || config === void 0 ? void 0 : config.identifiers) === null || _a === void 0 ? void 0 : _a.find(x => x.name === identifier);
97
+ case Property:
98
+ case Variable:
99
+ return (_a = config === null || config === undefined ? undefined : config.identifiers) === null || _a === undefined ? undefined : _a.find(x => x.name === identifier);
82
100
  }
83
101
  };
84
- function resolveTypes(state, node, config, matchExact) {
102
+ function resolveTypes(state, node, config) {
85
103
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
86
104
  let types = new Set();
87
105
  if (!node) {
@@ -91,43 +109,43 @@ function resolveTypes(state, node, config, matchExact) {
91
109
  if (typeof (type = node.type.prop(t)) !== "undefined") {
92
110
  types.add(type);
93
111
  }
94
- else if (node.name === 'Call' && node.firstChild && node.lastChild) {
112
+ else if (node.type.is(Call) && node.firstChild && node.lastChild) {
95
113
  resolveTypes(state, node.firstChild, config).forEach(x => types.add(x));
96
114
  }
97
- else if (node.name === 'Variable') {
115
+ else if (node.type.is(Variable)) {
98
116
  const varName = state.sliceDoc(node.from, node.to) || '';
99
117
  // @ts-ignore
100
- (_b = (_a = resolveIdentifier(node.name, varName, config)) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.forEach((x) => types.add(x));
118
+ (_b = (_a = resolveIdentifier(node.type.id, varName, config)) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.forEach((x) => types.add(x));
101
119
  }
102
- else if (node.name === 'Function') {
120
+ else if (node.type.is(Function)) {
103
121
  const varName = state.sliceDoc(node.from, node.to) || '';
104
122
  // @ts-ignore
105
- (_d = (_c = resolveIdentifier(node.name, varName, config)) === null || _c === void 0 ? void 0 : _c.returnType) === null || _d === void 0 ? void 0 : _d.forEach((x) => types.add(x));
123
+ (_d = (_c = resolveIdentifier(node.type.id, varName, config)) === null || _c === undefined ? undefined : _c.returnType) === null || _d === undefined ? undefined : _d.forEach((x) => types.add(x));
106
124
  }
107
- else if (node.name === 'ObjectAccess' && node.firstChild && ((_e = node.lastChild) === null || _e === void 0 ? void 0 : _e.name) === 'Property') {
125
+ else if (node.type.is(PropertyAccess) && node.firstChild && ((_e = node.lastChild) === null || _e === undefined ? undefined : _e.type.is(Property))) {
108
126
  const varName = state.sliceDoc(node.lastChild.from, node.lastChild.to) || '';
109
- (_f = resolveTypes(state, node.firstChild, config)) === null || _f === void 0 ? void 0 : _f.forEach(baseType => {
127
+ (_f = resolveTypes(state, node.firstChild, config)) === null || _f === undefined ? undefined : _f.forEach(baseType => {
110
128
  var _a, _b, _c, _d;
111
129
  // @ts-ignore
112
- (_d = (_c = resolveIdentifier((_a = node.lastChild) === null || _a === void 0 ? void 0 : _a.name, varName, (_b = config.types) === null || _b === void 0 ? void 0 : _b[baseType])) === null || _c === void 0 ? void 0 : _c.type) === null || _d === void 0 ? void 0 : _d.forEach((x) => types.add(x));
130
+ (_d = (_c = resolveIdentifier((_a = node.lastChild) === null || _a === undefined ? undefined : _a.type.id, varName, (_b = config.types) === null || _b === undefined ? undefined : _b[baseType])) === null || _c === undefined ? undefined : _c.type) === null || _d === undefined ? undefined : _d.forEach((x) => types.add(x));
113
131
  });
114
132
  }
115
- else if (node.name === 'ObjectAccess' && node.firstChild && ((_g = node.lastChild) === null || _g === void 0 ? void 0 : _g.name) === 'Method') {
133
+ else if (node.type.is(MethodAccess) && node.firstChild && ((_g = node.lastChild) === null || _g === undefined ? undefined : _g.type.is(Method))) {
116
134
  const varName = state.sliceDoc(node.lastChild.from, node.lastChild.to) || '';
117
- (_h = resolveTypes(state, node.firstChild, config)) === null || _h === void 0 ? void 0 : _h.forEach(baseType => {
135
+ (_h = resolveTypes(state, node.firstChild, config)) === null || _h === undefined ? undefined : _h.forEach(baseType => {
118
136
  var _a, _b, _c, _d;
119
137
  // @ts-ignore
120
- (_d = (_c = resolveIdentifier((_a = node.lastChild) === null || _a === void 0 ? void 0 : _a.name, varName, (_b = config.types) === null || _b === void 0 ? void 0 : _b[baseType])) === null || _c === void 0 ? void 0 : _c.returnType) === null || _d === void 0 ? void 0 : _d.forEach((x) => types.add(x));
138
+ (_d = (_c = resolveIdentifier((_a = node.lastChild) === null || _a === undefined ? undefined : _a.type.id, varName, (_b = config.types) === null || _b === undefined ? undefined : _b[baseType])) === null || _c === undefined ? undefined : _c.returnType) === null || _d === undefined ? undefined : _d.forEach((x) => types.add(x));
121
139
  });
122
140
  }
123
- else if (node.name === 'Application' && node.firstChild) {
141
+ else if (node.type.is(Application) && node.firstChild) {
124
142
  resolveTypes(state, node.firstChild, config).forEach(x => types.add(x));
125
143
  }
126
- else if (node.name === 'TernaryExpression' && node.firstChild && node.firstChild.nextSibling && node.firstChild.nextSibling.nextSibling) {
144
+ else if (node.type.is(TernaryExpression) && node.firstChild && node.firstChild.nextSibling && node.firstChild.nextSibling.nextSibling) {
127
145
  resolveTypes(state, node.firstChild.nextSibling, config).forEach(x => types.add(x));
128
146
  resolveTypes(state, node.firstChild.nextSibling.nextSibling, config).forEach(x => types.add(x));
129
147
  }
130
- else if (node.name === 'BinaryExpression' && ((_j = node.firstChild) === null || _j === void 0 ? void 0 : _j.nextSibling) && ((_l = (_k = node.firstChild) === null || _k === void 0 ? void 0 : _k.nextSibling) === null || _l === void 0 ? void 0 : _l.nextSibling)) {
148
+ else if (node.type.is(BinaryExpression) && ((_j = node.firstChild) === null || _j === undefined ? undefined : _j.nextSibling) && ((_l = (_k = node.firstChild) === null || _k === undefined ? undefined : _k.nextSibling) === null || _l === undefined ? undefined : _l.nextSibling)) {
131
149
  const operator = state.sliceDoc(node.firstChild.nextSibling.from, node.firstChild.nextSibling.to);
132
150
  if (operator == '?:' || operator == '??' || operator == '?') {
133
151
  if (operator == '?:' || operator == '??') {
@@ -136,23 +154,23 @@ function resolveTypes(state, node, config, matchExact) {
136
154
  resolveTypes(state, node.firstChild.nextSibling.nextSibling, config).forEach(x => types.add(x));
137
155
  }
138
156
  else if (['||', '&&', '==', '!=', '===', '!==', '>=', '<=', '>', '<'].includes(operator) || keywords.find(x => x.name == operator)) {
139
- types.add(ELScalar.Bool);
157
+ types.add(exports.ELScalar.Bool);
140
158
  }
141
159
  else if (['**', '|', '^', '&', '<<', '>>', '+', '-', '*', '/', '%'].includes(operator)) {
142
- types.add(ELScalar.Number);
160
+ types.add(exports.ELScalar.Number);
143
161
  }
144
162
  }
145
- else if (node.name === 'UnaryExpression' && node.firstChild) {
163
+ else if (node.type.is(UnaryExpression) && node.firstChild) {
146
164
  const operator = state.sliceDoc(node.firstChild.from, node.firstChild.to);
147
165
  if (['not', '!'].includes(operator)) {
148
- types.add(ELScalar.Bool);
166
+ types.add(exports.ELScalar.Bool);
149
167
  }
150
168
  else if (['+', '-'].includes(operator)) {
151
- types.add(ELScalar.Number);
169
+ types.add(exports.ELScalar.Number);
152
170
  }
153
171
  }
154
172
  if (types.size === 0) {
155
- types.add(ELScalar.Any);
173
+ types.add(exports.ELScalar.Any);
156
174
  }
157
175
  return types;
158
176
  }
@@ -172,6 +190,16 @@ const keywords = [
172
190
  { name: 'xor' },
173
191
  ];
174
192
 
193
+ var utils = /*#__PURE__*/Object.freeze({
194
+ __proto__: null,
195
+ createInfoElement: createInfoElement,
196
+ getExpressionLanguageConfig: getExpressionLanguageConfig,
197
+ keywords: keywords,
198
+ resolveFunctionDefinition: resolveFunctionDefinition,
199
+ resolveIdentifier: resolveIdentifier,
200
+ resolveTypes: resolveTypes
201
+ });
202
+
175
203
  /**
176
204
  * @internal
177
205
  */
@@ -179,72 +207,93 @@ const expressionLanguageLinterSource = (state) => {
179
207
  const config = getExpressionLanguageConfig(state);
180
208
  let diagnostics = [];
181
209
  language.syntaxTree(state).cursor().iterate(node => {
182
- var _a, _b, _c, _d, _e, _f, _g;
183
- const { from, to, name } = node;
210
+ var _a, _b, _c, _d, _e, _f;
211
+ const { from, to, type: { id } } = node;
184
212
  let identifier;
185
- switch (name) {
186
- case '⚠':
213
+ switch (id) {
214
+ case 0:
187
215
  if (state.doc.length === 0 || from === 0) {
188
216
  // Don't show error on empty doc (even though it is an error)
189
217
  return;
190
218
  }
191
219
  identifier = state.sliceDoc(from, to);
192
220
  if (identifier.length === 0) {
193
- diagnostics.push({ from, to: (_c = (_b = (_a = node.node.parent) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.to) !== null && _c !== void 0 ? _c : to, severity: 'error', message: `Expression expected` });
221
+ diagnostics.push({ from, to: (_c = (_b = (_a = node.node.parent) === null || _a === undefined ? undefined : _a.parent) === null || _b === undefined ? undefined : _b.to) !== null && _c !== undefined ? _c : to, severity: 'error', message: `Expression expected` });
194
222
  }
195
223
  else {
196
224
  const type = /^[a-zA-Z_]+[a-zA-Z_0-9]*$/.test(identifier) ? 'identifier' : 'operator';
197
- diagnostics.push({ from, to, severity: 'error', message: `Unexpected ${type} '${identifier}'` });
225
+ diagnostics.push({ from, to, severity: 'error', message: `Unexpected ${type} <code>${identifier}</code>` });
198
226
  }
199
227
  return;
200
- case 'Arguments':
201
- const args = (_d = resolveFunctionDefinition(node.node.prevSibling, state, config)) === null || _d === void 0 ? void 0 : _d.args;
228
+ case Arguments:
229
+ const fn = resolveFunctionDefinition(node.node.prevSibling, state, config);
230
+ const args = fn === null || fn === undefined ? undefined : fn.args;
202
231
  if (!args) {
203
232
  return;
204
233
  }
205
- let i = 0;
206
- let n = node.node.firstChild;
207
- while (n) {
208
- if (n.name !== 'BlockComment' && ++i > args.length) {
209
- diagnostics.push({ from: n.from, to: n.to, severity: 'error', message: `Unexpected argument` });
234
+ for (let n = node.node.firstChild, i = 0; n != null; n = n.nextSibling) {
235
+ if (n.type.is(BlockComment)) {
236
+ continue;
237
+ }
238
+ if (i > args.length - 1) {
239
+ diagnostics.push({ from: n.from, to: n.to, severity: 'warning', message: `Unexpected argument – <code>${fn.name}</code> takes ${args.length} argument${args.length == 1 ? '' : 's'}` });
240
+ continue;
210
241
  }
211
- n = n.nextSibling;
242
+ const typesUsed = Array.from(resolveTypes(state, n, config));
243
+ const typesExpected = args[i].type;
244
+ if (typesExpected && !typesExpected.includes(exports.ELScalar.Any) && !typesUsed.some(x => typesExpected.includes(x))) {
245
+ diagnostics.push({ from: n.from, to: n.to, severity: 'error', message: `<code>${typesExpected.join('|')}</code> expected, got <code>${typesUsed.join('|')}</code>` });
246
+ }
247
+ i++;
212
248
  }
213
249
  break;
214
- case 'Property':
215
- case 'Method':
216
- const leftArgument = (_f = (_e = node.node.parent) === null || _e === void 0 ? void 0 : _e.firstChild) === null || _f === void 0 ? void 0 : _f.node;
250
+ case Property:
251
+ case Method:
252
+ const leftArgument = (_e = (_d = node.node.parent) === null || _d === undefined ? undefined : _d.firstChild) === null || _e === undefined ? undefined : _e.node;
217
253
  const types = Array.from(resolveTypes(state, leftArgument, config));
218
254
  identifier = state.sliceDoc(from, to);
219
- if (!types.find(type => { var _a; return resolveIdentifier(name, identifier, (_a = config.types) === null || _a === void 0 ? void 0 : _a[type]); })) {
220
- diagnostics.push({ from, to, severity: 'error', message: `${node.name} "${identifier}" not found in ${types.join('|')}` });
255
+ if (!types.find(type => { var _a; return resolveIdentifier(id, identifier, (_a = config.types) === null || _a === undefined ? undefined : _a[type]); })) {
256
+ diagnostics.push({ from, to, severity: 'error', message: `${node.name} <code>${identifier}</code> not found in <code>${types.join('|')}</code>` });
221
257
  }
222
258
  break;
223
- case 'Variable':
224
- case 'Function':
259
+ case Variable:
260
+ case Function:
225
261
  identifier = state.sliceDoc(from, node.node.firstChild ? node.node.firstChild.from - 1 : to);
226
- if (!resolveIdentifier(name, identifier, config)) {
227
- diagnostics.push({ from, to, severity: 'error', message: `${node.node.name} "${identifier}" not found` });
262
+ if (!resolveIdentifier(id, identifier, config)) {
263
+ diagnostics.push({ from, to, severity: 'error', message: `${node.node.name} <code>${identifier}</code> not found` });
228
264
  }
229
265
  break;
230
266
  }
231
- if (identifier && ((_g = node.node.parent) === null || _g === void 0 ? void 0 : _g.type.isError)) {
232
- diagnostics.push({ from, to, severity: 'error', message: `Unexpected identifier "${identifier}"` });
267
+ if (identifier && ((_f = node.node.parent) === null || _f === undefined ? undefined : _f.type.isError)) {
268
+ diagnostics.push({ from, to, severity: 'error', message: `Unexpected identifier <code>${identifier}</code>` });
233
269
  }
234
270
  });
271
+ diagnostics.forEach(d => {
272
+ d.renderMessage = () => {
273
+ const span = document.createElement('span');
274
+ span.innerHTML = d.message;
275
+ return span;
276
+ };
277
+ });
235
278
  return diagnostics;
236
279
  };
237
280
  const expressionLanguageLinter = lint.linter(view => expressionLanguageLinterSource(view.state));
238
281
 
282
+ var linter = /*#__PURE__*/Object.freeze({
283
+ __proto__: null,
284
+ expressionLanguageLinter: expressionLanguageLinter,
285
+ expressionLanguageLinterSource: expressionLanguageLinterSource
286
+ });
287
+
239
288
  const autocompleteFunction = (x) => {
240
289
  var _a, _b, _c;
241
290
  return ({
242
- label: `${x.name}(${((_b = (_a = x.args) === null || _a === void 0 ? void 0 : _a.map(x => x.name)) === null || _b === void 0 ? void 0 : _b.join(',')) || ''})`,
291
+ label: `${x.name}(${((_b = (_a = x.args) === null || _a === undefined ? undefined : _a.map(x => x.name)) === null || _b === undefined ? undefined : _b.join(',')) || ''})`,
243
292
  apply: (view, completion, from, to) => {
244
- var _a;
245
- view.dispatch(Object.assign(Object.assign({}, autocomplete.insertCompletionText(view.state, `${x.name}()`, from, to)), { selection: { anchor: from + x.name.length + (((_a = x.args) === null || _a === void 0 ? void 0 : _a.length) > 0 ? 1 : 2) } }));
293
+ var _a, _b;
294
+ view.dispatch(Object.assign(Object.assign({}, autocomplete.insertCompletionText(view.state, `${x.name}()`, from, to)), { selection: { anchor: from + x.name.length + (((_b = (_a = x.args) === null || _a === undefined ? undefined : _a.length) !== null && _b !== undefined ? _b : 0) > 0 ? 1 : 2) } }));
246
295
  },
247
- detail: (_c = x.returnType) === null || _c === void 0 ? void 0 : _c.join('|'),
296
+ detail: (_c = x.returnType) === null || _c === undefined ? undefined : _c.join('|'),
248
297
  info: x.info,
249
298
  type: "function",
250
299
  });
@@ -255,7 +304,7 @@ const autocompleteIdentifier = (x) => {
255
304
  label: x.name,
256
305
  apply: x.name,
257
306
  info: x.info,
258
- detail: x.detail || ((_a = x.type) === null || _a === void 0 ? void 0 : _a.join('|')),
307
+ detail: x.detail || ((_a = x.type) === null || _a === undefined ? undefined : _a.join('|')),
259
308
  type: 'variable',
260
309
  });
261
310
  };
@@ -270,14 +319,14 @@ function completeOperatorKeyword(state, config, tree, from, to, explicit) {
270
319
  info: info,
271
320
  detail,
272
321
  type: "keyword"
273
- }))) !== null && _a !== void 0 ? _a : [],
274
- validFor: (text) => { var _a; return (_a = keywords.some(({ name }) => explicit || name.includes(text))) !== null && _a !== void 0 ? _a : false; },
322
+ }))) !== null && _a !== undefined ? _a : [],
323
+ validFor: (text) => { var _a; return (_a = keywords.some(({ name }) => explicit || name.includes(text))) !== null && _a !== undefined ? _a : false; },
275
324
  };
276
325
  }
277
326
  function completeIdentifier(state, config, tree, from, to) {
278
327
  var _a, _b;
279
- const identifiers = (_a = config.identifiers) !== null && _a !== void 0 ? _a : []; //?.filter(({ name }) => explicit || name.toLowerCase().startsWith(text)) ?? [];
280
- const functions = (_b = config.functions) !== null && _b !== void 0 ? _b : []; //?.filter(({ name }) => explicit || name.toLowerCase().startsWith(text)) ?? [];
328
+ const identifiers = (_a = config.identifiers) !== null && _a !== undefined ? _a : []; //?.filter(({ name }) => explicit || name.toLowerCase().startsWith(text)) ?? [];
329
+ const functions = (_b = config.functions) !== null && _b !== undefined ? _b : []; //?.filter(({ name }) => explicit || name.toLowerCase().startsWith(text)) ?? [];
281
330
  return {
282
331
  from,
283
332
  to,
@@ -286,18 +335,18 @@ function completeIdentifier(state, config, tree, from, to) {
286
335
  };
287
336
  }
288
337
  function completeMember(state, config, tree, from, to, explicit) {
289
- var _a, _b, _c, _d;
290
- if (((_a = tree.parent) === null || _a === void 0 ? void 0 : _a.name) != 'ObjectAccess' || !tree.parent.firstChild) {
338
+ var _a, _b, _c, _d, _e, _f;
339
+ if (!(((_a = tree.parent) === null || _a === undefined ? undefined : _a.type.is(PropertyAccess)) || ((_b = tree.parent) === null || _b === undefined ? undefined : _b.type.is(MethodAccess))) || !((_c = tree.parent) === null || _c === undefined ? undefined : _c.firstChild)) {
291
340
  return null;
292
341
  }
293
342
  const types = resolveTypes(state, tree.parent.firstChild.node, config);
294
- if (!(types === null || types === void 0 ? void 0 : types.size)) {
343
+ if (!(types === null || types === undefined ? undefined : types.size)) {
295
344
  return null;
296
345
  }
297
346
  let options = [];
298
347
  for (const type of types) {
299
- const typeDeclaration = (_b = config.types) === null || _b === void 0 ? void 0 : _b[type];
300
- options.push(...(((_c = typeDeclaration === null || typeDeclaration === void 0 ? void 0 : typeDeclaration.identifiers) === null || _c === void 0 ? void 0 : _c.map(autocompleteIdentifier)) || []), ...(((_d = typeDeclaration === null || typeDeclaration === void 0 ? void 0 : typeDeclaration.functions) === null || _d === void 0 ? void 0 : _d.map(autocompleteFunction)) || []));
348
+ const typeDeclaration = (_d = config.types) === null || _d === undefined ? undefined : _d[type];
349
+ options.push(...(((_e = typeDeclaration === null || typeDeclaration === undefined ? undefined : typeDeclaration.identifiers) === null || _e === undefined ? undefined : _e.map(autocompleteIdentifier)) || []), ...(((_f = typeDeclaration === null || typeDeclaration === undefined ? undefined : typeDeclaration.functions) === null || _f === undefined ? undefined : _f.map(autocompleteFunction)) || []));
301
350
  }
302
351
  return {
303
352
  from,
@@ -307,34 +356,39 @@ function completeMember(state, config, tree, from, to, explicit) {
307
356
  };
308
357
  }
309
358
  function expressionLanguageCompletion(context) {
310
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
359
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
311
360
  const { state, pos, explicit } = context;
312
361
  const tree = language.syntaxTree(state);
313
362
  const lastChar = state.sliceDoc(pos - 1, pos);
314
363
  const prevNode = tree.resolveInner(pos, lastChar === ')' ? 0 : -1);
315
364
  const config = getExpressionLanguageConfig(state);
316
- const isIdentifier = (node) => { var _a; return ['Variable', 'Function'].includes((_a = node === null || node === void 0 ? void 0 : node.name) !== null && _a !== void 0 ? _a : ''); };
317
- const isMember = (node) => { var _a; return ['Property', 'Method'].includes((_a = node === null || node === void 0 ? void 0 : node.name) !== null && _a !== void 0 ? _a : ''); };
318
- if (prevNode.name == 'String' || prevNode.name == 'BlockComment') {
365
+ const isIdentifier = (node) => (node === null || node === undefined ? undefined : node.type.is(Variable)) || (node === null || node === undefined ? undefined : node.type.is(Function));
366
+ const isMember = (node) => (node === null || node === undefined ? undefined : node.type.is(Property)) || (node === null || node === undefined ? undefined : node.type.is(Method));
367
+ if (prevNode.type.is(String) || prevNode.type.is(BlockComment)) {
319
368
  return null;
320
369
  }
321
- if (((_a = prevNode.parent) === null || _a === void 0 ? void 0 : _a.name) == 'ObjectAccess' && ['ObjectAccess', 'ArrayAccess', 'Variable', 'Call', 'Application'].includes(((_b = prevNode.parent.firstChild) === null || _b === void 0 ? void 0 : _b.name) || '')) {
370
+ if ((((_a = prevNode.parent) === null || _a === undefined ? undefined : _a.type.is(PropertyAccess)) || ((_b = prevNode.parent) === null || _b === undefined ? undefined : _b.type.is(MethodAccess))) && [PropertyAccess, MethodAccess, ArrayAccess, Variable, Call, Application].includes((_c = prevNode.parent.firstChild) === null || _c === undefined ? undefined : _c.type.id)) {
322
371
  return completeMember(state, config, prevNode, isIdentifier(prevNode) || isMember(prevNode) ? prevNode.from : pos, pos);
323
372
  }
324
- if (['Expression', 'UnaryExpression', 'BinaryExpression', 'TernaryExpression'].includes(prevNode.name) && prevNode.lastChild && !((_c = prevNode.lastChild) === null || _c === void 0 ? void 0 : _c.type.isError)
325
- || ['Arguments', 'Array'].includes(prevNode.name) && prevNode.lastChild && !((_d = prevNode.lastChild) === null || _d === void 0 ? void 0 : _d.type.isError)
326
- || ['Expression', 'UnaryExpression', 'BinaryExpression', 'TernaryExpression'].includes((_f = (_e = prevNode.parent) === null || _e === void 0 ? void 0 : _e.name) !== null && _f !== void 0 ? _f : '') && prevNode.type.isError
327
- || ['Variable', 'Function'].includes((_h = (_g = prevNode.parent) === null || _g === void 0 ? void 0 : _g.name) !== null && _h !== void 0 ? _h : '') && prevNode.type.isError) {
328
- return completeOperatorKeyword(state, config, prevNode, !['Expression', 'UnaryExpression', 'BinaryExpression', 'TernaryExpression', 'Arguments'].includes(prevNode.name) ? prevNode.from : pos, pos, explicit);
373
+ if (/^[\sa-z]*$/.test(lastChar) && ([Expression, UnaryExpression, BinaryExpression, TernaryExpression].includes(prevNode.type.id) && prevNode.lastChild && !((_d = prevNode.lastChild) === null || _d === undefined ? undefined : _d.type.isError)
374
+ || [Arguments, Array$1].includes(prevNode.type.id) && prevNode.lastChild && !((_e = prevNode.lastChild) === null || _e === undefined ? undefined : _e.type.isError)
375
+ || [Expression, UnaryExpression, BinaryExpression, TernaryExpression].includes((_f = prevNode.parent) === null || _f === undefined ? undefined : _f.type.id) && prevNode.type.isError
376
+ || [Variable, Function].includes((_g = prevNode.parent) === null || _g === undefined ? undefined : _g.type.id) && prevNode.type.isError)) {
377
+ return completeOperatorKeyword(state, config, prevNode, ![Expression, UnaryExpression, BinaryExpression, TernaryExpression, Arguments].includes(prevNode.type.id) ? prevNode.from : pos, pos, explicit);
329
378
  }
330
- if (!/[0-9]/.test(lastChar) && !['OperatorKeyword'].includes((_j = prevNode.name) !== null && _j !== void 0 ? _j : '') && (['Expression', 'UnaryExpression', 'BinaryExpression', 'TernaryExpression'].includes(prevNode.name) && ((_k = prevNode.lastChild) === null || _k === void 0 ? void 0 : _k.type.isError)
331
- || ['Expression', 'UnaryExpression', 'BinaryExpression', 'TernaryExpression', 'Arguments'].includes((_m = (_l = prevNode.parent) === null || _l === void 0 ? void 0 : _l.name) !== null && _m !== void 0 ? _m : '') && !prevNode.type.isError
332
- || ['Arguments', 'Array'].includes((_o = prevNode.name) !== null && _o !== void 0 ? _o : ''))) {
379
+ if (!/[0-9]/.test(lastChar) && !prevNode.type.is(OperatorKeyword) && ([Expression, UnaryExpression, BinaryExpression, TernaryExpression].includes(prevNode.type.id) && ((_h = prevNode.lastChild) === null || _h === undefined ? undefined : _h.type.isError)
380
+ || [Expression, UnaryExpression, BinaryExpression, TernaryExpression, Arguments].includes((_k = (_j = prevNode.parent) === null || _j === undefined ? undefined : _j.type.id) !== null && _k !== undefined ? _k : -1) && !prevNode.type.isError
381
+ || prevNode.type.is(Arguments) || prevNode.type.is(Array$1))) {
333
382
  return completeIdentifier(state, config, prevNode, isIdentifier(prevNode) ? prevNode.from : pos, pos);
334
383
  }
335
384
  return null;
336
385
  }
337
386
 
387
+ var complete = /*#__PURE__*/Object.freeze({
388
+ __proto__: null,
389
+ expressionLanguageCompletion: expressionLanguageCompletion
390
+ });
391
+
338
392
  function getNodeOrdinal(node) {
339
393
  let ordinal = -1;
340
394
  // noinspection StatementWithEmptyBodyJS
@@ -344,7 +398,7 @@ function getNodeOrdinal(node) {
344
398
  }
345
399
  function resolveArguments(node) {
346
400
  let c = node;
347
- while (c && c.name !== 'Arguments') {
401
+ while (c && !c.type.is(Arguments)) {
348
402
  c = c.parent;
349
403
  }
350
404
  return c;
@@ -367,7 +421,7 @@ function getCursorTooltips(state) {
367
421
  return null;
368
422
  }
369
423
  const n = args.childAfter(range.from - 1);
370
- const argName = (_b = (_a = fn.args) === null || _a === void 0 ? void 0 : _a[n ? getNodeOrdinal(n) : 0]) === null || _b === void 0 ? void 0 : _b.name;
424
+ const argName = (_b = (_a = fn.args) === null || _a === undefined ? undefined : _a[n ? getNodeOrdinal(n) : 0]) === null || _b === undefined ? undefined : _b.name;
371
425
  if (n && n.from !== range.from || !argName) {
372
426
  return null;
373
427
  }
@@ -396,12 +450,12 @@ const cursorTooltipField = state.StateField.define({
396
450
  provide: f => view.showTooltip.computeN([f], state => state.field(f))
397
451
  });
398
452
  const keywordTooltip = view.hoverTooltip((view, pos, side) => {
399
- var _a, _b, _c, _d, _e, _f, _g;
453
+ var _a, _b, _c, _d, _e, _f, _g, _h;
400
454
  const config = getExpressionLanguageConfig(view.state);
401
455
  const tree = language.syntaxTree(view.state).resolveInner(pos, side);
402
- if (tree.name === 'OperatorKeyword') {
456
+ if (tree.type.is(OperatorKeyword)) {
403
457
  const name = view.state.sliceDoc(tree.from, tree.to);
404
- const info = (_a = keywords.find(x => x.name === name)) === null || _a === void 0 ? void 0 : _a.info;
458
+ const info = (_a = keywords.find(x => x.name === name)) === null || _a === undefined ? undefined : _a.info;
405
459
  if (info) {
406
460
  return {
407
461
  pos: tree.from,
@@ -411,25 +465,25 @@ const keywordTooltip = view.hoverTooltip((view, pos, side) => {
411
465
  };
412
466
  }
413
467
  }
414
- if (!['Function', 'Variable', 'Method', 'Property'].includes(tree.name)) {
468
+ if (![Function, Variable, Method, Property].includes(tree.type.id)) {
415
469
  return null;
416
470
  }
417
471
  const skipEmpty = (x) => x;
418
472
  let info;
419
- if (((_b = tree.parent) === null || _b === void 0 ? void 0 : _b.firstChild) && ((_c = tree.parent) === null || _c === void 0 ? void 0 : _c.name) === 'ObjectAccess' && tree.prevSibling) {
473
+ if (((_b = tree.parent) === null || _b === undefined ? undefined : _b.firstChild) && (((_c = tree.parent) === null || _c === undefined ? undefined : _c.type.is(PropertyAccess)) || ((_d = tree.parent) === null || _d === undefined ? undefined : _d.type.is(MethodAccess))) && tree.prevSibling) {
420
474
  const node = tree.parent.firstChild;
421
475
  const types = Array.from(resolveTypes(view.state, node, config));
422
476
  const name = view.state.sliceDoc(tree.from, tree.to);
423
477
  info = [
424
- ...types.map(type => { var _a, _b, _c, _d; return (_d = (_c = (_b = (_a = config.types) === null || _a === void 0 ? void 0 : _a[type]) === null || _b === void 0 ? void 0 : _b.identifiers) === null || _c === void 0 ? void 0 : _c.find(x => x.name === name)) === null || _d === void 0 ? void 0 : _d.info; }).filter(skipEmpty),
425
- ...types.map(type => { var _a, _b, _c, _d; return (_d = (_c = (_b = (_a = config.types) === null || _a === void 0 ? void 0 : _a[type]) === null || _b === void 0 ? void 0 : _b.functions) === null || _c === void 0 ? void 0 : _c.find(x => x.name === name)) === null || _d === void 0 ? void 0 : _d.info; }).filter(skipEmpty),
478
+ ...types.map(type => { var _a, _b, _c, _d; return (_d = (_c = (_b = (_a = config.types) === null || _a === undefined ? undefined : _a[type]) === null || _b === undefined ? undefined : _b.identifiers) === null || _c === undefined ? undefined : _c.find(x => x.name === name)) === null || _d === undefined ? undefined : _d.info; }).filter(skipEmpty),
479
+ ...types.map(type => { var _a, _b, _c, _d; return (_d = (_c = (_b = (_a = config.types) === null || _a === undefined ? undefined : _a[type]) === null || _b === undefined ? undefined : _b.functions) === null || _c === undefined ? undefined : _c.find(x => x.name === name)) === null || _d === undefined ? undefined : _d.info; }).filter(skipEmpty),
426
480
  ].join('\n');
427
481
  }
428
482
  else {
429
483
  const name = view.state.sliceDoc(tree.from, tree.to);
430
484
  info = [
431
- ...[(_e = (_d = config.identifiers) === null || _d === void 0 ? void 0 : _d.find(x => x.name === name)) === null || _e === void 0 ? void 0 : _e.info].filter(skipEmpty),
432
- ...[(_g = (_f = config.functions) === null || _f === void 0 ? void 0 : _f.find(x => x.name === name)) === null || _g === void 0 ? void 0 : _g.info].filter(skipEmpty),
485
+ ...[(_f = (_e = config.identifiers) === null || _e === undefined ? undefined : _e.find(x => x.name === name)) === null || _f === undefined ? undefined : _f.info].filter(skipEmpty),
486
+ ...[(_h = (_g = config.functions) === null || _g === undefined ? undefined : _g.find(x => x.name === name)) === null || _h === undefined ? undefined : _h.info].filter(skipEmpty),
433
487
  ].join('\n');
434
488
  }
435
489
  if (!info) {
@@ -443,6 +497,12 @@ const keywordTooltip = view.hoverTooltip((view, pos, side) => {
443
497
  };
444
498
  });
445
499
 
500
+ var tooltip = /*#__PURE__*/Object.freeze({
501
+ __proto__: null,
502
+ cursorTooltipField: cursorTooltipField,
503
+ keywordTooltip: keywordTooltip
504
+ });
505
+
446
506
  const baseTheme = view.EditorView.baseTheme({
447
507
  ".cm-tooltip.cm-tooltip-cursor": {
448
508
  boxShadow: 'rgba(0, 0, 0, .15) 0 1px 2px',
@@ -465,6 +525,11 @@ const baseTheme = view.EditorView.baseTheme({
465
525
  opacity: 0.5,
466
526
  fontStyle: "inherit !important",
467
527
  },
528
+ "code": {
529
+ fontSize: ".8em",
530
+ fontStyle: "monospace",
531
+ backgroundColor: "rgba(127, 127, 127, .3)",
532
+ },
468
533
  });
469
534
 
470
535
  const ELLanguage = language.LRLanguage.define({
@@ -519,4 +584,8 @@ function expressionlanguage(config = {}, extensions = []) {
519
584
  }
520
585
 
521
586
  exports.ELLanguage = ELLanguage;
587
+ exports._complete = complete;
588
+ exports._linter = linter;
589
+ exports._tooltip = tooltip;
590
+ exports._utils = utils;
522
591
  exports.expressionlanguage = expressionlanguage;