diff --git a/lib/lrama/grammar/stdlib.y b/lib/lrama/grammar/stdlib.y index e9a55adc2..dd397c9e0 100644 --- a/lib/lrama/grammar/stdlib.y +++ b/lib/lrama/grammar/stdlib.y @@ -8,6 +8,8 @@ **********************************************************************/ +%% + // ------------------------------------------------------------------- // Options @@ -138,7 +140,3 @@ %rule separated_list(separator, X) : option(separated_nonempty_list(separator, X)) ; - -%% - -%union{}; diff --git a/template/bison/_yacc.h b/template/bison/_yacc.h index 34ed6d81f..3e270c917 100644 --- a/template/bison/_yacc.h +++ b/template/bison/_yacc.h @@ -28,6 +28,7 @@ extern int yydebug; <%-# b4_declare_yylstype -%> <%-# b4_value_type_define -%> /* Value type. */ +<% if output.grammar.union %> #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED union YYSTYPE { @@ -40,6 +41,13 @@ typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 #endif +<% else %> +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef int YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 +# define YYSTYPE_IS_DECLARED 1 +#endif +<% end %> <%-# b4_location_type_define -%> /* Location type. */