Skip to content

Commit 7e8cd97

Browse files
authored
Merge pull request #74 from Dr-Emann/push-pwsnvsymkmzx
Fixes for protocol definition
2 parents 4b1018a + 6993e69 commit 7e8cd97

File tree

1 file changed

+31
-3
lines changed

1 file changed

+31
-3
lines changed

protocol.md

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Non-JSON types are encoded using arrays. The first element of the array contains
1212
["date", 1749342170815]
1313
```
1414

15-
To encode a literal array, the array must be "escaped" by wrapping it in a second layer of array:
15+
To encode an array, the array must be wrapped in a second layer of array to create an array expression:
1616

1717
```
1818
[["just", "an", "array"]]
@@ -100,7 +100,35 @@ Expressions are JSON-serializable object trees. All JSON types except arrays are
100100

101101
`[[...]]`
102102

103-
A single-element array containing another array is an escape sequence. The inner array is to be interpreted literally. (Its elements are still individually evaluated.)
103+
An array expression. The inner array contains expressions (one for each array element), which are individually evaluated to produce the final array value.
104+
105+
For example, this expression represents an object containing an array:
106+
107+
```
108+
{
109+
"key": [[
110+
"abc",
111+
["date", 1757214689123],
112+
[[0]]
113+
]]
114+
}
115+
```
116+
117+
This is an expression which will evaluate to an object. The expression representing the value of the "key" field is an array expression.
118+
- The 1st item in the array expression is an expression for the string "abc"
119+
- The 2nd item is an expression for a date object
120+
- The 3rd item is another array expression containing an integer expression representing zero.
121+
122+
This expression will evaluate to the following object:
123+
```
124+
{
125+
"key": [
126+
"abc",
127+
Date(1757214689123),
128+
[0]
129+
]
130+
}
131+
```
104132

105133
`["date", number]`
106134

@@ -121,7 +149,7 @@ If the type is "import", the expression evaluates to a stub. If it is "pipeline"
121149

122150
`propertyPath` is optional. If specified, it is an array of property names (strings or numbers) leading to a specific property of the import's target. The expression evaluates to that property (unless `callArguments` is also specified).
123151

124-
`callArguments` is also optional. If specified, then the given property should be called as a function. `callArguments` is an expression that evaluates to an array; these are the arguments to the call.
152+
`callArguments` is also optional. If specified, then the given property should be called as a function. `callArguments` is an array of expressions; these expressions are evaluated to produce the arguments to the call.
125153

126154
`["remap", importId, propertyPath, captures, instructions]`
127155

0 commit comments

Comments
 (0)