From 0e7a34a8e0031a4d2bc6d27925c32bc4e5bdd459 Mon Sep 17 00:00:00 2001 From: John Millaway Date: Mon, 9 Sep 2002 22:06:36 +0000 Subject: [PATCH] Fixed deserialization of --fast tables. --- TODO | 2 -- flex.skl | 13 +++++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/TODO b/TODO index b6740c9..5cb824e 100644 --- a/TODO +++ b/TODO @@ -52,8 +52,6 @@ * Tables API -** Fix deserialization of --fast tables - ** Handle reject-triggered tables ** Lookup table by name diff --git a/flex.skl b/flex.skl index f11e44c..a75068a 100644 --- a/flex.skl +++ b/flex.skl @@ -2196,8 +2196,16 @@ static int yytbl_data_load YYFARGS2 (struct yytbl_dmap *, dmap, struct yytbl_rea return -1; } - /* Allocate space for table. */ - bytes = td.td_lolen * (td.td_hilen ? td.td_hilen : 1) * dmap->dm_sz; + /* Allocate space for table. + * The --full yy_transition table is a special case, since we + * need the dmap.dm_sz entry to tell us the sizeof the individual + * struct members. + */ + if ((td.td_flags & YYTD_STRUCT)) + bytes = sizeof(struct yy_trans_info) * td.td_lolen * (td.td_hilen ? td.td_hilen : 1); + else + bytes = td.td_lolen * (td.td_hilen ? td.td_hilen : 1) * dmap->dm_sz; + if(YY_TABLES_VERIFY) /* We point to the array itself */ p = dmap->dm_arr; @@ -2284,6 +2292,7 @@ static int yytbl_data_load YYFARGS2 (struct yytbl_dmap *, dmap, struct yytbl_rea /* t32 is an index into the transition array. */ struct yy_trans_info *v; + if (!transdmap){ yy_fatal_error("transition table not found" /*TODO: not fatal.*/ YY_CALL_LAST_ARG); return -1; -- 2.50.1