lalr1.cc: do not create stack.hh without %defines

* data/stack.hh (b4_stack_define): New.
* data/lalr1.cc: Use it when %defines is not passed.
* tests/output.at: Adjust expected output.
This commit is contained in:
Akim Demaille
2012-07-30 16:51:29 +02:00
parent 93549bcd43
commit 5de5b98751
5 changed files with 45 additions and 29 deletions

View File

@@ -18,23 +18,10 @@
m4_pushdef([b4_copyright_years],
[2002-2012])
# We do want M4 expansion after # for CPP macros.
m4_changecom()
m4_divert_push(0)dnl
@output(b4_dir_prefix[]stack.hh@)@
b4_copyright([Stack handling for Bison parsers in C++])[
/**
** \file ]b4_dir_prefix[stack.hh
** Define the ]b4_namespace_ref[::stack class.
*/
]b4_cpp_guard_open([b4_dir_prefix[]stack.hh])[
# include <deque>
]b4_namespace_open[
template <class T, class S = std::deque<T> >
# b4_stack_define
# ---------------
m4_define([b4_stack_define],
[[ template <class T, class S = std::deque<T> >
class stack
{
public:
@@ -129,9 +116,30 @@ b4_copyright([Stack handling for Bison parsers in C++])[
const S& stack_;
unsigned int range_;
};
]])
b4_defines_if(
[# We do want M4 expansion after # for CPP macros.
m4_changecom()
m4_divert_push(0)dnl
@output(b4_dir_prefix[]stack.hh@)@
b4_copyright([Stack handling for Bison parsers in C++])[
/**
** \file ]b4_dir_prefix[stack.hh
** Define the ]b4_namespace_ref[::stack class.
*/
]b4_cpp_guard_open([b4_dir_prefix[]stack.hh])[
# include <deque>
]b4_namespace_open[
]b4_stack_define[
]b4_namespace_close[
]b4_cpp_guard_close([b4_dir_prefix[]stack.hh])
m4_divert_pop(0)
m4_popdef([b4_copyright_years])dnl
m4_changecom([#])
])