From 2e9e1a61dd1221a80cd80f1acf0ba178610e3256 Mon Sep 17 00:00:00 2001 From: Michael Weber Date: Mon, 29 Nov 2010 10:35:43 +0100 Subject: [PATCH] Make tl_yylex hookable (default is tl_lex) This allows replacing the lexer when using libltl2ba.la. --- lex.c | 11 ++--------- ltl2ba.h | 2 ++ parse.c | 1 - 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/lex.c b/lex.c index 60dd8be..4c5b3df 100644 --- a/lex.c +++ b/lex.c @@ -36,9 +36,10 @@ static Symbol *symtab[Nhash+1]; static int tl_lex(void); +int (*tl_yylex)() = tl_lex; extern YYSTYPE tl_yylval; -char yytext[2048]; +static char yytext[2048]; #define Token(y) tl_yylval = tl_nn(y,ZN,ZN); return y @@ -86,14 +87,6 @@ follow(int tok, int ifyes, int ifno) return ifno; } -int -tl_yylex(void) -{ int c = tl_lex(); -#if 0 - printf("c = %d\n", c); -#endif - return c; -} static int tl_lex(void) diff --git a/ltl2ba.h b/ltl2ba.h index 7b1cd1b..f330149 100644 --- a/ltl2ba.h +++ b/ltl2ba.h @@ -260,6 +260,8 @@ extern int tl_verbose; extern int tl_terse; extern unsigned long All_Mem; +extern int (*tl_yylex)(); /* hook for lexer */ + int ltl2ba_init(); int set_uform(const char *str); void append_uform(const char *str); diff --git a/parse.c b/parse.c index ebcf82c..9d93f8b 100644 --- a/parse.c +++ b/parse.c @@ -32,7 +32,6 @@ #include "ltl2ba.h" -extern int tl_yylex(void); extern int tl_verbose, tl_simp_log; int tl_yychar = 0;