mirror of
https://github.com/westes/flex.git
synced 2026-01-26 15:39:06 +00:00
Eliminate the c_like backend member.
No need for it, since the skel content is in core and the relevant hook can be searched for. This is a postscript to the retargeting series. It's not necessary, but it imoroves the code slightly.
This commit is contained in:
parent
8da857acc6
commit
700f9d3b6a
@ -56,5 +56,4 @@ const char *cpp_skel[] = {
|
||||
struct flex_backend_t cpp_backend = {
|
||||
.suffix = cpp_suffix,
|
||||
.skel = cpp_skel,
|
||||
.c_like = true,
|
||||
};
|
||||
|
||||
@ -306,7 +306,6 @@
|
||||
struct flex_backend_t {
|
||||
const char *(*suffix)(void); // Generate suffix for lexer source code
|
||||
const char **skel;
|
||||
bool c_like; // Will &yy_transition[%d]," produce a pointer table entry?
|
||||
};
|
||||
|
||||
extern size_t footprint;
|
||||
@ -863,6 +862,9 @@ extern void dataend(const char *);
|
||||
/* Flush generated data statements. */
|
||||
extern void dataflush(void);
|
||||
|
||||
/* Do we have a state-entry0format macro? */
|
||||
extern bool boneseeker(const char *);
|
||||
|
||||
/* Report an error message and terminate. */
|
||||
extern void flexerror(const char *);
|
||||
|
||||
|
||||
@ -1021,7 +1021,7 @@ void make_tables (void)
|
||||
yytbl_data_init (yynultrans_tbl, YYTD_ID_NUL_TRANS);
|
||||
// Performance kludge for C. Gives a small improvement
|
||||
// in table loading time.
|
||||
if (ctrl.fullspd && backend->c_like)
|
||||
if (ctrl.fullspd && boneseeker("m4_define([[M4_HOOK_STATE_ENTRY_FORMAT]]"))
|
||||
yynultrans_tbl->td_flags |= YYTD_PTRANS;
|
||||
yynultrans_tbl->td_lolen = (flex_uint32_t) (lastdfa + 1);
|
||||
yynultrans_tbl->td_data = yynultrans_data =
|
||||
|
||||
17
src/misc.c
17
src/misc.c
@ -879,3 +879,20 @@ void comment(const char *txt)
|
||||
outc ('\n');
|
||||
}
|
||||
|
||||
/* Search for a string in the skeleton prolog, where macros are defined.
|
||||
*/
|
||||
bool boneseeker(const char *bone)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < sizeof(backend->skel)/sizeof(backend->skel[0]); i++) {
|
||||
const char *line = backend->skel[i];
|
||||
if (strstr(line, bone) != NULL)
|
||||
return true;
|
||||
else if (strncmp(line, "%%", 2) == 0)
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user