@weborigami/language 0.0.58 → 0.0.60
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 +0 -3
- package/package.json +6 -6
- package/src/compiler/origami.pegjs +20 -4
- package/src/compiler/parse.js +440 -294
- package/src/runtime/ExpressionTree.js +3 -17
- package/src/runtime/HandleExtensionsTransform.js +1 -3
- package/src/runtime/InvokeFunctionsTransform.js +2 -4
- package/src/runtime/OrigamiTransform.d.ts +1 -7
- package/src/runtime/OrigamiTransform.js +2 -12
- package/src/runtime/evaluate.js +27 -12
- package/src/runtime/functionResultsMap.js +2 -4
- package/src/runtime/handleExtension.js +5 -5
- package/src/runtime/mergeTrees.js +1 -16
- package/src/runtime/ops.js +48 -31
- package/test/compiler/compile.test.js +4 -4
- package/test/compiler/parse.test.js +8 -0
- package/test/runtime/HandleExtensionsTransform.test.js +7 -8
- package/test/runtime/evaluate.test.js +19 -9
- package/test/runtime/functionResultsMap.test.js +9 -12
- package/test/runtime/mergeTrees.test.js +0 -22
- package/test/runtime/ops.test.js +7 -6
- package/src/runtime/InheritScopeMixin.d.ts +0 -9
- package/src/runtime/InheritScopeMixin.js +0 -34
- package/src/runtime/Scope.js +0 -96
- package/src/runtime/concatTreeValues.js +0 -59
- package/test/runtime/InheritScopeMixin.test.js +0 -29
- package/test/runtime/Scope.test.js +0 -37
- package/test/runtime/concatTreeValues.test.js +0 -33
package/main.js
CHANGED
|
@@ -5,15 +5,12 @@ export { default as EventTargetMixin } from "./src/runtime/EventTargetMixin.js";
|
|
|
5
5
|
export { default as ExpressionTree } from "./src/runtime/ExpressionTree.js";
|
|
6
6
|
export { default as HandleExtensionsTransform } from "./src/runtime/HandleExtensionsTransform.js";
|
|
7
7
|
export { default as ImportModulesMixin } from "./src/runtime/ImportModulesMixin.js";
|
|
8
|
-
export { default as InheritScopeMixin } from "./src/runtime/InheritScopeMixin.js";
|
|
9
8
|
export { default as InvokeFunctionsTransform } from "./src/runtime/InvokeFunctionsTransform.js";
|
|
10
9
|
export { default as OrigamiFiles } from "./src/runtime/OrigamiFiles.js";
|
|
11
10
|
export { default as OrigamiTransform } from "./src/runtime/OrigamiTransform.js";
|
|
12
11
|
export { default as OrigamiTree } from "./src/runtime/OrigamiTree.js";
|
|
13
|
-
export { default as Scope } from "./src/runtime/Scope.js";
|
|
14
12
|
export { default as TreeEvent } from "./src/runtime/TreeEvent.js";
|
|
15
13
|
export { default as WatchFilesMixin } from "./src/runtime/WatchFilesMixin.js";
|
|
16
|
-
export { default as concatTreeValues } from "./src/runtime/concatTreeValues.js";
|
|
17
14
|
export { default as evaluate } from "./src/runtime/evaluate.js";
|
|
18
15
|
export * as expressionFunction from "./src/runtime/expressionFunction.js";
|
|
19
16
|
export { default as extname } from "./src/runtime/extname.js";
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weborigami/language",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.60",
|
|
4
4
|
"description": "Web Origami expression language compiler and runtime",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./main.js",
|
|
7
7
|
"types": "./index.ts",
|
|
8
8
|
"devDependencies": {
|
|
9
|
-
"@types/node": "20.
|
|
10
|
-
"peggy": "4.0.
|
|
11
|
-
"typescript": "5.
|
|
9
|
+
"@types/node": "20.14.9",
|
|
10
|
+
"peggy": "4.0.3",
|
|
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.60",
|
|
15
|
+
"@weborigami/types": "0.0.60",
|
|
16
16
|
"watcher": "2.3.1"
|
|
17
17
|
},
|
|
18
18
|
"scripts": {
|
|
@@ -138,6 +138,12 @@ functionComposition "function composition"
|
|
|
138
138
|
group "parenthetical group"
|
|
139
139
|
= "(" __ @expr __ closingParen
|
|
140
140
|
|
|
141
|
+
guillemetString "guillemet string"
|
|
142
|
+
= '«' chars:guillemetStringChar* '»' { return chars.join(""); }
|
|
143
|
+
|
|
144
|
+
guillemetStringChar
|
|
145
|
+
= !('»' / newLine) @textChar
|
|
146
|
+
|
|
141
147
|
// A host identifier that may include a colon and port number: `example.com:80`.
|
|
142
148
|
// This is used as a special case at the head of a path, where we want to
|
|
143
149
|
// interpret a colon as part of a text identifier.
|
|
@@ -148,7 +154,7 @@ identifier "identifier"
|
|
|
148
154
|
= chars:identifierChar+ { return chars.join(""); }
|
|
149
155
|
|
|
150
156
|
identifierChar
|
|
151
|
-
= [^(){}\[\]<>\-=,/:\`"'
|
|
157
|
+
= [^(){}\[\]<>\-=,/:\`"'«»\\ →⇒\t\n\r] // No unescaped whitespace or special chars
|
|
152
158
|
/ @'-' !'>' // Accept a hyphen but not in a single arrow combination
|
|
153
159
|
/ escapedChar
|
|
154
160
|
|
|
@@ -160,7 +166,9 @@ identifierOrString
|
|
|
160
166
|
/ string
|
|
161
167
|
|
|
162
168
|
implicitParensArgs "arguments with implicit parentheses"
|
|
163
|
-
|
|
169
|
+
// Implicit parens args are a separate list of `step`, not `expr`, because
|
|
170
|
+
// they can't contain a pipeline.
|
|
171
|
+
= inlineSpace+ @step|1.., separator| separator?
|
|
164
172
|
|
|
165
173
|
inlineSpace
|
|
166
174
|
= [ \t]
|
|
@@ -244,7 +252,14 @@ path "slash-separated path"
|
|
|
244
252
|
|
|
245
253
|
// A single key in a slash-separated path
|
|
246
254
|
pathKey "path element"
|
|
247
|
-
=
|
|
255
|
+
= chars:pathKeyChar* { return chars.join(""); }
|
|
256
|
+
|
|
257
|
+
// A single character in a slash-separated path.
|
|
258
|
+
pathKeyChar
|
|
259
|
+
// This is more permissive than an identifier. It allows some characters like
|
|
260
|
+
// brackets or quotes that are not allowed in identifiers.
|
|
261
|
+
= [^(){}\[\],:/\\ \t\n\r]
|
|
262
|
+
/ escapedChar
|
|
248
263
|
|
|
249
264
|
// Parse a protocol call like `fn://foo/bar`.
|
|
250
265
|
// There can be zero, one, or two slashes after the colon.
|
|
@@ -324,6 +339,7 @@ start
|
|
|
324
339
|
string "string"
|
|
325
340
|
= doubleQuoteString
|
|
326
341
|
/ singleQuoteString
|
|
342
|
+
/ guillemetString
|
|
327
343
|
|
|
328
344
|
// A top-level document defining a template. This is the same as a template
|
|
329
345
|
// literal, but can contain backticks at the top level.
|
|
@@ -364,7 +380,7 @@ templateLiteralText
|
|
|
364
380
|
|
|
365
381
|
// A substitution in a template literal: `${x}`
|
|
366
382
|
templateSubstitution "template substitution"
|
|
367
|
-
= "${" @
|
|
383
|
+
= "${" __ @expr __ "}"
|
|
368
384
|
|
|
369
385
|
textChar
|
|
370
386
|
= escapedChar / .
|