The translation from Java generics to templates in C++ lead to the need of virtual template functions, which is not supported by C++. Instead we use now the Any class for results of visits and no longer need templates for that part.
- Only require JRE
- Support out of tree build from antlr repostitory
- Support Superproject build with ExternalAntlr4Cpp cmake module
ExternalAntlr4Cpp module has quickstart documentation for people to be
able to start working quicly with antlr4cpp from the base demo sources
see source file for example.
Document the minimum cmake version needed to build C++ target (if compiling with cmake). Also, fix a missing space in cmake command between directory path and defining where the ANTLR .jar is located.
The root cause was that ATNConfigSet was not using he required custom hashing strategy for ParserATNSimulator.
The commit includes a number of additional fixes, related to code that was never executed before due to the root cause.
A similar issue is also likely to exist in the JavaScript runtime, I'll fix it later.
- The previous approach to load and convert UTF-8 data via a stream didn't work well, so I replaced that with a simple load-to-buffer + convert buffer from UTF-8 to UTF-32.
- Removed deleted Token.cpp file from XCode project.
- Created deployment script for Windows + updated doc/releasing-antlr.md.
- Created projects for both VS2013 and VS2015 to be used by the deployment script.
- Fixed trouble with a bug in VS2015 where std::codecvt_utf8<char32_t> is not properly supported.
- Fixed a few #include paths + a number of warnings.
- Settled on a final library name scheme: base part is "libantlr4-runtime" on MacOS + Linux. The extension determines the type (.a static lib, .dylib dynamic lib in MacOS, .so dynamic lib in Linux). No more mention of target language (cpp) or type (static) in the lib name. On Windows we omit the lib prefix, so the name becomes: antlr4-runtime.dll + antlr4-runtime.lib. We may later want to add version information there, but doing that automatically is difficult.
- Updated XCode project and CMakeLists.txt file for the new naming scheme.
- Added deployment scripts for source code (for Linux + iOS) and MacOS.
- Added C++ section in docs/releasing-antlr.md.
No need to use shared_ptr for management. Listeners are, like the other main classes (parser, lexer, input stream etc.) provided by the application and hence managed there.
In order to lower the overhead when passing around Token instances via smart pointers and because the ownership is clear (token streams own them), these instances can be passed as raw pointers.
No need for the ConfigLookup(Impl) class as we only need a way to determine if a config has been added to a set or not. This can be done much simpler by using individual hash codes produced by either ATNConfigSet or OrderedATNConfigSet (idea taken from C# runtime).
ATNConfigSet instance follow a clear ownership (all owned by DFAState instances, which stay alive all time). Hence we can use a unique_ptr for memory management instead and pass raw pointers around where needed.
All shared_ptr<> now use const& for function parameters to avoid constant copies + locks. Ownership and lifetime control is still ensured by the owning containers. Code templates have been updated as well.