[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Please allow changing of stack.hh name
From: |
Askar Safin |
Subject: |
Please allow changing of stack.hh name |
Date: |
Sat, 16 Apr 2016 20:24:08 +0300 |
Hi. It seems that it is not possible to change name of stack.hh (output of
bison in c++ mode). (Right?) This can be bad in situation where I have two
parsers.
I have two C++ parsers which link together. So, they use different C++
namespace. So, this namespace name is leaked to stack.hh. So, two bison calls
generate two different stack.hh files. So, I have to somehow handle this and so
I use the following Makefile:
atstr-parser.tab.cpp atstr-parser.tab.hpp atstr-stack.hh: atstr-parser.ypp
/opt/bison-3.0.3/bin/bison -do atstr-parser.tab.cpp atstr-parser.ypp &&
mv stack.hh atstr-stack.hh || rm -f stack.hh
json-parser.tab.cpp json-parser.tab.hpp json-stack.hh: json-parser.ypp
/opt/bison-3.0.3/bin/bison -do json-parser.tab.cpp json-parser.ypp &&
mv stack.hh json-stack.hh || rm -f stack.hh
stack.hh: atstr-stack.hh json-stack.hh
cat atstr-stack.hh json-stack.hh > stack.hh
atstr-lex.yy.o: atstr-lex.yy.cpp ats.hpp atstr-parser.tab.hpp stack.hh
libsh-build/libsh.a
$(PP_CXX) -c atstr-lex.yy.cpp
atstr-parser.tab.o: atstr-parser.tab.cpp atstr-parser.tab.hpp stack.hh ats.hpp
libsh-build/libsh.a
$(PP_CXX) -c atstr-parser.tab.cpp
json-lex.yy.o: json-lex.yy.cpp ats.hpp json-parser.tab.hpp stack.hh
libsh-build/libsh.a
$(PP_CXX) -c json-lex.yy.cpp
json-parser.tab.o: json-parser.tab.cpp json-parser.tab.hpp stack.hh ats.hpp
libsh-build/libsh.a
$(PP_CXX) -c json-parser.tab.cpp
I am not sure this Makefile will always work (can it give me "stack.hh: file
not found" message?). Also, it seems this Makefile will not work in case of
parallel build.
So, I think you should allow user to supply different name to stack.hh. There
are another solutions, of course. For example, make stack.hh to be always same
(I think this is bad idea). Or just make stack.hh not to be not generated. I.
e. just include it contents to some other generated file/files. I think this is
good idea, this would simplify using bison.
==
Askar Safin
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Please allow changing of stack.hh name,
Askar Safin <=