summaryrefslogtreecommitdiffstats
path: root/parser.h
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-09-06 22:50:52 -0700
committerKaz Kylheku <kaz@kylheku.com>2015-09-06 22:50:52 -0700
commitdcc75348c720acd6c2a0587bca34f7851e6c1283 (patch)
tree2eb725ccba3e27da07ad81344113ce2219377ebd /parser.h
parenta17db859170976269eb79ddb0bbcbd5afabd45d7 (diff)
downloadtxr-dcc75348c720acd6c2a0587bca34f7851e6c1283.tar.gz
txr-dcc75348c720acd6c2a0587bca34f7851e6c1283.tar.bz2
txr-dcc75348c720acd6c2a0587bca34f7851e6c1283.zip
Reset flex scanner if exception thrown during read.
We must tear down and rebuild the Flex scanner, otherwise it is left in a bad state causing it to abort. * parser.c (parser_cleanup): After destroying scanner, null out the pointer. (parser_reset): Destroy the Flex scanner, and instantiate a new one in its place. (lisp_parse): Set up an unwind catch which will reset the parser if it was aborted by an exception. * parser.h (parser_reset): Declared.
Diffstat (limited to 'parser.h')
-rw-r--r--parser.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/parser.h b/parser.h
index bc6a3364..efbaa351 100644
--- a/parser.h
+++ b/parser.h
@@ -86,6 +86,7 @@ int parse(parser_t *parser, val name, enum prime_parser);
val source_loc(val form);
val source_loc_str(val form, val alt);
val rlset(val form, val info);
+void parser_reset(parser_t *);
INLINE val rlcp(val to, val from)
{
return rlset(to, source_loc(from));