@weborigami/language 0.0.61 → 0.0.63
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/main.js +5 -8
- package/package.json +3 -3
- package/src/compiler/origami.pegjs +17 -33
- package/src/compiler/parse.js +202 -304
- package/src/runtime/HandleExtensionsTransform.js +2 -9
- package/src/runtime/OrigamiFiles.d.ts +2 -2
- package/src/runtime/OrigamiFiles.js +2 -2
- package/src/runtime/evaluate.js +2 -7
- package/src/runtime/expressionObject.js +103 -0
- package/src/runtime/extensions.js +94 -0
- package/src/runtime/internal.js +0 -4
- package/src/runtime/ops.js +12 -34
- package/test/compiler/compile.test.js +2 -2
- package/test/compiler/parse.test.js +38 -46
- package/test/runtime/expressionObject.test.js +66 -0
- package/test/runtime/extensions.test.js +36 -0
- package/test/runtime/ops.test.js +2 -31
- package/src/runtime/ExpressionTree.js +0 -6
- package/src/runtime/OrigamiTransform.d.ts +0 -5
- package/src/runtime/OrigamiTransform.js +0 -3
- package/src/runtime/OrigamiTree.js +0 -4
- package/src/runtime/extname.js +0 -20
- package/src/runtime/handleExtension.js +0 -56
- package/test/runtime/ExpressionTree.test.js +0 -27
- package/test/runtime/HandleExtensionsTransform.test.js +0 -40
package/main.js
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
export * from "./src/runtime/internal.js";
|
|
2
2
|
|
|
3
3
|
export * as compile from "./src/compiler/compile.js";
|
|
4
|
+
export { default as evaluate } from "./src/runtime/evaluate.js";
|
|
4
5
|
export { default as EventTargetMixin } from "./src/runtime/EventTargetMixin.js";
|
|
5
|
-
export
|
|
6
|
+
export * as expressionFunction from "./src/runtime/expressionFunction.js";
|
|
7
|
+
export * from "./src/runtime/extensions.js";
|
|
8
|
+
export { default as formatError } from "./src/runtime/formatError.js";
|
|
9
|
+
export { default as functionResultsMap } from "./src/runtime/functionResultsMap.js";
|
|
6
10
|
export { default as HandleExtensionsTransform } from "./src/runtime/HandleExtensionsTransform.js";
|
|
7
11
|
export { default as ImportModulesMixin } from "./src/runtime/ImportModulesMixin.js";
|
|
8
12
|
export { default as InvokeFunctionsTransform } from "./src/runtime/InvokeFunctionsTransform.js";
|
|
9
13
|
export { default as OrigamiFiles } from "./src/runtime/OrigamiFiles.js";
|
|
10
|
-
export { default as OrigamiTransform } from "./src/runtime/OrigamiTransform.js";
|
|
11
|
-
export { default as OrigamiTree } from "./src/runtime/OrigamiTree.js";
|
|
12
14
|
export { default as TreeEvent } from "./src/runtime/TreeEvent.js";
|
|
13
15
|
export { default as WatchFilesMixin } from "./src/runtime/WatchFilesMixin.js";
|
|
14
|
-
export { default as evaluate } from "./src/runtime/evaluate.js";
|
|
15
|
-
export * as expressionFunction from "./src/runtime/expressionFunction.js";
|
|
16
|
-
export { default as extname } from "./src/runtime/extname.js";
|
|
17
|
-
export { default as formatError } from "./src/runtime/formatError.js";
|
|
18
|
-
export { default as functionResultsMap } from "./src/runtime/functionResultsMap.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weborigami/language",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.63",
|
|
4
4
|
"description": "Web Origami expression language compiler and runtime",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./main.js",
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
"typescript": "5.5.3"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@weborigami/async-tree": "0.0.
|
|
15
|
-
"@weborigami/types": "0.0.
|
|
14
|
+
"@weborigami/async-tree": "0.0.63",
|
|
15
|
+
"@weborigami/types": "0.0.63",
|
|
16
16
|
"watcher": "2.3.1"
|
|
17
17
|
},
|
|
18
18
|
"scripts": {
|
|
@@ -57,16 +57,14 @@ callTarget "function call"
|
|
|
57
57
|
= absoluteFilePath
|
|
58
58
|
/ array
|
|
59
59
|
/ object
|
|
60
|
-
/ tree
|
|
61
60
|
/ lambda
|
|
62
61
|
/ parameterizedLambda
|
|
63
62
|
/ protocolCall
|
|
64
63
|
/ group
|
|
65
64
|
/ scopeReference
|
|
66
65
|
|
|
67
|
-
// Required closing curly brace. We use this for the `
|
|
68
|
-
//
|
|
69
|
-
// sees a left curly brace, here we must see a right curly brace.
|
|
66
|
+
// Required closing curly brace. We use this for the `object` term: if the
|
|
67
|
+
// parser sees a left curly brace, here we must see a right curly brace.
|
|
70
68
|
closingBrace
|
|
71
69
|
= "}"
|
|
72
70
|
/ .? {
|
|
@@ -207,11 +205,8 @@ number "number"
|
|
|
207
205
|
/ integer
|
|
208
206
|
|
|
209
207
|
// An object literal: `{foo: 1, bar: 2}`
|
|
210
|
-
//
|
|
211
|
-
// TODO: Use Object.fromEntries with array of key/value pairs
|
|
212
|
-
//
|
|
213
208
|
object "object literal"
|
|
214
|
-
= "{" __ entries:objectEntries? __
|
|
209
|
+
= "{" __ entries:objectEntries? __ closingBrace {
|
|
215
210
|
return annotate(makeObject(entries ?? [], ops.object), location());
|
|
216
211
|
}
|
|
217
212
|
|
|
@@ -222,11 +217,22 @@ objectEntries
|
|
|
222
217
|
objectEntry
|
|
223
218
|
= spread
|
|
224
219
|
/ objectProperty
|
|
225
|
-
/
|
|
226
|
-
|
|
220
|
+
/ objectGetter
|
|
221
|
+
/ objectIdentifier
|
|
222
|
+
|
|
223
|
+
// A getter definition inside an object literal: `foo = 1`
|
|
224
|
+
objectGetter "object getter"
|
|
225
|
+
= key:identifierOrString __ "=" __ value:expr {
|
|
226
|
+
return annotate([key, [ops.getter, value]], location());
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
// A standalone reference inside an object literal: `foo`
|
|
230
|
+
objectIdentifier "object identifier"
|
|
231
|
+
= key:identifierOrString {
|
|
232
|
+
return annotate([key, [ops.inherited, key]], location());
|
|
227
233
|
}
|
|
228
234
|
|
|
229
|
-
// A
|
|
235
|
+
// A property definition in an object literal: `x: 1`
|
|
230
236
|
objectProperty "object property"
|
|
231
237
|
= @identifierOrString __ ":" __ @expr
|
|
232
238
|
|
|
@@ -322,7 +328,6 @@ step
|
|
|
322
328
|
/ absoluteFilePath
|
|
323
329
|
/ array
|
|
324
330
|
/ object
|
|
325
|
-
/ tree
|
|
326
331
|
/ lambda
|
|
327
332
|
/ parameterizedLambda
|
|
328
333
|
/ templateLiteral
|
|
@@ -385,26 +390,5 @@ templateSubstitution "template substitution"
|
|
|
385
390
|
textChar
|
|
386
391
|
= escapedChar / .
|
|
387
392
|
|
|
388
|
-
// A tree literal: `{ index.html = "Hello" }`
|
|
389
|
-
tree "tree literal"
|
|
390
|
-
= "{" __ entries:treeEntries? __ closingBrace {
|
|
391
|
-
return annotate(makeObject(entries ?? [], ops.tree), location());
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
// A tree assignment statement: `foo = 1`
|
|
395
|
-
treeAssignment "tree assignment"
|
|
396
|
-
= @identifierOrString __ "=" __ @expr
|
|
397
|
-
|
|
398
|
-
// A separated list of assignments or shorthands
|
|
399
|
-
treeEntries
|
|
400
|
-
= @treeEntry|1.., separator| separator?
|
|
401
|
-
|
|
402
|
-
treeEntry
|
|
403
|
-
= spread
|
|
404
|
-
/ treeAssignment
|
|
405
|
-
/ key:identifierOrString {
|
|
406
|
-
return annotate([key, [ops.inherited, key]], location());
|
|
407
|
-
}
|
|
408
|
-
|
|
409
393
|
whitespaceWithNewLine
|
|
410
394
|
= inlineSpace* comment? newLine __
|