diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2021-05-26 23:34:40 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2021-05-26 23:34:40 -0700 |
commit | 77bc5d4cb9e364a56835fa46226e50faa422fe45 (patch) | |
tree | 7778becd69a20acd3c04b819446c25599da02a46 /parser.y | |
parent | 2df469c3cda02c07f17e65cdaae5d9d16dc6b978 (diff) | |
download | txr-77bc5d4cb9e364a56835fa46226e50faa422fe45.tar.gz txr-77bc5d4cb9e364a56835fa46226e50faa422fe45.tar.bz2 txr-77bc5d4cb9e364a56835fa46226e50faa422fe45.zip |
json: extension: allow circle notation.
* parser.l (HASH_N_EQUALS, HASH_N_HASH): Recognize these
tokens in the JSON start state also.
* parser.y (json_val): Add the circular syntax, exactly like
it is done for n_expr and i_expr. And it works!
* lex.yy.c.shipped, y.tab.c.shipped, y.tab.h.shipped: Updated.
Diffstat (limited to 'parser.y')
-rw-r--r-- | parser.y | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -950,6 +950,10 @@ json_val : NUMBER { $$ = $1; } | '[' json_vals ']' { $$ = $2; } | '{' '}' { $$ = make_hash(nil, nil, t); } | '{' json_pairs '}' { $$ = $2; } + | HASH_N_EQUALS { parser_circ_def(parser, $1, unique_s); } + json_val { parser_circ_def(parser, $1, $3); + $$ = $3; } + | HASH_N_HASH { $$ = parser_circ_ref(parser, $1); } | '"' error { $$ = nil; yybadtok(yychar, lit("JSON string")); } | '[' error { $$ = nil; |