summaryrefslogtreecommitdiffstats
path: root/y.tab.h.shipped
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-05-27 06:51:23 -0700
committerKaz Kylheku <kaz@kylheku.com>2021-05-27 06:51:23 -0700
commit2f8bbbb5e50b0297bd531da3388589716a8cf0f2 (patch)
tree13161ca135e5cdcfa37a5d50004251c0dc4e00bd /y.tab.h.shipped
parent77bc5d4cb9e364a56835fa46226e50faa422fe45 (diff)
downloadtxr-2f8bbbb5e50b0297bd531da3388589716a8cf0f2.tar.gz
txr-2f8bbbb5e50b0297bd531da3388589716a8cf0f2.tar.bz2
txr-2f8bbbb5e50b0297bd531da3388589716a8cf0f2.zip
json: support quasiquoting.
* parser.h (end_of_json_unquote): Declared. * parser.l (JPUNC, NJPUNC): Add ~ and * characters to set of JSON punctuators. (grammar): Allow closing brace character in NESTED, SPECIAL and QSPECIAL statues to be a token. This is because it occurs as a lookahead character in this situation #J{"foo":~expr}. The lexer switches from the JSON to the NESTED start state when it scans the ~ token, so that expr is treated as Lisp. But then } is consumed as a lookahead token by the parser in that same mode; when we pop back to JSON mode, the } token has already been scanned in NESTED mode. We add two new rules in JSON mode to the lexer to recognize the ~ unquote and ~* splicing unquote. Both have to push the NESTED start condition. (end_of_json_unquote): New function. * parser.y (JSPLICE): New token. (json_val): Logic for unquoting. The array and hash rules must now be prepared to deal with json_vals and json_pairs now producing a list object instead of a hash or vector. That is the signal that the data contains active quasiquotes and must be translated to the special literal syntax for quasiquoted vectors and hashes. Here we also add the rules for ~ and ~* unquoting syntax, including managing the lexer's transition back to the JSON start condition. (json_vals, json_pairs): We add the logic here to recognize unquotes in quasiquoting state. This is more clever than the way it is done in the Lisp areas of the grammar. If no quasiquotes occur, we construct a vector or hash, respectively, and add to it. If unquotes occur and if we are nested in a quasiquote, we switch the object to a list, and continue it that way. (yybadtoken): Handle JSPLICE. * lex.yy.c.shipped, y.tab.c.shipped, y.tab.h.shipped: Updated.
Diffstat (limited to 'y.tab.h.shipped')
-rw-r--r--y.tab.h.shipped40
1 files changed, 21 insertions, 19 deletions
diff --git a/y.tab.h.shipped b/y.tab.h.shipped
index fb0e5a09..92787410 100644
--- a/y.tab.h.shipped
+++ b/y.tab.h.shipped
@@ -68,15 +68,16 @@
REGTOKEN = 315,
LITCHAR = 316,
SPLICE = 317,
- OLD_AT = 318,
- CONSDOT = 319,
- LAMBDOT = 320,
- UREFDOT = 321,
- OREFDOT = 322,
- UOREFDOT = 323,
- LOW = 324,
- ELSE = 325,
- ELIF = 326
+ JSPLICE = 318,
+ OLD_AT = 319,
+ CONSDOT = 320,
+ LAMBDOT = 321,
+ UREFDOT = 322,
+ OREFDOT = 323,
+ UOREFDOT = 324,
+ LOW = 325,
+ ELSE = 326,
+ ELIF = 327
};
#endif
/* Tokens. */
@@ -140,15 +141,16 @@
#define REGTOKEN 315
#define LITCHAR 316
#define SPLICE 317
-#define OLD_AT 318
-#define CONSDOT 319
-#define LAMBDOT 320
-#define UREFDOT 321
-#define OREFDOT 322
-#define UOREFDOT 323
-#define LOW 324
-#define ELSE 325
-#define ELIF 326
+#define JSPLICE 318
+#define OLD_AT 319
+#define CONSDOT 320
+#define LAMBDOT 321
+#define UREFDOT 322
+#define OREFDOT 323
+#define UOREFDOT 324
+#define LOW 325
+#define ELSE 326
+#define ELIF 327
@@ -168,7 +170,7 @@ typedef union YYSTYPE
/* Line 2068 of yacc.c */
-#line 201 "y.tab.h"
+#line 203 "y.tab.h"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */