diff options
author | Thomas White <taw@bitwiz.me.uk> | 2020-01-12 18:15:27 +0100 |
---|---|---|
committer | Thomas White <taw@bitwiz.me.uk> | 2020-01-12 18:26:37 +0100 |
commit | 07fb4674904bac673ddbb5d6ce4afbe959c4dcd3 (patch) | |
tree | 4f8742bf77387d66b198044ea94ec6c209d729eb /libstorycode/storycode.y | |
parent | d4071cb956c80143d188813d8064333946c38ecf (diff) |
Make the lexer and parser re-entrant
Diffstat (limited to 'libstorycode/storycode.y')
-rw-r--r-- | libstorycode/storycode.y | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/libstorycode/storycode.y b/libstorycode/storycode.y index f3c2653..0e00e36 100644 --- a/libstorycode/storycode.y +++ b/libstorycode/storycode.y @@ -21,8 +21,11 @@ */ %define api.token.prefix {SC_} -%define api.prefix {sc} +%define api.pure full %locations +%lex-param {yscan_t scanner} +%parse-param {Narrative *n}; +%parse-param {yyscan_t scanner}; %code requires { @@ -71,6 +74,8 @@ int max_paras; }; + typedef void *yyscan_t; + } %union { @@ -103,9 +108,8 @@ #include <stdlib.h> #include <string.h> - extern int sclex(); - extern int scparse(); - void scerror(Narrative *n, const char *s); + extern int yylex(); + void yyerror(YYLTYPE *locp, Narrative *n, yyscan_t scanner, const char *s); extern int lineno; %} @@ -173,8 +177,6 @@ %type <val> VALUE %type <grad> gradtype -%parse-param { Narrative *n }; - %{ static void merge_style(struct parse_style *combined, struct parse_style inp) @@ -620,6 +622,6 @@ styledef: %% -void scerror(Narrative *n, const char *s) { +void yyerror(YYLTYPE *locp, Narrative *n, yyscan_t scanner, const char *s) { printf("Storycode parse error at line %i\n", lineno); } |