@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 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 { default as ExpressionTree } from "./src/runtime/ExpressionTree.js";
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.61",
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.61",
15
- "@weborigami/types": "0.0.61",
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 `tree` term: it's the last
68
- // term in the `step` parser that starts with a curly brace, so if that parser
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
- / key:identifierOrString {
226
- return annotate([key, [ops.scope, key]], location());
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 single object property with key and value: `x: 1`
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 __