summaryrefslogtreecommitdiffstats
path: root/combi.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-05-27 07:13:35 -0700
committerKaz Kylheku <kaz@kylheku.com>2021-05-27 07:13:35 -0700
commit145893075eb1fc99a5c69276ee073fe31ce9bc12 (patch)
tree33355730422cc8d3d3a2a7a47a07f631c87c39d5 /combi.c
parent2f8bbbb5e50b0297bd531da3388589716a8cf0f2 (diff)
downloadtxr-145893075eb1fc99a5c69276ee073fe31ce9bc12.tar.gz
txr-145893075eb1fc99a5c69276ee073fe31ce9bc12.tar.bz2
txr-145893075eb1fc99a5c69276ee073fe31ce9bc12.zip
json: implement distinguished json quasiquote.
Because #J<json> produces the (json ...) form that translates into quote, ^#J<json> yields a quasiquote around a quote. This has some disadvantages, because it requires an explicit eval in some situtions to do what the programmer wants. Here, we introduce an alternative: the syntax #J^<json> will produce a quasiquote instead of a quote. The new translation scheme is #J X -> (json quote <X>) #J^ X -> (json sys:qquote <X>) where <X> denotes the Lisp object translation of JSON syntax X. * parser.c (me_json): The quote symbol is now already in the json form, so all that is left to do here is to take the cdr to pop off the json symbol. * parser.l (JPUNC, NJPUNC): Allow ^ to be a punctuator in JSON mode. * parser.y (json): For regular #J, generate the new (json quote ...) syntax. Implement J# ^ which sets up the nonzero quasi_level around the processing of the JSON syntax, so that everything is in a quasiquote, finally producing the (json sys:qquote ...) syntax. * lex.yy.c.shipped, y.tab.c.shipped: Updated.
Diffstat (limited to 'combi.c')
0 files changed, 0 insertions, 0 deletions