@weborigami/language 0.5.2 → 0.5.3
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/package.json +3 -3
- package/src/compiler/origami.pegjs +19 -12
- package/src/compiler/parse.js +575 -445
- package/src/compiler/parserHelpers.js +5 -1
- package/src/runtime/jsGlobals.js +21 -17
- package/src/runtime/ops.js +22 -0
- package/test/compiler/parse.test.js +8 -0
- package/test/runtime/ops.test.js +17 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weborigami/language",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.3",
|
|
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.9.2"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@weborigami/async-tree": "0.5.
|
|
15
|
-
"@weborigami/types": "0.5.
|
|
14
|
+
"@weborigami/async-tree": "0.5.3",
|
|
15
|
+
"@weborigami/types": "0.5.3",
|
|
16
16
|
"watcher": "2.3.1",
|
|
17
17
|
"yaml": "2.8.1"
|
|
18
18
|
},
|
|
@@ -106,7 +106,7 @@ arrayEntry
|
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
arrowFunction
|
|
109
|
-
= "(" __ parameters:parameterList? __ ")" __ doubleArrow __ pipeline:expectPipelineExpression {
|
|
109
|
+
= ("async" __)? "(" __ parameters:parameterList? __ ")" __ doubleArrow __ pipeline:expectPipelineExpression {
|
|
110
110
|
const lambdaParameters = parameters ?? annotate([], location());
|
|
111
111
|
return annotate([ops.lambda, lambdaParameters, pipeline], location());
|
|
112
112
|
}
|
|
@@ -417,21 +417,21 @@ keyChar
|
|
|
417
417
|
= keyCharStart
|
|
418
418
|
// Also allow some math operators (not slash)
|
|
419
419
|
/ "!"
|
|
420
|
-
/ "+"
|
|
421
|
-
/ minus
|
|
422
|
-
/ "*"
|
|
423
420
|
/ "%"
|
|
424
421
|
/ "&"
|
|
425
|
-
/ "
|
|
422
|
+
/ "*"
|
|
423
|
+
/ "+"
|
|
426
424
|
/ "^"
|
|
425
|
+
/ "|"
|
|
426
|
+
/ minus
|
|
427
427
|
|
|
428
428
|
// First character in a key
|
|
429
429
|
keyCharStart
|
|
430
430
|
// All JS identifier characters
|
|
431
431
|
= char:. &{ return char.match(/[$_\p{ID_Continue}]/u) }
|
|
432
432
|
/ "."
|
|
433
|
-
/ "~"
|
|
434
433
|
/ "@"
|
|
434
|
+
/ "~"
|
|
435
435
|
|
|
436
436
|
// A separated list of values
|
|
437
437
|
list "list"
|
|
@@ -839,6 +839,15 @@ unaryExpression
|
|
|
839
839
|
}
|
|
840
840
|
/ callExpression
|
|
841
841
|
|
|
842
|
+
unaryOperator
|
|
843
|
+
= "!"
|
|
844
|
+
/ "+"
|
|
845
|
+
/ @"~" ![\/\)\]\}] // don't match `~/` or end of term
|
|
846
|
+
/ minus
|
|
847
|
+
/ @"await" &whitespaceOrParenthesis
|
|
848
|
+
/ @"typeof" &whitespaceOrParenthesis
|
|
849
|
+
/ @"void" &whitespaceOrParenthesis
|
|
850
|
+
|
|
842
851
|
// URI
|
|
843
852
|
uri
|
|
844
853
|
// Double slashes after colon: `https://example.com/index.html`
|
|
@@ -888,12 +897,6 @@ uriScheme
|
|
|
888
897
|
return annotate([markers.global, text()], location());
|
|
889
898
|
}
|
|
890
899
|
|
|
891
|
-
unaryOperator
|
|
892
|
-
= "!"
|
|
893
|
-
/ "+"
|
|
894
|
-
/ @"~" ![\/\)\]\}] // don't match `~/` or end of term
|
|
895
|
-
/ minus
|
|
896
|
-
|
|
897
900
|
whitespace
|
|
898
901
|
= (whitespaceChar / comment)+
|
|
899
902
|
|
|
@@ -908,5 +911,9 @@ whitespaceOptionalForProgram
|
|
|
908
911
|
= programMode __
|
|
909
912
|
/ shellMode
|
|
910
913
|
|
|
914
|
+
whitespaceOrParenthesis
|
|
915
|
+
= whitespace
|
|
916
|
+
/ "("
|
|
917
|
+
|
|
911
918
|
whitespaceWithNewLine
|
|
912
919
|
= inlineSpace* comment? newLine __
|