From 07fb4674904bac673ddbb5d6ce4afbe959c4dcd3 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Sun, 12 Jan 2020 18:15:27 +0100 Subject: Make the lexer and parser re-entrant --- libstorycode/storycode.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'libstorycode/storycode.c') diff --git a/libstorycode/storycode.c b/libstorycode/storycode.c index 983ae02..89c0440 100644 --- a/libstorycode/storycode.c +++ b/libstorycode/storycode.c @@ -46,14 +46,15 @@ Narrative *storycode_parse_presentation(const char *sc) { YY_BUFFER_STATE b; Narrative *n; + yyscan_t scanner; - //BEGIN(0); - b = sc_scan_string(sc); - scdebug = 1; + yylex_init(&scanner); + b = yy_scan_string(sc, scanner); + yydebug = 0; n = narrative_new(); - scparse(n); - sc_delete_buffer(b); - //narrative_debug(n); + yyparse(n, scanner); + yy_delete_buffer(b, scanner); + yylex_destroy(scanner); return n; } -- cgit v1.2.3