diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2023-12-20 07:28:05 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2023-12-20 07:28:05 -0800 |
commit | d5e22852fe180de1feda1d340ad30a15d6b99043 (patch) | |
tree | d4fc37c863f8d8be92984617b8035db8f67cbdbb /txr.1 | |
parent | 8c68a36a88ec6fd056307b2eb13a3e8ab6eb0c42 (diff) | |
download | txr-d5e22852fe180de1feda1d340ad30a15d6b99043.tar.gz txr-d5e22852fe180de1feda1d340ad30a15d6b99043.tar.bz2 txr-d5e22852fe180de1feda1d340ad30a15d6b99043.zip |
json: support Lisp comments.
I've run into situations in which I wanted a comment in a
big JSON quasiliteral to explain some embedded piece of code.
We support only semicolon comments, and no #; ignore notation.
* parser.l (grammar): Recognize Lisp comments in the JSON
state also. That does it.
* tests/010/json.tl: One modest little test.
* txr.1: Documented.
* lex.yy.c.shipped: Regenerated.
Diffstat (limited to 'txr.1')
-rw-r--r-- | txr.1 | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -13074,6 +13074,13 @@ is accepted. \*(TL allows the circle notation to occur within JSON syntax. See the section Notation for Circular and Shared Structure. +\*(TL supports the extension of Lisp comments in JSON. When the +.code ; +character (semicolon) occurs in the middle of JSON syntax, outside +of a token, that character and all characters until the end of the line +constitute a comment that is discarded. \*(TL never produces comments +when printing JSON. + \*(TL allows for JSON syntax to be quasiquoted, and provides two extensions for writing unquotes and splicing unquotes. Within a JSON quasiquote, the .code ~ @@ -13122,6 +13129,12 @@ symbols or structures. These objects have no representation in JSON syntax. (eval ^#J[~*(list 1.0 2.0 3.0), ~(* 2.0 2), 5.0]) --> #(1.0 2.0 3.0 4.0 5.0) + + ;; Comment extension + #J[1, ; Comment inside JSON. + 2, ; Another one. + 3] ; Lisp comment outside of JSON. + --> #(1.0 2.0 3.0) .brev .coNP The @ .. notation |