1
0
mirror of https://git.savannah.gnu.org/git/gperf.git synced 2025-12-02 13:09:22 +00:00

Support for abbreviated struct declarations.

This commit is contained in:
Bruno Haible
2003-06-02 11:43:01 +00:00
parent eba9cf3822
commit fcd638a42f
6 changed files with 168 additions and 4 deletions

View File

@@ -380,7 +380,7 @@ input:
@example
@group
struct months @{ char *name; int number; int days; int leap_days; @};
struct month @{ char *name; int number; int days; int leap_days; @};
%%
january, 1, 31, 31
february, 2, 28, 29
@@ -403,6 +403,18 @@ other fields are a pair of consecutive percent signs, @samp{%%},
appearing left justified in the first column, as in the UNIX utility
@code{lex}.
If the @code{struct} has already been declared in an include file, it can
be mentioned in an abbreviated form, like this:
@example
@group
struct month;
%%
january, 1, 31, 31
...
@end group
@end example
@node Gperf Declarations, C Code Inclusion, User-supplied Struct, Declarations
@subsubsection Gperf Declarations
@@ -628,9 +640,9 @@ feature:
%@{
#include <assert.h>
/* This section of code is inserted directly into the output. */
int return_month_days (struct months *months, int is_leap_year);
int return_month_days (struct month *months, int is_leap_year);
%@}
struct months @{ char *name; int number; int days; int leap_days; @};
struct month @{ char *name; int number; int days; int leap_days; @};
%%
january, 1, 31, 31
february, 2, 28, 29