summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Millaway <john43@users.sourceforge.net>2002-09-13 21:54:02 +0000
committerJohn Millaway <john43@users.sourceforge.net>2002-09-13 21:54:02 +0000
commit1c8a5f9d3f46fc35292723e0e600a0eb98e206b5 (patch)
tree81728aa8156adee049c7e2d3c60c7512d34caf90
parent1f0b3a5efb035501bad92519d46f4015ab540dfd (diff)
Created test for reject.
Handled reject-triggered tables in serialization.
-rw-r--r--TODO6
-rw-r--r--configure.in1
-rw-r--r--devel/tables.pl23
-rw-r--r--dfa.c4
-rw-r--r--flex.skl5
-rw-r--r--flex.texi2
-rw-r--r--gen.c80
-rw-r--r--tables.c6
-rw-r--r--tables_shared.c2
-rw-r--r--tables_shared.h25
-rw-r--r--tests/Makefile.am1
-rw-r--r--tests/test-reject/.cvsignore9
-rw-r--r--tests/test-reject/Makefile.am72
-rw-r--r--tests/test-reject/scanner.l77
-rw-r--r--tests/test-reject/test.input2
-rw-r--r--tests/test-table-opts/Makefile.am3
16 files changed, 249 insertions, 69 deletions
diff --git a/TODO b/TODO
index 606da48..4e3d8ca 100644
--- a/TODO
+++ b/TODO
@@ -52,16 +52,10 @@
* Tables API
-** Handle reject-triggered tables
-
-** Lookup table by name
-
** create user API for tables deserialization
** document API and --tables-* options
-** create test for multiple tables
-
** verify that new macros/functions work with %option header-file
* build system
diff --git a/configure.in b/configure.in
index 54945c7..3eaae25 100644
--- a/configure.in
+++ b/configure.in
@@ -98,6 +98,7 @@ tests/test-posixly-correct/Makefile
tests/test-table-opts/Makefile
tests/test-c++-basic/Makefile
tests/test-bison-nr/Makefile
+tests/test-reject/Makefile
dnl --new-test-here-- This line is processed by tests/create-test.
)
diff --git a/devel/tables.pl b/devel/tables.pl
index af5427f..6e7d507 100644
--- a/devel/tables.pl
+++ b/devel/tables.pl
@@ -124,17 +124,18 @@ sub pad64{ return ((8-((shift)%8))%8) }
BEGIN {
%::TID = (
- 0x01 => 'YYTH_ID_ACCEPT' ,
- 0x02 => 'YYTH_ID_BASE' ,
- 0x03 => 'YYTH_ID_CHK' ,
- 0x04 => 'YYTH_ID_DEF' ,
- 0x05 => 'YYTH_ID_EC' ,
- 0x06 => 'YYTH_ID_META' ,
- 0x07 => 'YYTH_ID_NUL_TRANS' ,
- 0x08 => 'YYTH_ID_NXT' ,
- 0x09 => 'YYTH_ID_RULE_CAN_MATCH_EOL' ,
- 0x0A => 'YYTH_ID_START_STATE_LIST' ,
- 0x0B => 'YYTH_ID_TRANSITION');
+ 0x01 => 'YYTD_ID_ACCEPT' ,
+ 0x02 => 'YYTD_ID_BASE' ,
+ 0x03 => 'YYTD_ID_CHK' ,
+ 0x04 => 'YYTD_ID_DEF' ,
+ 0x05 => 'YYTD_ID_EC' ,
+ 0x06 => 'YYTD_ID_META' ,
+ 0x07 => 'YYTD_ID_NUL_TRANS' ,
+ 0x08 => 'YYTD_ID_NXT' ,
+ 0x09 => 'YYTD_ID_RULE_CAN_MATCH_EOL' ,
+ 0x0A => 'YYTD_ID_START_STATE_LIST' ,
+ 0x0B => 'YYTD_ID_TRANSITION',
+ 0x0C => 'YYTD_ID_ACCLIST');
%::TFLAGS = (
0x01 => ['YYTD_DATA8',\&read8] ,
diff --git a/dfa.c b/dfa.c
index 16548a7..238905c 100644
--- a/dfa.c
+++ b/dfa.c
@@ -525,7 +525,7 @@ void ntod ()
(struct yytbl_data *) calloc (1,
sizeof (struct
yytbl_data));
- yytbl_data_init (yynxt_tbl, YYT_ID_NXT);
+ yytbl_data_init (yynxt_tbl, YYTD_ID_NXT);
yynxt_tbl->td_hilen = 1;
yynxt_tbl->td_lolen = num_full_table_rows;
yynxt_tbl->td_data = yynxt_data =
@@ -535,7 +535,7 @@ void ntod ()
yynxt_curr = 0;
buf_prints (&yydmap_buf,
- "\t{YYT_ID_NXT, (void**)&yy_nxt, sizeof(%s)},\n",
+ "\t{YYTD_ID_NXT, (void**)&yy_nxt, sizeof(%s)},\n",
long_align ? "int32_t" : "int16_t");
/* Unless -Ca, declare it "short" because it's a real
diff --git a/flex.skl b/flex.skl
index 8a26f2c..4c31008 100644
--- a/flex.skl
+++ b/flex.skl
@@ -30,6 +30,7 @@
%c-only
/* begin standard C headers. */
#include <stdio.h>
+#include <string.h>
#include <errno.h>
#include <stdlib.h>
#include <stdint.h>
@@ -1823,9 +1824,7 @@ YY_EXTRA_TYPE yyget_extra YYFARGS0(void)
#ifndef YY_NO_GET_LINENO
int yyget_lineno YYFARGS0(void)
{
-#ifdef YY_USE_LINENO
return yylineno;
-#endif
}
#endif /* !YY_NO_GET_LINENO */
@@ -2207,7 +2206,7 @@ static int yytbl_data_load YYFARGS2 (struct yytbl_dmap *, dmap, struct yytbl_rea
* inside the loop below. This scanner might not even have a transition
* table, which is ok.
*/
- transdmap = yytbl_dmap_lookup (dmap, YYT_ID_TRANSITION YY_CALL_LAST_ARG);
+ transdmap = yytbl_dmap_lookup (dmap, YYTD_ID_TRANSITION YY_CALL_LAST_ARG);
if ((dmap = yytbl_dmap_lookup (dmap, td.td_id YY_CALL_LAST_ARG)) == NULL){
yy_fatal_error("table id not found in map." /*TODO: not fatal.*/ YY_CALL_LAST_ARG);
diff --git a/flex.texi b/flex.texi
index d183347..b65330e 100644
--- a/flex.texi
+++ b/flex.texi
@@ -4669,6 +4669,8 @@ array of pointers to structs. See the @code{td_flags} field below.
@item YYT_ID_TRANSITION (0x0B)
@code{yy_transition}. This array is handled specially because it is an array of
structs. See the @code{td_lolen} field below.
+@item YYT_ID_ACCLIST (0x0C)
+@code{yy_acclist}
@end table
@item td_flags
diff --git a/gen.c b/gen.c
index 2a634a1..76ead8c 100644
--- a/gen.c
+++ b/gen.c
@@ -105,7 +105,7 @@ static struct yytbl_data *mkeoltbl (void)
struct yytbl_data *tbl;
tbl = (struct yytbl_data *) calloc (1, sizeof (struct yytbl_data));
- yytbl_data_init (tbl, YYT_ID_RULE_CAN_MATCH_EOL);
+ yytbl_data_init (tbl, YYTD_ID_RULE_CAN_MATCH_EOL);
tbl->td_flags = YYTD_DATA8;
tbl->td_lolen = num_rules + 1;
tbl->td_data = tdata =
@@ -115,7 +115,7 @@ static struct yytbl_data *mkeoltbl (void)
tdata[i] = rule_has_nl[i] ? 1 : 0;
buf_prints (&yydmap_buf,
- "\t{YYT_ID_RULE_CAN_MATCH_EOL, (void**)&yy_rule_can_match_eol, sizeof(%s)},\n",
+ "\t{YYTD_ID_RULE_CAN_MATCH_EOL, (void**)&yy_rule_can_match_eol, sizeof(%s)},\n",
"int32_t");
return tbl;
}
@@ -207,12 +207,12 @@ static struct yytbl_data *mkctbl (void)
int end_of_buffer_action = num_rules + 1;
buf_prints (&yydmap_buf,
- "\t{YYT_ID_TRANSITION, (void**)&yy_transition, sizeof(%s)},\n",
+ "\t{YYTD_ID_TRANSITION, (void**)&yy_transition, sizeof(%s)},\n",
((tblend + numecs + 1) >= INT16_MAX
|| long_align) ? "int32_t" : "int16_t");
tbl = (struct yytbl_data *) calloc (1, sizeof (struct yytbl_data));
- yytbl_data_init (tbl, YYT_ID_TRANSITION);
+ yytbl_data_init (tbl, YYTD_ID_TRANSITION);
tbl->td_flags = YYTD_DATA32 | YYTD_STRUCT;
tbl->td_hilen = 0;
tbl->td_lolen = tblend + numecs + 1; /* number of structs */
@@ -308,7 +308,7 @@ static struct yytbl_data *mkssltbl (void)
int32_t i;
tbl = (struct yytbl_data *) calloc (1, sizeof (struct yytbl_data));
- yytbl_data_init (tbl, YYT_ID_START_STATE_LIST);
+ yytbl_data_init (tbl, YYTD_ID_START_STATE_LIST);
tbl->td_flags = YYTD_DATA32 | YYTD_PTRANS;
tbl->td_hilen = 0;
tbl->td_lolen = lastsc * 2 + 1;
@@ -320,7 +320,7 @@ static struct yytbl_data *mkssltbl (void)
tdata[i] = base[i];
buf_prints (&yydmap_buf,
- "\t{YYT_ID_START_STATE_LIST, (void**)&yy_start_state_list, sizeof(%s)},\n",
+ "\t{YYTD_ID_START_STATE_LIST, (void**)&yy_start_state_list, sizeof(%s)},\n",
"struct yy_trans_info*");
return tbl;
@@ -438,7 +438,7 @@ struct yytbl_data *mkecstbl (void)
int32_t *tdata = 0;
tbl = (struct yytbl_data *) calloc (1, sizeof (struct yytbl_data));
- yytbl_data_init (tbl, YYT_ID_EC);
+ yytbl_data_init (tbl, YYTD_ID_EC);
tbl->td_flags |= YYTD_DATA32;
tbl->td_hilen = 0;
tbl->td_lolen = csize;
@@ -455,7 +455,7 @@ struct yytbl_data *mkecstbl (void)
}
buf_prints (&yydmap_buf,
- "\t{YYT_ID_EC, (void**)&yy_ec, sizeof(%s)},\n",
+ "\t{YYTD_ID_EC, (void**)&yy_ec, sizeof(%s)},\n",
"int32_t");
return tbl;
@@ -649,7 +649,7 @@ struct yytbl_data *mkftbl (void)
int32_t *tdata = 0;
tbl = (struct yytbl_data *) calloc (1, sizeof (struct yytbl_data));
- yytbl_data_init (tbl, YYT_ID_ACCEPT);
+ yytbl_data_init (tbl, YYTD_ID_ACCEPT);
tbl->td_flags |= YYTD_DATA32;
tbl->td_hilen = 0; /* it's a one-dimensional array */
tbl->td_lolen = lastdfa + 1;
@@ -670,7 +670,7 @@ struct yytbl_data *mkftbl (void)
}
buf_prints (&yydmap_buf,
- "\t{YYT_ID_ACCEPT, (void**)&yy_accept, sizeof(%s)},\n",
+ "\t{YYTD_ID_ACCEPT, (void**)&yy_accept, sizeof(%s)},\n",
long_align ? "int32_t" : "int16_t");
return tbl;
}
@@ -1056,10 +1056,10 @@ void gentabs ()
int i, j, k, *accset, nacc, *acc_array, total_states;
int end_of_buffer_action = num_rules + 1;
struct yytbl_data *yyacc_tbl = 0, *yymeta_tbl = 0, *yybase_tbl = 0,
- *yydef_tbl = 0, *yynxt_tbl = 0, *yychk_tbl = 0;
+ *yydef_tbl = 0, *yynxt_tbl = 0, *yychk_tbl = 0, *yyacclist_tbl=0;
int32_t *yyacc_data = 0, *yybase_data = 0, *yydef_data = 0,
- *yynxt_data = 0, *yychk_data = 0;
- int32_t yybase_curr = 0;
+ *yynxt_data = 0, *yychk_data = 0, *yyacclist_data=0;
+ int32_t yybase_curr = 0, yyacclist_curr=0,yyacc_curr=0;
acc_array = allocate_integer_array (current_max_dfas);
nummt = 0;
@@ -1090,6 +1090,17 @@ void gentabs ()
out_str_dec (long_align ? get_int32_decl () :
get_int16_decl (), "yy_acclist", MAX (numas,
1) + 1);
+
+ buf_prints (&yydmap_buf,
+ "\t{YYTD_ID_ACCLIST, (void**)&yy_acclist, sizeof(%s)},\n",
+ long_align ? "int32_t" : "int16_t");
+
+ yyacclist_tbl = (struct yytbl_data*)calloc(1,sizeof(struct yytbl_data));
+ yytbl_data_init (yyacclist_tbl, YYTD_ID_ACCLIST);
+ yyacclist_tbl->td_lolen = MAX(numas,1) + 1;
+ yyacclist_tbl->td_data = yyacclist_data =
+ (int32_t *) calloc (yyacclist_tbl->td_lolen, sizeof (int32_t));
+ yyacclist_curr = 1;
j = 1; /* index into "yy_acclist" array */
@@ -1125,6 +1136,7 @@ void gentabs ()
}
mkdata (accnum);
+ yyacclist_data[yyacclist_curr++] = accnum;
if (trace) {
fprintf (stderr, "[%d]",
@@ -1145,6 +1157,13 @@ void gentabs ()
acc_array[i] = j;
dataend ();
+ if (tablesext) {
+ yytbl_data_compress (yyacclist_tbl);
+ if (yytbl_data_fwrite (&tableswr, yyacclist_tbl) < 0)
+ flexerror (_("Could not write yyacclist_tbl"));
+ yytbl_data_destroy (yyacclist_tbl);
+ yyacclist_tbl = NULL;
+ }
}
else {
@@ -1182,20 +1201,21 @@ void gentabs ()
"yy_accept", k);
buf_prints (&yydmap_buf,
- "\t{YYT_ID_ACCEPT, (void**)&yy_accept, sizeof(%s)},\n",
+ "\t{YYTD_ID_ACCEPT, (void**)&yy_accept, sizeof(%s)},\n",
long_align ? "int32_t" : "int16_t");
yyacc_tbl =
(struct yytbl_data *) calloc (1,
sizeof (struct yytbl_data));
- yytbl_data_init (yyacc_tbl, YYT_ID_ACCEPT);
+ yytbl_data_init (yyacc_tbl, YYTD_ID_ACCEPT);
yyacc_tbl->td_lolen = k;
yyacc_tbl->td_data = yyacc_data =
(int32_t *) calloc (yyacc_tbl->td_lolen, sizeof (int32_t));
+ yyacc_curr=1;
for (i = 1; i <= lastdfa; ++i) {
mkdata (acc_array[i]);
- yyacc_data[i] = acc_array[i];
+ yyacc_data[yyacc_curr++] = acc_array[i];
if (!reject && trace && acc_array[i])
fprintf (stderr, _("state # %d accepts: [%d]\n"),
@@ -1204,12 +1224,12 @@ void gentabs ()
/* Add entry for "jam" state. */
mkdata (acc_array[i]);
- yyacc_data[i] = acc_array[i];
+ yyacc_data[yyacc_curr++] = acc_array[i];
if (reject) {
/* Add "cap" for the list. */
mkdata (acc_array[i]);
- yyacc_data[i] = acc_array[i];
+ yyacc_data[yyacc_curr++] = acc_array[i];
}
dataend ();
@@ -1247,7 +1267,7 @@ void gentabs ()
(struct yytbl_data *) calloc (1,
sizeof (struct
yytbl_data));
- yytbl_data_init (yymeta_tbl, YYT_ID_META);
+ yytbl_data_init (yymeta_tbl, YYTD_ID_META);
yymeta_tbl->td_lolen = numecs + 1;
yymeta_tbl->td_data = yymecs_data =
(int32_t *) calloc (yymeta_tbl->td_lolen,
@@ -1259,7 +1279,7 @@ void gentabs ()
out_str_dec (get_int32_decl (), "yy_meta", numecs + 1);
buf_prints (&yydmap_buf,
- "\t{YYT_ID_META, (void**)&yy_meta, sizeof(%s)},\n",
+ "\t{YYTD_ID_META, (void**)&yy_meta, sizeof(%s)},\n",
"int32_t");
for (i = 1; i <= numecs; ++i) {
@@ -1291,13 +1311,13 @@ void gentabs ()
"yy_base", total_states + 1);
buf_prints (&yydmap_buf,
- "\t{YYT_ID_BASE, (void**)&yy_base, sizeof(%s)},\n",
+ "\t{YYTD_ID_BASE, (void**)&yy_base, sizeof(%s)},\n",
(tblend >= INT16_MAX
|| long_align) ? "int32_t" : "int16_t");
yybase_tbl =
(struct yytbl_data *) calloc (1,
sizeof (struct yytbl_data));
- yytbl_data_init (yybase_tbl, YYT_ID_BASE);
+ yytbl_data_init (yybase_tbl, YYTD_ID_BASE);
yybase_tbl->td_lolen = total_states + 1;
yybase_tbl->td_data = yybase_data =
(int32_t *) calloc (yybase_tbl->td_lolen,
@@ -1350,14 +1370,14 @@ void gentabs ()
"yy_def", total_states + 1);
buf_prints (&yydmap_buf,
- "\t{YYT_ID_DEF, (void**)&yy_def, sizeof(%s)},\n",
+ "\t{YYTD_ID_DEF, (void**)&yy_def, sizeof(%s)},\n",
(total_states >= INT16_MAX
|| long_align) ? "int32_t" : "int16_t");
yydef_tbl =
(struct yytbl_data *) calloc (1,
sizeof (struct yytbl_data));
- yytbl_data_init (yydef_tbl, YYT_ID_DEF);
+ yytbl_data_init (yydef_tbl, YYTD_ID_DEF);
yydef_tbl->td_lolen = total_states + 1;
yydef_tbl->td_data = yydef_data =
(int32_t *) calloc (yydef_tbl->td_lolen, sizeof (int32_t));
@@ -1384,14 +1404,14 @@ void gentabs ()
tblend + 1);
buf_prints (&yydmap_buf,
- "\t{YYT_ID_NXT, (void**)&yy_nxt, sizeof(%s)},\n",
+ "\t{YYTD_ID_NXT, (void**)&yy_nxt, sizeof(%s)},\n",
(total_states >= INT16_MAX
|| long_align) ? "int32_t" : "int16_t");
yynxt_tbl =
(struct yytbl_data *) calloc (1,
sizeof (struct yytbl_data));
- yytbl_data_init (yynxt_tbl, YYT_ID_NXT);
+ yytbl_data_init (yynxt_tbl, YYTD_ID_NXT);
yynxt_tbl->td_lolen = tblend + 1;
yynxt_tbl->td_data = yynxt_data =
(int32_t *) calloc (yynxt_tbl->td_lolen, sizeof (int32_t));
@@ -1423,14 +1443,14 @@ void gentabs ()
tblend + 1);
buf_prints (&yydmap_buf,
- "\t{YYT_ID_CHK, (void**)&yy_chk, sizeof(%s)},\n",
+ "\t{YYTD_ID_CHK, (void**)&yy_chk, sizeof(%s)},\n",
(total_states >= INT16_MAX
|| long_align) ? "int32_t" : "int16_t");
yychk_tbl =
(struct yytbl_data *) calloc (1,
sizeof (struct yytbl_data));
- yytbl_data_init (yychk_tbl, YYT_ID_CHK);
+ yytbl_data_init (yychk_tbl, YYTD_ID_CHK);
yychk_tbl->td_lolen = tblend + 1;
yychk_tbl->td_data = yychk_data =
(int32_t *) calloc (yychk_tbl->td_lolen, sizeof (int32_t));
@@ -1684,7 +1704,7 @@ void make_tables ()
out_str_dec (get_state_decl (), "yy_NUL_trans",
lastdfa + 1);
buf_prints (&yydmap_buf,
- "\t{YYT_ID_NUL_TRANS, (void**)&yy_NUL_trans, sizeof(%s)},\n",
+ "\t{YYTD_ID_NUL_TRANS, (void**)&yy_NUL_trans, sizeof(%s)},\n",
(fullspd) ? "struct yy_trans_info*" :
"int32_t");
@@ -1692,7 +1712,7 @@ void make_tables ()
(struct yytbl_data *) calloc (1,
sizeof (struct
yytbl_data));
- yytbl_data_init (yynultrans_tbl, YYT_ID_NUL_TRANS);
+ yytbl_data_init (yynultrans_tbl, YYTD_ID_NUL_TRANS);
if (fullspd)
yynultrans_tbl->td_flags |= YYTD_PTRANS;
yynultrans_tbl->td_lolen = lastdfa + 1;
diff --git a/tables.c b/tables.c
index ab6c84d..d7dc961 100644
--- a/tables.c
+++ b/tables.c
@@ -332,7 +332,7 @@ int yytbl_write8 (struct yytbl_writer *wr, uint8_t v)
* @param tbl data table
* @param i index into higher dimension array. i should be zero for one-dimensional arrays.
* @param j index into lower dimension array.
- * @param k index into struct, must be 0 or 1. Only valid for YYT_ID_TRANSITION table
+ * @param k index into struct, must be 0 or 1. Only valid for YYTD_ID_TRANSITION table
* @return data[i][j + k]
*/
int32_t yytbl_data_getijk (const struct yytbl_data * tbl, int i, int j,
@@ -364,7 +364,7 @@ int32_t yytbl_data_getijk (const struct yytbl_data * tbl, int i, int j,
}
/** Extract data element [i] from array data tables treated as a single flat array of integers.
- * Be careful for 2-dimensional arrays or for YYT_ID_TRANSITION, which is an array
+ * Be careful for 2-dimensional arrays or for YYTD_ID_TRANSITION, which is an array
* of structs.
* @param tbl data table
* @param i index into array.
@@ -388,7 +388,7 @@ static int32_t yytbl_data_geti (const struct yytbl_data *tbl, int i)
}
/** Set data element [i] in array data tables treated as a single flat array of integers.
- * Be careful for 2-dimensional arrays or for YYT_ID_TRANSITION, which is an array
+ * Be careful for 2-dimensional arrays or for YYTD_ID_TRANSITION, which is an array
* of structs.
* @param tbl data table
* @param i index into array.
diff --git a/tables_shared.c b/tables_shared.c
index 5fbf886..dcfc03b 100644
--- a/tables_shared.c
+++ b/tables_shared.c
@@ -64,7 +64,7 @@ yyskel_static int32_t yytbl_calc_total_len (const struct yytbl_data *tbl)
if (tbl->td_hilen > 0)
n *= tbl->td_hilen;
- if (tbl->td_id == YYT_ID_TRANSITION)
+ if (tbl->td_id == YYTD_ID_TRANSITION)
n *= 2;
return n;
}
diff --git a/tables_shared.h b/tables_shared.h
index d2afff0..f52ee23 100644
--- a/tables_shared.h
+++ b/tables_shared.h
@@ -69,21 +69,22 @@ dnl flex code (hence the name "_shared").
#endif
-/** Possible values for t_id field. Each one corresponds to a
+/** Possible values for td_id field. Each one corresponds to a
* scanner table of the same name.
*/
enum yytbl_id {
- YYT_ID_ACCEPT = 0x01, /**< 1-dim ints */
- YYT_ID_BASE = 0x02, /**< 1-dim ints */
- YYT_ID_CHK = 0x03, /**< 1-dim ints */
- YYT_ID_DEF = 0x04, /**< 1-dim ints */
- YYT_ID_EC = 0x05, /**< 1-dim ints */
- YYT_ID_META = 0x06, /**< 1-dim ints */
- YYT_ID_NUL_TRANS = 0x07, /**< 1-dim ints, maybe indices */
- YYT_ID_NXT = 0x08, /**< may be 2 dimensional ints */
- YYT_ID_RULE_CAN_MATCH_EOL = 0x09, /**< 1-dim ints */
- YYT_ID_START_STATE_LIST = 0x0A, /**< 1-dim indices into trans tbl */
- YYT_ID_TRANSITION = 0x0B /**< structs */
+ YYTD_ID_ACCEPT = 0x01, /**< 1-dim ints */
+ YYTD_ID_BASE = 0x02, /**< 1-dim ints */
+ YYTD_ID_CHK = 0x03, /**< 1-dim ints */
+ YYTD_ID_DEF = 0x04, /**< 1-dim ints */
+ YYTD_ID_EC = 0x05, /**< 1-dim ints */
+ YYTD_ID_META = 0x06, /**< 1-dim ints */
+ YYTD_ID_NUL_TRANS = 0x07, /**< 1-dim ints, maybe indices */
+ YYTD_ID_NXT = 0x08, /**< may be 2 dimensional ints */
+ YYTD_ID_RULE_CAN_MATCH_EOL = 0x09, /**< 1-dim ints */
+ YYTD_ID_START_STATE_LIST = 0x0A, /**< 1-dim indices into trans tbl */
+ YYTD_ID_TRANSITION = 0x0B, /**< structs */
+ YYTD_ID_ACCLIST = 0x0C /**< 1-dim ints */
};
/** bit flags for t_flags field of struct yytbl_data */
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 19a168a..95e3405 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -26,6 +26,7 @@ noinst_SCRIPTS = \
create-test
SUBDIRS = \
+ test-reject \
test-bison-nr \
test-c++-basic \
test-posixly-correct \
diff --git a/tests/test-reject/.cvsignore b/tests/test-reject/.cvsignore
new file mode 100644
index 0000000..6c2de30
--- /dev/null
+++ b/tests/test-reject/.cvsignore
@@ -0,0 +1,9 @@
+Makefile
+Makefile.in
+parser.c
+parser.h
+scanner.c
+TEMPLATE
+OUTPUT
+.deps
+test-reject-*
diff --git a/tests/test-reject/Makefile.am b/tests/test-reject/Makefile.am
new file mode 100644
index 0000000..424ddbc
--- /dev/null
+++ b/tests/test-reject/Makefile.am
@@ -0,0 +1,72 @@
+# This file is part of flex.
+
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+
+# Neither the name of the University nor the names of its contributors
+# may be used to endorse or promote products derived from this software
+# without specific prior written permission.
+
+# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE.
+
+BISON = @BISON@
+FLEX = $(top_builddir)/flex
+
+EXTRA_DIST = scanner.l parser.y test.input
+CLEANFILES = scanner.c test-reject-* OUTPUT $(OBJS)
+OBJS = test-reject-nr.o test-reject-r.o test-reject-ver.o \
+ test-reject-ser.o
+
+INCLUDES = -I $(srcdir) -I $(top_srcdir) -I $(top_builddir) -I .
+#LDFLAGS = $(top_srcdir)/libfl.a
+#LFLAGS = --header="scanner.h"
+#YFLAGS = --defines --output=parser.c
+
+tests = test-reject-nr$(EXEEXT) test-reject-r$(EXEEXT) \
+ test-reject-ser$(EXEEXT) test-reject-ver$(EXEEXT)
+testname = test-reject
+
+test-reject-nr.c: $(srcdir)/scanner.l
+ $(FLEX) -o $@ $(LFLAGS) $<
+
+test-reject-ver.c: $(srcdir)/scanner.l
+ $(FLEX) -o $@ --tables-verify --tables-file=`basename $@ .c`.tables $(LFLAGS) $<
+
+test-reject-ser.c: $(srcdir)/scanner.l
+ $(FLEX) -o $@ --tables-file=`basename $@ .c`.tables $(LFLAGS) $<
+
+test-reject-r.c: $(srcdir)/scanner.l
+ $(FLEX) --reentrant -o $@ $(LFLAGS) $<
+
+test-reject-nr$(EXEEXT): test-reject-nr.o
+ $(CC) -o $@ $(LDFLAGS) $< $(LOADLIBES)
+
+test-reject-ver$(EXEEXT): test-reject-ver.o
+ $(CC) -o $@ $(LDFLAGS) $< $(LOADLIBES)
+
+test-reject-ser$(EXEEXT): test-reject-ser.o
+ $(CC) -o $@ $(LDFLAGS) $< $(LOADLIBES)
+
+test-reject-r$(EXEEXT): test-reject-r.o
+ $(CC) -o $@ $(LDFLAGS) $< $(LOADLIBES)
+
+$(testname)$(EXEEXT): $(OBJS)
+
+test: $(tests)
+ ./$(testname)-nr$(EXEEXT) < $(srcdir)/test.input
+ ./$(testname)-r$(EXEEXT) < $(srcdir)/test.input
+ ./$(testname)-ver$(EXEEXT) $(testname)-ver.tables < $(srcdir)/test.input
+ ./$(testname)-ser$(EXEEXT) $(testname)-ser.tables < $(srcdir)/test.input
+
+.c.o:
+ $(CC) -c -o $@ $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $<
diff --git a/tests/test-reject/scanner.l b/tests/test-reject/scanner.l
new file mode 100644
index 0000000..a093ae4
--- /dev/null
+++ b/tests/test-reject/scanner.l
@@ -0,0 +1,77 @@
+/*
+ * This file is part of flex.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ */
+
+%{
+#include <stdio.h>
+#include <stdlib.h>
+#include "config.h"
+
+%}
+
+%option 8bit prefix="test"
+%option nounput nomain noyywrap
+%option warn reject
+
+
+%%
+
+. { REJECT; }
+.|\n ;
+
+%%
+
+int main ( int argc, char** argv )
+{
+ FILE* fp = NULL;
+ void *yyscanner=0;
+#ifdef YY_REENTRANT
+ yylex_init(&yyscanner);
+#endif
+#ifdef YY_TABLES_EXTERNAL
+ if((fp = fopen(argv[1],"r"))== NULL)
+ yy_fatal_error("could not open tables file for reading" YY_CALL_LAST_ARG);
+
+ if(yytables_load(fp YY_CALL_LAST_ARG) < 0)
+ yy_fatal_error("yytables_load returned < 0" YY_CALL_LAST_ARG);
+ if(YY_TABLES_VERIFY)
+ exit(0);
+#endif
+
+ if(argc > 2){
+ if((fp = fopen(argv[2],"r"))== NULL)
+ yy_fatal_error("could not open input file for reading" YY_CALL_LAST_ARG);
+ yyin = fp;
+ }
+ while(yylex(YY_CALL_ONLY_ARG) != 0)
+ ;
+
+#ifdef YY_TABLES_EXTERNAL
+ yytables_destroy(YY_CALL_ONLY_ARG);
+#endif
+ yylex_destroy(YY_CALL_ONLY_ARG);
+
+ if(argc < 0) /* silence the compiler */
+ yyscanner = (void*)fp;
+
+ return 0;
+}
diff --git a/tests/test-reject/test.input b/tests/test-reject/test.input
new file mode 100644
index 0000000..7288a40
--- /dev/null
+++ b/tests/test-reject/test.input
@@ -0,0 +1,2 @@
+0000 foo 1111 foo 0000 bar
+0000 foo 1111 foo 0000 bar
diff --git a/tests/test-table-opts/Makefile.am b/tests/test-table-opts/Makefile.am
index b500c85..97d8b21 100644
--- a/tests/test-table-opts/Makefile.am
+++ b/tests/test-table-opts/Makefile.am
@@ -63,7 +63,8 @@ sertables := $(addsuffix .tables,$(sertests))
alltables := $(addsuffix .tables,$(alltests))
EXTRA_DIST = scanner.l test.input
-CLEANFILES = scanner.c OUTPUT test-*.o test-*.c test-*.tables core $(alltests)
+CLEANFILES = scanner.c OUTPUT test-*.o test-*.c test-*.tables \
+ all-ser.tables core $(alltests)
INCLUDES = -I $(srcdir) -I $(top_srcdir) -I $(top_builddir) -I .
test: test-table-opts