flex
flex copied to clipboard
Make C++ lexers standalone: please no requirement on system's FlexLexer.h
I'm writing a program using flex that supports cross-compilation between architectures. I'm using the C++ lexer mode. I'm generally happy with it, except for the way that the generated lexer uses #include <FlexLexer.h>
and doesn't provide a FlexLexer.h
--- the header needs to come from the system, and in the cross-compilation case, we may end up including the wrong FlexLexer.h or fail to find the header at all.
Can we just change the C++ lexer to include the contents of FlexLexer.h directly in the generated code so that it's nice and standalone?
A couple of PRs that will make this possible are in the pipeline. It's been a challenge in the past because so much C was emitted from Flex's compiled code. We'll soon be able to choose the output language and customize the skeleton to match so we won't need the separate C++ header anymore.
In the meantime, when I'm in your situation I copy the system's FlexLexer.h into my source tree and add its include path. It's not a perfect solution.
If memory serves, the default system header is in /use/share/include. Most of the packaged versions I've used install it under /usr/share too.
And the retargeting stuff is merged in, so does the current tip of master do what you need?