summaryrefslogtreecommitdiffstats
path: root/parser.h
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-10-18 05:41:45 -0700
committerKaz Kylheku <kaz@kylheku.com>2016-10-18 05:41:45 -0700
commitf91ef728d1149d7a849d7c818b3fdc03c61847ad (patch)
tree1114df7103b610538a25a00ea603afc72960daf7 /parser.h
parentb25e08a3328ffa4bf29a8a8651973d88ae79b90c (diff)
downloadtxr-f91ef728d1149d7a849d7c818b3fdc03c61847ad.tar.gz
txr-f91ef728d1149d7a849d7c818b3fdc03c61847ad.tar.bz2
txr-f91ef728d1149d7a849d7c818b3fdc03c61847ad.zip
Detect cycles in rlcp_tree.
This will be required when the parser becomes capable of creating object graphs with cycles. * parser.c (parser_callgraph_circ_check): New function. * parser.h (struct circ_stack): New struct. (parser_callgraph_circ_check): Declared. * parser.y (rlcp_tree_rec): New static function. (rlcp_tree): Reduced to wrapper for rlcp_tree_rec.
Diffstat (limited to 'parser.h')
-rw-r--r--parser.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/parser.h b/parser.h
index 31387cda..e7bc8c6d 100644
--- a/parser.h
+++ b/parser.h
@@ -41,6 +41,11 @@ struct yy_token {
YYSTYPE yy_lval;
};
+struct circ_stack {
+ struct circ_stack *up;
+ val obj;
+};
+
struct parser {
val parser;
cnum lineno;
@@ -83,6 +88,9 @@ void open_txr_file(val spec_file, val *txr_lisp_p, val *name, val *stream);
void prime_parser(parser_t *, val name, enum prime_parser);
void prime_parser_post(parser_t *, enum prime_parser);
void prime_scanner(scanner_t *, enum prime_parser);
+#ifdef SPACE
+int parser_callgraph_circ_check(struct circ_stack *rs, val obj);
+#endif
void scrub_scanner(scanner_t *, int yy_char, wchar_t *lexeme);
int parse_once(val stream, val name, parser_t *parser);
int parse(parser_t *parser, val name, enum prime_parser);