diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2021-06-08 20:38:37 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2021-06-08 20:38:37 -0700 |
commit | 3783930365c3e91aae780f4f8728f1a029012539 (patch) | |
tree | 7e45be134ae816114c5f41fb38c3f3faa1a79b16 /parser.y | |
parent | f791ed11cf3a801990f26a0ed7c0455c05df59df (diff) | |
download | txr-3783930365c3e91aae780f4f8728f1a029012539.tar.gz txr-3783930365c3e91aae780f4f8728f1a029012539.tar.bz2 txr-3783930365c3e91aae780f4f8728f1a029012539.zip |
parser: new *read-unknown-structs* variable.
* parser.c (read_unknown_structs_s): New symbol variable.
(parser_common_init): Initialize read_unknown_structs flag
member of the parser structure from the new special variable.
(parse_init): Initialize read_unknown_struct_s variable.
Register the *read-unknown-structs* dynamic variable.
* parser.h (struct parser): New member, read_unknown_structs.
(read_unknown_structs_s): Declared.
* parser.y (struct): Generate the struct literal syntax not
only for quasiquoted structures, but for structures with an
unknown type name, if the read_unkonwn_structs flag is set.
* txr.1: Documented.
* share/txr/stdlib/doc-syms.tl: Regenerated.
* y.tab.c.shipped: Regenerated.
Diffstat (limited to 'parser.y')
-rw-r--r-- | parser.y | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -903,9 +903,10 @@ hash : HASH_H list { if (parser->quasi_level > 0 && unquotes_occur( yybadtok(yychar, lit("hash literal")); } ; -struct : HASH_S list { if (parser->quasi_level > 0 && unquotes_occur($2, 0)) - $$ = rl(cons(struct_lit_s, $2), - num($1)); +struct : HASH_S list { if ((parser->quasi_level > 0 && unquotes_occur($2, 0)) || + (parser->read_unknown_structs && + !find_struct_type(first($2)))) + { $$ = rl(cons(struct_lit_s, $2), num($1)); } else { val strct = make_struct_lit(first($2), rest($2)); |