@valtzu/codemirror-lang-el 0.7.0 → 0.8.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/README.md +1 -22
- package/dist/index.cjs +30 -11
- package/dist/index.js +30 -11
- package/dist/linter.cjs +19 -5
- package/dist/linter.js +19 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -50,27 +50,6 @@ yarn add @valtzu/codemirror-lang-el
|
|
|
50
50
|
|
|
51
51
|
```html
|
|
52
52
|
<div id="editor"></div>
|
|
53
|
-
<script type="importmap">
|
|
54
|
-
{
|
|
55
|
-
"imports": {
|
|
56
|
-
"codemirror": "https://esm.sh/*codemirror@6.0.1",
|
|
57
|
-
"@codemirror/state": "https://esm.sh/*@codemirror/state@6.4.1",
|
|
58
|
-
"@codemirror/search": "https://esm.sh/*@codemirror/search@6.5.6",
|
|
59
|
-
"@codemirror/autocomplete": "https://esm.sh/*@codemirror/autocomplete@6.9.0",
|
|
60
|
-
"@codemirror/view": "https://esm.sh/*@codemirror/view@6.26.3",
|
|
61
|
-
"@codemirror/commands": "https://esm.sh/*@codemirror/commands@6.2.5",
|
|
62
|
-
"@codemirror/language": "https://esm.sh/*@codemirror/language@6.9.0",
|
|
63
|
-
"@codemirror/lint": "https://esm.sh/*@codemirror/lint@6.4.1",
|
|
64
|
-
"@lezer/lr": "https://esm.sh/*@lezer/lr@1.3.9",
|
|
65
|
-
"@lezer/highlight": "https://esm.sh/*@lezer/highlight@1.1.6",
|
|
66
|
-
"@lezer/common": "https://esm.sh/*@lezer/common@1.2.1",
|
|
67
|
-
"style-mod": "https://esm.sh/*style-mod@4.1.2",
|
|
68
|
-
"w3c-keyname": "https://esm.sh/*w3c-keyname@2.2.8",
|
|
69
|
-
"crelt": "https://esm.sh/*crelt@1.0.6",
|
|
70
|
-
"@valtzu/codemirror-lang-el": "https://esm.sh/*@valtzu/codemirror-lang-el@0.6.3"
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
</script>
|
|
74
53
|
<script type="module">
|
|
75
54
|
import { EditorView, basicSetup } from "codemirror";
|
|
76
55
|
import { acceptCompletion } from "@codemirror/autocomplete";
|
|
@@ -103,7 +82,7 @@ yarn add @valtzu/codemirror-lang-el
|
|
|
103
82
|
{ name: "user", type: ["User"], info: 'This is the user' },
|
|
104
83
|
],
|
|
105
84
|
functions: [
|
|
106
|
-
{ name: "is_granted", args: ["
|
|
85
|
+
{ name: "is_granted", args: [{name: "attributes", type: ["string"]}, {name: "object", type: ["object"], optional: true}], info: 'Check if subject has permission to the object', returnType: ['bool'] },
|
|
107
86
|
],
|
|
108
87
|
})
|
|
109
88
|
],
|
package/dist/index.cjs
CHANGED
|
@@ -17,16 +17,16 @@ const t = {
|
|
|
17
17
|
|
|
18
18
|
// This file was generated by lezer-generator. You probably shouldn't edit it.
|
|
19
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, "
|
|
20
|
+
const spec_Operator = {__proto__:null,"?":111, "!":133, "~":135, "+":137, "-":139};
|
|
21
21
|
const parser = lr.LRParser.deserialize({
|
|
22
22
|
version: 14,
|
|
23
|
-
states: ")rOYQPOOP
|
|
24
|
-
stateData: "
|
|
23
|
+
states: ")rOYQPOOP!aOPOOQ!fQPOOO#dQPO'#CeO$wQPO'#CnO%OQPO'#CoOYQPO'#CuOYQPO'#CwOOQO'#DS'#DSO%VQPO'#CdO%[QPO'#CdOOQO'#Cl'#ClOOQO'#Cm'#CmOOQO'#Cv'#CvP%aOQO'#C]POOO)C>r)C>rO%lQPO,58yOYQPO,58}OYQPO,59_OYQPO,59]O%qQPO'#CtOOQO'#Ct'#CtO%vQPO'#CtO'QQPO,59YOOQO,59Y,59YO'XQPO'#DYO'fQPO,59ZO'kQPO,59aO(RQPO,59cO(YQPO'#C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}nq!Unq~P!fO_TfS^wS~",
|
|
25
25
|
goto: "%l}P!OP!RPP!d!R!R!g!x!{#^#aPP!R!R!R!R!R!RP!R#d!R#s!R$U$[$bPPPPPPP$hPPPPP%cR_PoWOSTUVabcmoz{!U!]!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
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",
|
|
27
|
-
maxTerm:
|
|
27
|
+
maxTerm: 69,
|
|
28
28
|
nodeProps: [
|
|
29
|
-
[t, 14,"number",15,"string",16,"bool",17,"null"]
|
|
29
|
+
[t, 14,"number",15,"string",16,"bool",17,"null",18,"object",19,"array"]
|
|
30
30
|
],
|
|
31
31
|
skippedNodes: [0,1,28],
|
|
32
32
|
repeatNodeCount: 3,
|
|
@@ -34,7 +34,7 @@ const parser = lr.LRParser.deserialize({
|
|
|
34
34
|
tokenizers: [1, new lr.LocalTokenGroup("j~RQYZXz{^~^Ot~~aP!P!Qd~iOu~~", 25, 35)],
|
|
35
35
|
topRules: {"Expression":[0,2]},
|
|
36
36
|
specialized: [{term: 39, get: (value) => spec_word[value] || -1},{term: 22, get: (value) => spec_Operator[value] || -1}],
|
|
37
|
-
tokenPrec:
|
|
37
|
+
tokenPrec: 542
|
|
38
38
|
});
|
|
39
39
|
|
|
40
40
|
var ELScalar;
|
|
@@ -202,13 +202,20 @@ const expressionLanguageLinterSource = (state) => {
|
|
|
202
202
|
if (!args) {
|
|
203
203
|
return;
|
|
204
204
|
}
|
|
205
|
-
let i = 0;
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
205
|
+
for (let n = node.node.firstChild, i = 0; n != null; n = n.nextSibling) {
|
|
206
|
+
if (n.name === 'BlockComment') {
|
|
207
|
+
continue;
|
|
208
|
+
}
|
|
209
|
+
if (i > args.length - 1) {
|
|
209
210
|
diagnostics.push({ from: n.from, to: n.to, severity: 'error', message: `Unexpected argument` });
|
|
211
|
+
continue;
|
|
212
|
+
}
|
|
213
|
+
const typesUsed = Array.from(resolveTypes(state, n, config));
|
|
214
|
+
const typesExpected = args[i].type;
|
|
215
|
+
if (typesExpected && !typesExpected.includes(ELScalar.Any) && !typesUsed.some(x => typesExpected.includes(x))) {
|
|
216
|
+
diagnostics.push({ from: n.from, to: n.to, severity: 'error', message: `<code>${typesExpected.join('|')}</code> expected, got <code>${typesUsed.join('|')}</code>` });
|
|
210
217
|
}
|
|
211
|
-
|
|
218
|
+
i++;
|
|
212
219
|
}
|
|
213
220
|
break;
|
|
214
221
|
case 'Property':
|
|
@@ -232,6 +239,13 @@ const expressionLanguageLinterSource = (state) => {
|
|
|
232
239
|
diagnostics.push({ from, to, severity: 'error', message: `Unexpected identifier "${identifier}"` });
|
|
233
240
|
}
|
|
234
241
|
});
|
|
242
|
+
diagnostics.forEach(d => {
|
|
243
|
+
d.renderMessage = () => {
|
|
244
|
+
const span = document.createElement('span');
|
|
245
|
+
span.innerHTML = d.message;
|
|
246
|
+
return span;
|
|
247
|
+
};
|
|
248
|
+
});
|
|
235
249
|
return diagnostics;
|
|
236
250
|
};
|
|
237
251
|
const expressionLanguageLinter = lint.linter(view => expressionLanguageLinterSource(view.state));
|
|
@@ -465,6 +479,11 @@ const baseTheme = view.EditorView.baseTheme({
|
|
|
465
479
|
opacity: 0.5,
|
|
466
480
|
fontStyle: "inherit !important",
|
|
467
481
|
},
|
|
482
|
+
"code": {
|
|
483
|
+
fontSize: ".8em",
|
|
484
|
+
fontStyle: "monospace",
|
|
485
|
+
backgroundColor: "rgba(127, 127, 127, .3)",
|
|
486
|
+
},
|
|
468
487
|
});
|
|
469
488
|
|
|
470
489
|
const ELLanguage = language.LRLanguage.define({
|
package/dist/index.js
CHANGED
|
@@ -13,16 +13,16 @@ const t = {
|
|
|
13
13
|
|
|
14
14
|
// This file was generated by lezer-generator. You probably shouldn't edit it.
|
|
15
15
|
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};
|
|
16
|
-
const spec_Operator = {__proto__:null,"?":111, "!":133, "
|
|
16
|
+
const spec_Operator = {__proto__:null,"?":111, "!":133, "~":135, "+":137, "-":139};
|
|
17
17
|
const parser = LRParser.deserialize({
|
|
18
18
|
version: 14,
|
|
19
|
-
states: ")rOYQPOOP
|
|
20
|
-
stateData: "
|
|
19
|
+
states: ")rOYQPOOP!aOPOOQ!fQPOOO#dQPO'#CeO$wQPO'#CnO%OQPO'#CoOYQPO'#CuOYQPO'#CwOOQO'#DS'#DSO%VQPO'#CdO%[QPO'#CdOOQO'#Cl'#ClOOQO'#Cm'#CmOOQO'#Cv'#CvP%aOQO'#C]POOO)C>r)C>rO%lQPO,58yOYQPO,58}OYQPO,59_OYQPO,59]O%qQPO'#CtOOQO'#Ct'#CtO%vQPO'#CtO'QQPO,59YOOQO,59Y,59YO'XQPO'#DYO'fQPO,59ZO'kQPO,59aO(RQPO,59cO(YQPO'#CfOOQO,59O,59OO(YQPO'#CiPOOO'#Cx'#CxP(aOQO,58wPOOO,58w,58wO(lQPO'#CbOOQO1G.e1G.eOOQO1G.m1G.mO*PQPO1G.iO*WQPO1G.yO*nQPO1G.wOOQO,59`,59`OYQPO1G.tOYQPO'#CyO*uQPO,59tOOQO1G.u1G.uOOQO1G.}1G.}O+QQPO,59QO+VQPO,59TPOOO-E6v-E6vPOOO1G.c1G.cOOQO7+$T7+$TOYQPO7+$cO+[QPO7+$`O+fQPO,59eOOQO-E6w-E6wOOQO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!W{Q![!UQ!`!]R!d!cQjTQ!PmR!Qo",
|
|
22
22
|
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",
|
|
23
|
-
maxTerm:
|
|
23
|
+
maxTerm: 69,
|
|
24
24
|
nodeProps: [
|
|
25
|
-
[t, 14,"number",15,"string",16,"bool",17,"null"]
|
|
25
|
+
[t, 14,"number",15,"string",16,"bool",17,"null",18,"object",19,"array"]
|
|
26
26
|
],
|
|
27
27
|
skippedNodes: [0,1,28],
|
|
28
28
|
repeatNodeCount: 3,
|
|
@@ -30,7 +30,7 @@ const parser = LRParser.deserialize({
|
|
|
30
30
|
tokenizers: [1, new LocalTokenGroup("j~RQYZXz{^~^Ot~~aP!P!Qd~iOu~~", 25, 35)],
|
|
31
31
|
topRules: {"Expression":[0,2]},
|
|
32
32
|
specialized: [{term: 39, get: (value) => spec_word[value] || -1},{term: 22, get: (value) => spec_Operator[value] || -1}],
|
|
33
|
-
tokenPrec:
|
|
33
|
+
tokenPrec: 542
|
|
34
34
|
});
|
|
35
35
|
|
|
36
36
|
var ELScalar;
|
|
@@ -198,13 +198,20 @@ const expressionLanguageLinterSource = (state) => {
|
|
|
198
198
|
if (!args) {
|
|
199
199
|
return;
|
|
200
200
|
}
|
|
201
|
-
let i = 0;
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
201
|
+
for (let n = node.node.firstChild, i = 0; n != null; n = n.nextSibling) {
|
|
202
|
+
if (n.name === 'BlockComment') {
|
|
203
|
+
continue;
|
|
204
|
+
}
|
|
205
|
+
if (i > args.length - 1) {
|
|
205
206
|
diagnostics.push({ from: n.from, to: n.to, severity: 'error', message: `Unexpected argument` });
|
|
207
|
+
continue;
|
|
208
|
+
}
|
|
209
|
+
const typesUsed = Array.from(resolveTypes(state, n, config));
|
|
210
|
+
const typesExpected = args[i].type;
|
|
211
|
+
if (typesExpected && !typesExpected.includes(ELScalar.Any) && !typesUsed.some(x => typesExpected.includes(x))) {
|
|
212
|
+
diagnostics.push({ from: n.from, to: n.to, severity: 'error', message: `<code>${typesExpected.join('|')}</code> expected, got <code>${typesUsed.join('|')}</code>` });
|
|
206
213
|
}
|
|
207
|
-
|
|
214
|
+
i++;
|
|
208
215
|
}
|
|
209
216
|
break;
|
|
210
217
|
case 'Property':
|
|
@@ -228,6 +235,13 @@ const expressionLanguageLinterSource = (state) => {
|
|
|
228
235
|
diagnostics.push({ from, to, severity: 'error', message: `Unexpected identifier "${identifier}"` });
|
|
229
236
|
}
|
|
230
237
|
});
|
|
238
|
+
diagnostics.forEach(d => {
|
|
239
|
+
d.renderMessage = () => {
|
|
240
|
+
const span = document.createElement('span');
|
|
241
|
+
span.innerHTML = d.message;
|
|
242
|
+
return span;
|
|
243
|
+
};
|
|
244
|
+
});
|
|
231
245
|
return diagnostics;
|
|
232
246
|
};
|
|
233
247
|
const expressionLanguageLinter = linter(view => expressionLanguageLinterSource(view.state));
|
|
@@ -461,6 +475,11 @@ const baseTheme = EditorView.baseTheme({
|
|
|
461
475
|
opacity: 0.5,
|
|
462
476
|
fontStyle: "inherit !important",
|
|
463
477
|
},
|
|
478
|
+
"code": {
|
|
479
|
+
fontSize: ".8em",
|
|
480
|
+
fontStyle: "monospace",
|
|
481
|
+
backgroundColor: "rgba(127, 127, 127, .3)",
|
|
482
|
+
},
|
|
464
483
|
});
|
|
465
484
|
|
|
466
485
|
const ELLanguage = LRLanguage.define({
|
package/dist/linter.cjs
CHANGED
|
@@ -169,13 +169,20 @@ const expressionLanguageLinterSource = (state) => {
|
|
|
169
169
|
if (!args) {
|
|
170
170
|
return;
|
|
171
171
|
}
|
|
172
|
-
let i = 0;
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
172
|
+
for (let n = node.node.firstChild, i = 0; n != null; n = n.nextSibling) {
|
|
173
|
+
if (n.name === 'BlockComment') {
|
|
174
|
+
continue;
|
|
175
|
+
}
|
|
176
|
+
if (i > args.length - 1) {
|
|
176
177
|
diagnostics.push({ from: n.from, to: n.to, severity: 'error', message: `Unexpected argument` });
|
|
178
|
+
continue;
|
|
179
|
+
}
|
|
180
|
+
const typesUsed = Array.from(resolveTypes(state, n, config));
|
|
181
|
+
const typesExpected = args[i].type;
|
|
182
|
+
if (typesExpected && !typesExpected.includes(ELScalar.Any) && !typesUsed.some(x => typesExpected.includes(x))) {
|
|
183
|
+
diagnostics.push({ from: n.from, to: n.to, severity: 'error', message: `<code>${typesExpected.join('|')}</code> expected, got <code>${typesUsed.join('|')}</code>` });
|
|
177
184
|
}
|
|
178
|
-
|
|
185
|
+
i++;
|
|
179
186
|
}
|
|
180
187
|
break;
|
|
181
188
|
case 'Property':
|
|
@@ -199,6 +206,13 @@ const expressionLanguageLinterSource = (state) => {
|
|
|
199
206
|
diagnostics.push({ from, to, severity: 'error', message: `Unexpected identifier "${identifier}"` });
|
|
200
207
|
}
|
|
201
208
|
});
|
|
209
|
+
diagnostics.forEach(d => {
|
|
210
|
+
d.renderMessage = () => {
|
|
211
|
+
const span = document.createElement('span');
|
|
212
|
+
span.innerHTML = d.message;
|
|
213
|
+
return span;
|
|
214
|
+
};
|
|
215
|
+
});
|
|
202
216
|
return diagnostics;
|
|
203
217
|
};
|
|
204
218
|
const expressionLanguageLinter = lint.linter(view => expressionLanguageLinterSource(view.state));
|
package/dist/linter.js
CHANGED
|
@@ -165,13 +165,20 @@ const expressionLanguageLinterSource = (state) => {
|
|
|
165
165
|
if (!args) {
|
|
166
166
|
return;
|
|
167
167
|
}
|
|
168
|
-
let i = 0;
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
168
|
+
for (let n = node.node.firstChild, i = 0; n != null; n = n.nextSibling) {
|
|
169
|
+
if (n.name === 'BlockComment') {
|
|
170
|
+
continue;
|
|
171
|
+
}
|
|
172
|
+
if (i > args.length - 1) {
|
|
172
173
|
diagnostics.push({ from: n.from, to: n.to, severity: 'error', message: `Unexpected argument` });
|
|
174
|
+
continue;
|
|
175
|
+
}
|
|
176
|
+
const typesUsed = Array.from(resolveTypes(state, n, config));
|
|
177
|
+
const typesExpected = args[i].type;
|
|
178
|
+
if (typesExpected && !typesExpected.includes(ELScalar.Any) && !typesUsed.some(x => typesExpected.includes(x))) {
|
|
179
|
+
diagnostics.push({ from: n.from, to: n.to, severity: 'error', message: `<code>${typesExpected.join('|')}</code> expected, got <code>${typesUsed.join('|')}</code>` });
|
|
173
180
|
}
|
|
174
|
-
|
|
181
|
+
i++;
|
|
175
182
|
}
|
|
176
183
|
break;
|
|
177
184
|
case 'Property':
|
|
@@ -195,6 +202,13 @@ const expressionLanguageLinterSource = (state) => {
|
|
|
195
202
|
diagnostics.push({ from, to, severity: 'error', message: `Unexpected identifier "${identifier}"` });
|
|
196
203
|
}
|
|
197
204
|
});
|
|
205
|
+
diagnostics.forEach(d => {
|
|
206
|
+
d.renderMessage = () => {
|
|
207
|
+
const span = document.createElement('span');
|
|
208
|
+
span.innerHTML = d.message;
|
|
209
|
+
return span;
|
|
210
|
+
};
|
|
211
|
+
});
|
|
198
212
|
return diagnostics;
|
|
199
213
|
};
|
|
200
214
|
const expressionLanguageLinter = linter(view => expressionLanguageLinterSource(view.state));
|
package/package.json
CHANGED