diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2020-09-24 05:44:31 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2020-09-24 06:52:27 -0400 |
commit | 31b751703fa3589dab34ff3ed93c3f3074ff8bf4 (patch) | |
tree | 54e91ad11c76e788609d6bd0b05f9af9fe65dc7f | |
parent | d7cb3bf631ae1197359f4ce698c73763a5b5ac46 (diff) | |
download | flex-git-31b751703fa3589dab34ff3ed93c3f3074ff8bf4.tar.gz |
Chase down some methodization details missed earlier.
No generated-code diffs from this change.
#36 in the retargeting patch series
-rw-r--r-- | src/backend.adoc | 7 | ||||
-rw-r--r-- | src/cpp_backend.c | 1 | ||||
-rw-r--r-- | src/dfa.c | 4 | ||||
-rw-r--r-- | src/flexdef.h | 1 | ||||
-rw-r--r-- | src/gen.c | 2 | ||||
-rw-r--r-- | src/misc.c | 2 |
6 files changed, 11 insertions, 6 deletions
diff --git a/src/backend.adoc b/src/backend.adoc index e8d8323..f1876d3 100644 --- a/src/backend.adoc +++ b/src/backend.adoc @@ -82,8 +82,13 @@ require fixes outside a back end. there is an explicit fallthrough keyword that enables this, as in Go. +3. The item separator in data initializers is a comma. + By putting a yyterminate() call in the fallthrough member and a null pointer in the endcase member, you could handle -languages like Pascal +languages like Pascal. + +// end + diff --git a/src/cpp_backend.c b/src/cpp_backend.c index ad46b0d..96e4894 100644 --- a/src/cpp_backend.c +++ b/src/cpp_backend.c @@ -607,6 +607,7 @@ struct flex_backend_t cpp_backend = { .table_opener = " {", .table_continuation = " },\n", .table_closer = " };\n", + .dyad = " {%4d,%4d },", .comment = cpp_comment, .get_int16_decl = cpp_get_int16_decl, .get_int32_decl = cpp_get_int32_decl, @@ -683,10 +683,8 @@ void ntod (void) yynxt_tbl->td_hilen * yynxt_tbl->td_lolen * sizeof (flex_int32_t)); - - if (gentables) - outn (" {"); + outn (backend->table_opener); /* Supply array's 0-element. */ if (ds == end_of_buffer_state) { diff --git a/src/flexdef.h b/src/flexdef.h index 84365b9..b3468ea 100644 --- a/src/flexdef.h +++ b/src/flexdef.h @@ -318,6 +318,7 @@ struct flex_backend_t { char *table_opener; // Open an array initializer with this char *table_continuation; // Open an array initializer with this char *table_closer; // How to continue a two-level initializer + char *dyad; // How to format and int[2] initializer void (*comment)(const char *); // Wrap a comment line const char *(*get_int16_decl)(void); // Format for declaring array initializer of int16s const char *(*get_int32_decl)(void); // Format for declaring array initializer of int32s @@ -106,7 +106,7 @@ static void geneoltbl (void) if ((i % 20) == 19) out ("\n "); } - out (" };\n"); + outn (backend->table_closer); } outn ("]])"); } @@ -827,7 +827,7 @@ void transition_struct_out (int element_v, int element_n) if (!gentables) return; - out_dec2 (" {%4d,%4d },", element_v, element_n); + out_dec2 (backend->dyad, element_v, element_n); datapos += TRANS_STRUCT_PRINT_LENGTH; |