Make tl_yylex hookable (default is tl_lex)
This allows replacing the lexer when using libltl2ba.la.
This commit is contained in:
parent
f277db6c7e
commit
2e9e1a61dd
3 changed files with 4 additions and 10 deletions
11
lex.c
11
lex.c
|
|
@ -36,9 +36,10 @@
|
||||||
|
|
||||||
static Symbol *symtab[Nhash+1];
|
static Symbol *symtab[Nhash+1];
|
||||||
static int tl_lex(void);
|
static int tl_lex(void);
|
||||||
|
int (*tl_yylex)() = tl_lex;
|
||||||
|
|
||||||
extern YYSTYPE tl_yylval;
|
extern YYSTYPE tl_yylval;
|
||||||
char yytext[2048];
|
static char yytext[2048];
|
||||||
|
|
||||||
#define Token(y) tl_yylval = tl_nn(y,ZN,ZN); return y
|
#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;
|
return ifno;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
tl_yylex(void)
|
|
||||||
{ int c = tl_lex();
|
|
||||||
#if 0
|
|
||||||
printf("c = %d\n", c);
|
|
||||||
#endif
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
tl_lex(void)
|
tl_lex(void)
|
||||||
|
|
|
||||||
2
ltl2ba.h
2
ltl2ba.h
|
|
@ -260,6 +260,8 @@ extern int tl_verbose;
|
||||||
extern int tl_terse;
|
extern int tl_terse;
|
||||||
extern unsigned long All_Mem;
|
extern unsigned long All_Mem;
|
||||||
|
|
||||||
|
extern int (*tl_yylex)(); /* hook for lexer */
|
||||||
|
|
||||||
int ltl2ba_init();
|
int ltl2ba_init();
|
||||||
int set_uform(const char *str);
|
int set_uform(const char *str);
|
||||||
void append_uform(const char *str);
|
void append_uform(const char *str);
|
||||||
|
|
|
||||||
1
parse.c
1
parse.c
|
|
@ -32,7 +32,6 @@
|
||||||
|
|
||||||
#include "ltl2ba.h"
|
#include "ltl2ba.h"
|
||||||
|
|
||||||
extern int tl_yylex(void);
|
|
||||||
extern int tl_verbose, tl_simp_log;
|
extern int tl_verbose, tl_simp_log;
|
||||||
|
|
||||||
int tl_yychar = 0;
|
int tl_yychar = 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue