@weborigami/language 0.0.61 → 0.0.62
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 +14 -29
- package/src/compiler/parse.js +201 -297
- 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.62",
|
|
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.62",
|
|
15
|
+
"@weborigami/types": "0.0.62",
|
|
16
16
|
"watcher": "2.3.1"
|
|
17
17
|
},
|
|
18
18
|
"scripts": {
|
|
@@ -57,7 +57,6 @@ callTarget "function call"
|
|
|
57
57
|
= absoluteFilePath
|
|
58
58
|
/ array
|
|
59
59
|
/ object
|
|
60
|
-
/ tree
|
|
61
60
|
/ lambda
|
|
62
61
|
/ parameterizedLambda
|
|
63
62
|
/ protocolCall
|
|
@@ -207,9 +206,6 @@ number "number"
|
|
|
207
206
|
/ integer
|
|
208
207
|
|
|
209
208
|
// An object literal: `{foo: 1, bar: 2}`
|
|
210
|
-
//
|
|
211
|
-
// TODO: Use Object.fromEntries with array of key/value pairs
|
|
212
|
-
//
|
|
213
209
|
object "object literal"
|
|
214
210
|
= "{" __ entries:objectEntries? __ "}" {
|
|
215
211
|
return annotate(makeObject(entries ?? [], ops.object), location());
|
|
@@ -222,11 +218,22 @@ objectEntries
|
|
|
222
218
|
objectEntry
|
|
223
219
|
= spread
|
|
224
220
|
/ objectProperty
|
|
225
|
-
/
|
|
226
|
-
|
|
221
|
+
/ objectGetter
|
|
222
|
+
/ objectIdentifier
|
|
223
|
+
|
|
224
|
+
// A getter definition inside an object literal: `foo = 1`
|
|
225
|
+
objectGetter "object getter"
|
|
226
|
+
= key:identifierOrString __ "=" __ value:expr {
|
|
227
|
+
return annotate([key, [ops.getter, value]], location());
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
// A standalone reference inside an object literal: `foo`
|
|
231
|
+
objectIdentifier "object identifier"
|
|
232
|
+
= key:identifierOrString {
|
|
233
|
+
return annotate([key, [ops.inherited, key]], location());
|
|
227
234
|
}
|
|
228
235
|
|
|
229
|
-
// A
|
|
236
|
+
// A property definition in an object literal: `x: 1`
|
|
230
237
|
objectProperty "object property"
|
|
231
238
|
= @identifierOrString __ ":" __ @expr
|
|
232
239
|
|
|
@@ -322,7 +329,6 @@ step
|
|
|
322
329
|
/ absoluteFilePath
|
|
323
330
|
/ array
|
|
324
331
|
/ object
|
|
325
|
-
/ tree
|
|
326
332
|
/ lambda
|
|
327
333
|
/ parameterizedLambda
|
|
328
334
|
/ templateLiteral
|
|
@@ -385,26 +391,5 @@ templateSubstitution "template substitution"
|
|
|
385
391
|
textChar
|
|
386
392
|
= escapedChar / .
|
|
387
393
|
|
|
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
394
|
whitespaceWithNewLine
|
|
410
395
|
= inlineSpace* comment? newLine __
|