Skip to content

Commit 03938a2

Browse files
committed
readme, fix $call keyword
1 parent 653a519 commit 03938a2

File tree

3 files changed

+28
-3
lines changed

3 files changed

+28
-3
lines changed

LANGUAGE.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,4 +406,29 @@ Functions can be used as parameters in the executors:
406406
}
407407
```
408408

409-
If the function was previously defined it can be passed either using `"$ref"` with an absolute or relative JSON-pointer or `{ "$func": "myfunc" }. The latter always evaluates as the reference to the existing function rather than the function that always returns string "myfunc".
409+
If the function was previously defined it can be passed either using `"$ref"` with an absolute or relative JSON-pointer or `{ "$func": "myfunc" }. The latter always evaluates as the reference to the existing function rather than the function that always returns string "myfunc", to define the function that always returns the same string you can use "$quote".
410+
411+
412+
## Using any value without evaluation with `$quote`
413+
414+
To insert an object that contains properties that start with `"$"` that normally should only be used in instructions you can use `$quote` instruction: For example, this script:
415+
416+
```json
417+
{
418+
"$quote": {
419+
"$exec": "myExec"
420+
}
421+
}
422+
```
423+
424+
evaluates as: `{ "$exec": "myExec" }`.
425+
426+
`$quote` can also be used to define the function that always returns the same string:
427+
428+
```json
429+
{
430+
"$func": { "$quote": "foo" }
431+
}
432+
```
433+
434+
The anonymous function defined above always returns the string `"foo"`. Without `$quote` it would be the reference to the function with the name `foo`.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jsonscript",
3-
"version": "0.2.3",
3+
"version": "0.3.0",
44
"description": "Platform independent asynchronous and concurrent scripting language using JSON format",
55
"main": "index.js",
66
"scripts": {

schema/evaluate.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@
392392
},
393393
{
394394
"description": "execute instruction using custom keyword",
395-
"call$func": true
395+
"eval$call": true
396396
}
397397
]
398398
}

0 commit comments

Comments
 (0)