From d718fa9f44e36894ffd2d9c05534e81e7f1bfa7f Mon Sep 17 00:00:00 2001 From: Mike Lischke Date: Tue, 21 Jun 2016 10:51:31 +0200 Subject: [PATCH] Windows runtime deployment. - 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 is not properly supported. - Fixed a few #include paths + a number of warnings. --- doc/releasing-antlr.md | 6 +- .../antlr4-cpp-demo/antlr4-cpp-demo.vcxproj | 2 +- .../Cpp/demo/Windows/antlr4-cpp-demo/main.cpp | 7 +- .../{antlr4cpp.sln => antlr4cpp-vs2013.sln} | 20 +- ...r4cpp.vcxproj => antlr4cpp-vs2013.vcxproj} | 225 ++++- ...lters => antlr4cpp-vs2013.vcxproj.filters} | 9 +- runtime/Cpp/runtime/antlr4cpp-vs2015.vcxproj | 623 ++++++++++++ .../runtime/antlr4cpp-vs2015.vcxproj.filters | 939 ++++++++++++++++++ runtime/Cpp/runtime/deploy-windows.cmd | 46 + runtime/Cpp/runtime/src/ANTLRInputStream.cpp | 42 +- runtime/Cpp/runtime/src/ANTLRInputStream.h | 9 +- runtime/Cpp/runtime/src/BailErrorStrategy.cpp | 6 +- runtime/Cpp/runtime/src/Lexer.cpp | 37 +- runtime/Cpp/runtime/src/Lexer.h | 4 - runtime/Cpp/runtime/src/Token.cpp | 37 - .../Cpp/runtime/src/UnbufferedCharStream.cpp | 3 +- .../Cpp/runtime/src/UnbufferedCharStream.h | 7 +- runtime/Cpp/runtime/src/antlr4-common.h | 11 +- runtime/Cpp/runtime/src/atn/ATNType.h | 2 +- runtime/Cpp/runtime/src/dfa/DFAState.cpp | 2 +- runtime/Cpp/runtime/src/support/StringUtils.h | 7 +- runtime/Cpp/runtime/src/tree/Trees.cpp | 2 +- .../tree/pattern/ParseTreePatternMatcher.cpp | 3 +- runtime/Cpp/runtime/src/tree/xpath/XPath.cpp | 4 +- .../runtime/src/tree/xpath/XPathElement.cpp | 2 +- .../tree/xpath/XPathRuleAnywhereElement.cpp | 6 +- .../src/tree/xpath/XPathRuleElement.cpp | 4 +- .../tree/xpath/XPathTokenAnywhereElement.cpp | 4 +- .../src/tree/xpath/XPathTokenElement.cpp | 6 +- .../xpath/XPathWildcardAnywhereElement.cpp | 4 +- .../src/tree/xpath/XPathWildcardElement.cpp | 4 +- 31 files changed, 1917 insertions(+), 166 deletions(-) rename runtime/Cpp/demo/Windows/{antlr4cpp.sln => antlr4cpp-vs2013.sln} (78%) mode change 100755 => 100644 rename runtime/Cpp/runtime/{antlr4cpp.vcxproj => antlr4cpp-vs2013.vcxproj} (69%) rename runtime/Cpp/runtime/{antlr4cpp.vcxproj.filters => antlr4cpp-vs2013.vcxproj.filters} (99%) create mode 100644 runtime/Cpp/runtime/antlr4cpp-vs2015.vcxproj create mode 100644 runtime/Cpp/runtime/antlr4cpp-vs2015.vcxproj.filters create mode 100644 runtime/Cpp/runtime/deploy-windows.cmd delete mode 100755 runtime/Cpp/runtime/src/Token.cpp diff --git a/doc/releasing-antlr.md b/doc/releasing-antlr.md index 43c08dfbf..ebf4adbf7 100644 --- a/doc/releasing-antlr.md +++ b/doc/releasing-antlr.md @@ -247,7 +247,7 @@ Add links to the artifacts from download.html The C++ target is the most complex one, because it addresses multiple platforms, which require individual handling. We have 4 scenarios to cover: -* **Windows**: static and dynamic libraries for the VC++ runtime 2013 and 2015 (corresponding to Visual Studio 2013 and 2015) + header files. All that in 32 and 64bit, debug + release. +* **Windows**: static and dynamic libraries for the VC++ runtime 2013 or 2015 (corresponding to Visual Studio 2013 or 2015) + header files. All that in 32 and 64bit, debug + release. * **MacOS**: static and dynamic libraries + header files. * **iOS**: no prebuilt binaries, but just a zip of the source, including the XCode project to build everything from source. * **Linux**: no prebuilt binaries, but just a zip of the source code, including the cmake file to build everything from source there. @@ -270,11 +270,11 @@ cd runtime/Cpp/runtime ./deploy-source.sh ``` -On a Windows machine (with VS 2013 and VS 2015 installed): +On a Windows machine the build scripts checks if VS 2013 and/or VS 2015 are installed and builds binaries for each, if found. This script requires 7z to be installed (http://7-zip.org). ```bash cd runtime/Cpp/runtime -./deploy-windows.sh +deploy-windows.cmd ``` Move target to website (**_rename to a specific ANTLR version first if needed_**): diff --git a/runtime/Cpp/demo/Windows/antlr4-cpp-demo/antlr4-cpp-demo.vcxproj b/runtime/Cpp/demo/Windows/antlr4-cpp-demo/antlr4-cpp-demo.vcxproj index 20ba96164..17946e98a 100644 --- a/runtime/Cpp/demo/Windows/antlr4-cpp-demo/antlr4-cpp-demo.vcxproj +++ b/runtime/Cpp/demo/Windows/antlr4-cpp-demo/antlr4-cpp-demo.vcxproj @@ -185,7 +185,7 @@ - + {a9762991-1b57-4dce-90c0-ee42b96947be} diff --git a/runtime/Cpp/demo/Windows/antlr4-cpp-demo/main.cpp b/runtime/Cpp/demo/Windows/antlr4-cpp-demo/main.cpp index 601031203..b7664b7c4 100644 --- a/runtime/Cpp/demo/Windows/antlr4-cpp-demo/main.cpp +++ b/runtime/Cpp/demo/Windows/antlr4-cpp-demo/main.cpp @@ -16,7 +16,7 @@ #pragma execution_character_set("utf-8") using namespace antlrcpptest; -using namespace org::antlr::v4::runtime; +using namespace antlr4; int main(int argc, const char * argv[]) { @@ -28,6 +28,11 @@ int main(int argc, const char * argv[]) { std::shared_ptr tree = parser.main(); std::wstring s = antlrcpp::s2ws(tree->toStringTree(&parser)) + L"\n"; + + // Unfortunately, there is no way of showing the Unicode output properly in either the Intermediate Window in VS + // (when using OutputDebugString), nor in a terminal (when using wcout). Instead set a breakpoint and view the + // content of s in the debugger, which works fine. + OutputDebugString(s.data()); std::wcout << "Parse Tree: " << s << std::endl; diff --git a/runtime/Cpp/demo/Windows/antlr4cpp.sln b/runtime/Cpp/demo/Windows/antlr4cpp-vs2013.sln old mode 100755 new mode 100644 similarity index 78% rename from runtime/Cpp/demo/Windows/antlr4cpp.sln rename to runtime/Cpp/demo/Windows/antlr4cpp-vs2013.sln index 75dc3fe25..f7ec0eacb --- a/runtime/Cpp/demo/Windows/antlr4cpp.sln +++ b/runtime/Cpp/demo/Windows/antlr4cpp-vs2013.sln @@ -3,9 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2013 VisualStudioVersion = 12.0.40629.0 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "antlr4-cpp-demo", "antlr4-cpp-demo\antlr4-cpp-demo.vcxproj", "{24EC5104-7402-4C76-B66B-27ADBE062D68}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "antlr4cpp-demo", "antlr4-cpp-demo\antlr4-cpp-demo.vcxproj", "{24EC5104-7402-4C76-B66B-27ADBE062D68}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "antlr4cpp", "..\..\runtime\antlr4cpp.vcxproj", "{A9762991-1B57-4DCE-90C0-EE42B96947BE}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "antlr4cpp-vs2013", "..\..\runtime\antlr4cpp-vs2013.vcxproj", "{A9762991-1B57-4DCE-90C0-EE42B96947BE}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -23,14 +23,14 @@ Global {24EC5104-7402-4C76-B66B-27ADBE062D68}.Release|Win32.Build.0 = Release|Win32 {24EC5104-7402-4C76-B66B-27ADBE062D68}.Release|x64.ActiveCfg = Release|x64 {24EC5104-7402-4C76-B66B-27ADBE062D68}.Release|x64.Build.0 = Release|x64 - {A9762991-1B57-4DCE-90C0-EE42B96947BE}.Debug|Win32.ActiveCfg = Debug|Win32 - {A9762991-1B57-4DCE-90C0-EE42B96947BE}.Debug|Win32.Build.0 = Debug|Win32 - {A9762991-1B57-4DCE-90C0-EE42B96947BE}.Debug|x64.ActiveCfg = Debug|x64 - {A9762991-1B57-4DCE-90C0-EE42B96947BE}.Debug|x64.Build.0 = Debug|x64 - {A9762991-1B57-4DCE-90C0-EE42B96947BE}.Release|Win32.ActiveCfg = Release|Win32 - {A9762991-1B57-4DCE-90C0-EE42B96947BE}.Release|Win32.Build.0 = Release|Win32 - {A9762991-1B57-4DCE-90C0-EE42B96947BE}.Release|x64.ActiveCfg = Release|x64 - {A9762991-1B57-4DCE-90C0-EE42B96947BE}.Release|x64.Build.0 = Release|x64 + {A9762991-1B57-4DCE-90C0-EE42B96947BE}.Debug|Win32.ActiveCfg = Debug Static|Win32 + {A9762991-1B57-4DCE-90C0-EE42B96947BE}.Debug|Win32.Build.0 = Debug Static|Win32 + {A9762991-1B57-4DCE-90C0-EE42B96947BE}.Debug|x64.ActiveCfg = Debug Static|x64 + {A9762991-1B57-4DCE-90C0-EE42B96947BE}.Debug|x64.Build.0 = Debug Static|x64 + {A9762991-1B57-4DCE-90C0-EE42B96947BE}.Release|Win32.ActiveCfg = Release Static|Win32 + {A9762991-1B57-4DCE-90C0-EE42B96947BE}.Release|Win32.Build.0 = Release Static|Win32 + {A9762991-1B57-4DCE-90C0-EE42B96947BE}.Release|x64.ActiveCfg = Release Static|x64 + {A9762991-1B57-4DCE-90C0-EE42B96947BE}.Release|x64.Build.0 = Release Static|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/runtime/Cpp/runtime/antlr4cpp.vcxproj b/runtime/Cpp/runtime/antlr4cpp-vs2013.vcxproj similarity index 69% rename from runtime/Cpp/runtime/antlr4cpp.vcxproj rename to runtime/Cpp/runtime/antlr4cpp-vs2013.vcxproj index 1639c6d4a..0be885527 100644 --- a/runtime/Cpp/runtime/antlr4cpp.vcxproj +++ b/runtime/Cpp/runtime/antlr4cpp-vs2013.vcxproj @@ -1,20 +1,36 @@  - - Debug + + Debug Static Win32 - - Debug + + Debug Static x64 - - Release + + Debug DLL Win32 - - Release + + Debug DLL + x64 + + + Release Static + Win32 + + + Release Static + x64 + + + Release DLL + Win32 + + + Release DLL x64 @@ -24,74 +40,140 @@ antlr4cpp - + DynamicLibrary true Unicode v120 - + + StaticLibrary + true + Unicode + v120 + + DynamicLibrary true Unicode v120 - + + StaticLibrary + true + Unicode + v120 + + DynamicLibrary false true Unicode v120 - + + StaticLibrary + false + true + Unicode + v120 + + DynamicLibrary false true Unicode v120 + + StaticLibrary + false + true + Unicode + v120 + - + - + - + - + + + + + + + + + + + + + - + true - $(SolutionDir)bin\$(PlatformTarget)\$(Configuration)\ + $(SolutionDir)bin\vs-2013\$(PlatformTarget)\$(Configuration)\ $(SolutionDir)obj\$(PlatformTarget)\$(Configuration)\$(ProjectName)\ + antlr4-runtime - + true - $(SolutionDir)bin\$(PlatformTarget)\$(Configuration)\ + $(SolutionDir)bin\vs-2013\$(PlatformTarget)\$(Configuration)\ $(SolutionDir)obj\$(PlatformTarget)\$(Configuration)\$(ProjectName)\ + antlr4-runtime - + + true + $(SolutionDir)bin\vs-2013\$(PlatformTarget)\$(Configuration)\ + $(SolutionDir)obj\$(PlatformTarget)\$(Configuration)\$(ProjectName)\ + antlr4-runtime + + + true + $(SolutionDir)bin\vs-2013\$(PlatformTarget)\$(Configuration)\ + $(SolutionDir)obj\$(PlatformTarget)\$(Configuration)\$(ProjectName)\ + antlr4-runtime + + false - $(SolutionDir)bin\$(PlatformTarget)\$(Configuration)\ + $(SolutionDir)bin\vs-2013\$(PlatformTarget)\$(Configuration)\ $(SolutionDir)obj\$(PlatformTarget)\$(Configuration)\$(ProjectName)\ + antlr4-runtime - + false - $(SolutionDir)bin\$(PlatformTarget)\$(Configuration)\ + $(SolutionDir)bin\vs-2013\$(PlatformTarget)\$(Configuration)\ $(SolutionDir)obj\$(PlatformTarget)\$(Configuration)\$(ProjectName)\ + antlr4-runtime - + + false + $(SolutionDir)bin\vs-2013\$(PlatformTarget)\$(Configuration)\ + $(SolutionDir)obj\$(PlatformTarget)\$(Configuration)\$(ProjectName)\ + antlr4-runtime + + + false + $(SolutionDir)bin\vs-2013\$(PlatformTarget)\$(Configuration)\ + $(SolutionDir)obj\$(PlatformTarget)\$(Configuration)\$(ProjectName)\ + antlr4-runtime + + Level3 Disabled ANTLR4CPP_EXPORTS;%(PreprocessorDefinitions) - src;src\atn;src\dfa;src\misc;src\support;src\tree;src\tree\xpath;src\tree\pattern;%(AdditionalIncludeDirectories) + src;%(AdditionalIncludeDirectories) @@ -103,12 +185,12 @@ true - + Level3 Disabled ANTLR4CPP_EXPORTS;%(PreprocessorDefinitions) - src;src\atn;src\dfa;src\misc;src\support;src\tree;src\tree\xpath;src\tree\pattern;%(AdditionalIncludeDirectories) + src;%(AdditionalIncludeDirectories) @@ -120,14 +202,48 @@ true - + + + Level3 + Disabled + ANTLR4CPP_EXPORTS;%(PreprocessorDefinitions) + src;%(AdditionalIncludeDirectories) + + + + + 4251 + + + Windows + true + + + + + Level3 + Disabled + ANTLR4CPP_EXPORTS;%(PreprocessorDefinitions) + src;%(AdditionalIncludeDirectories) + + + + + 4251 + + + Windows + true + + + Level3 MaxSpeed true true ANTLR4CPP_EXPORTS;%(PreprocessorDefinitions) - src;src\atn;src\dfa;src\misc;src\support;src\tree;src\tree\xpath;src\tree\pattern;%(AdditionalIncludeDirectories) + src;%(AdditionalIncludeDirectories) @@ -141,14 +257,56 @@ true - + Level3 MaxSpeed true true ANTLR4CPP_EXPORTS;%(PreprocessorDefinitions) - src;src\atn;src\dfa;src\misc;src\support;src\tree;src\tree\xpath;src\tree\pattern;%(AdditionalIncludeDirectories) + src;%(AdditionalIncludeDirectories) + + + + + 4251 + + + Windows + true + true + true + + + + + Level3 + MaxSpeed + true + true + ANTLR4CPP_EXPORTS;%(PreprocessorDefinitions) + src;%(AdditionalIncludeDirectories) + + + + + 4251 + + + Windows + true + true + true + + + + + Level3 + MaxSpeed + true + true + ANTLR4CPP_EXPORTS;%(PreprocessorDefinitions) + src;%(AdditionalIncludeDirectories) @@ -268,7 +426,6 @@ - @@ -298,6 +455,8 @@ + + diff --git a/runtime/Cpp/runtime/antlr4cpp.vcxproj.filters b/runtime/Cpp/runtime/antlr4cpp-vs2013.vcxproj.filters similarity index 99% rename from runtime/Cpp/runtime/antlr4cpp.vcxproj.filters rename to runtime/Cpp/runtime/antlr4cpp-vs2013.vcxproj.filters index 107e4cce5..4435091a9 100644 --- a/runtime/Cpp/runtime/antlr4cpp.vcxproj.filters +++ b/runtime/Cpp/runtime/antlr4cpp-vs2013.vcxproj.filters @@ -531,6 +531,12 @@ Header Files\tree\xpath + + Header Files + + + Header Files + @@ -620,9 +626,6 @@ Source Files - - Source Files - Source Files diff --git a/runtime/Cpp/runtime/antlr4cpp-vs2015.vcxproj b/runtime/Cpp/runtime/antlr4cpp-vs2015.vcxproj new file mode 100644 index 000000000..82fd8be53 --- /dev/null +++ b/runtime/Cpp/runtime/antlr4cpp-vs2015.vcxproj @@ -0,0 +1,623 @@ + + + + + Debug Static + Win32 + + + Debug Static + x64 + + + Debug DLL + Win32 + + + Debug DLL + x64 + + + Release Static + Win32 + + + Release Static + x64 + + + Release DLL + Win32 + + + Release DLL + x64 + + + + {A9762991-1B57-4DCE-90C0-EE42B96947BE} + Win32Proj + antlr4cpp + 8.1 + + + + DynamicLibrary + true + Unicode + v140 + + + StaticLibrary + true + Unicode + v140 + + + DynamicLibrary + true + Unicode + v140 + + + StaticLibrary + true + Unicode + v140 + + + DynamicLibrary + false + true + Unicode + v140 + + + StaticLibrary + false + true + Unicode + v140 + + + DynamicLibrary + false + true + Unicode + v140 + + + StaticLibrary + false + true + Unicode + v140 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + $(SolutionDir)bin\vs-2015\$(PlatformTarget)\$(Configuration)\ + $(SolutionDir)obj\$(PlatformTarget)\$(Configuration)\$(ProjectName)\ + antlr4-runtime + + + true + $(SolutionDir)bin\vs-2015\$(PlatformTarget)\$(Configuration)\ + $(SolutionDir)obj\$(PlatformTarget)\$(Configuration)\$(ProjectName)\ + antlr4-runtime + + + true + $(SolutionDir)bin\vs-2015\$(PlatformTarget)\$(Configuration)\ + $(SolutionDir)obj\$(PlatformTarget)\$(Configuration)\$(ProjectName)\ + antlr4-runtime + + + true + $(SolutionDir)bin\vs-2015\$(PlatformTarget)\$(Configuration)\ + $(SolutionDir)obj\$(PlatformTarget)\$(Configuration)\$(ProjectName)\ + antlr4-runtime + + + false + $(SolutionDir)bin\vs-2015\$(PlatformTarget)\$(Configuration)\ + $(SolutionDir)obj\$(PlatformTarget)\$(Configuration)\$(ProjectName)\ + antlr4-runtime + + + false + $(SolutionDir)bin\vs-2015\$(PlatformTarget)\$(Configuration)\ + $(SolutionDir)obj\$(PlatformTarget)\$(Configuration)\$(ProjectName)\ + antlr4-runtime + + + false + $(SolutionDir)bin\vs-2015\$(PlatformTarget)\$(Configuration)\ + $(SolutionDir)obj\$(PlatformTarget)\$(Configuration)\$(ProjectName)\ + antlr4-runtime + + + false + $(SolutionDir)bin\vs-2015\$(PlatformTarget)\$(Configuration)\ + $(SolutionDir)obj\$(PlatformTarget)\$(Configuration)\$(ProjectName)\ + antlr4-runtime + + + + Level3 + Disabled + ANTLR4CPP_EXPORTS;%(PreprocessorDefinitions) + src;%(AdditionalIncludeDirectories) + + + + + 4251 + + + Windows + true + + + + + Level3 + Disabled + ANTLR4CPP_EXPORTS;%(PreprocessorDefinitions) + src;%(AdditionalIncludeDirectories) + + + + + 4251 + + + Windows + true + + + + + Level3 + Disabled + ANTLR4CPP_EXPORTS;%(PreprocessorDefinitions) + src;%(AdditionalIncludeDirectories) + + + + + 4251 + + + Windows + true + + + + + Level3 + Disabled + ANTLR4CPP_EXPORTS;%(PreprocessorDefinitions) + src;%(AdditionalIncludeDirectories) + + + + + 4251 + + + Windows + true + + + + + Level3 + MaxSpeed + true + true + ANTLR4CPP_EXPORTS;%(PreprocessorDefinitions) + src;%(AdditionalIncludeDirectories) + + + + + 4251 + + + Windows + true + true + true + + + + + Level3 + MaxSpeed + true + true + ANTLR4CPP_EXPORTS;%(PreprocessorDefinitions) + src;%(AdditionalIncludeDirectories) + + + + + 4251 + + + Windows + true + true + true + + + + + Level3 + MaxSpeed + true + true + ANTLR4CPP_EXPORTS;%(PreprocessorDefinitions) + src;%(AdditionalIncludeDirectories) + + + + + 4251 + + + Windows + true + true + true + + + + + Level3 + MaxSpeed + true + true + ANTLR4CPP_EXPORTS;%(PreprocessorDefinitions) + src;%(AdditionalIncludeDirectories) + + + + + 4251 + + + Windows + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/runtime/Cpp/runtime/antlr4cpp-vs2015.vcxproj.filters b/runtime/Cpp/runtime/antlr4cpp-vs2015.vcxproj.filters new file mode 100644 index 000000000..4435091a9 --- /dev/null +++ b/runtime/Cpp/runtime/antlr4cpp-vs2015.vcxproj.filters @@ -0,0 +1,939 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {587a2726-4856-4d21-937a-fbaebaa90232} + + + {2662156f-1508-4dad-b991-a8298a6db9bf} + + + {5b1e59b1-7fa5-46a5-8d92-965bd709cca0} + + + {9de9fe74-5d67-441d-a972-3cebe6dfbfcc} + + + {89fd3896-0ab1-476d-8d64-a57f10a5e73b} + + + {23939d7b-8e11-421e-80eb-b2cfdfdd64e9} + + + {05f2bacb-b5b2-4ca3-abe1-ca9a7239ecaa} + + + {d3b2ae2d-836b-4c73-8180-aca4ebb7d658} + + + {6674a0f0-c65d-4a00-a9e5-1f243b89d0a2} + + + {1893fffe-7a2b-4708-8ce5-003aa9b749f7} + + + {053a0632-27bc-4043-b5e8-760951b3b5b9} + + + {048c180d-44cf-49ca-a7aa-d0053fea07f5} + + + {3181cae5-cc15-4050-8c45-22af44a823de} + + + {290632d2-c56e-4005-a417-eb83b9531e1a} + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files\atn + + + Header Files\atn + + + Header Files\atn + + + Header Files\atn + + + Header Files\atn + + + Header Files\atn + + + Header Files\atn + + + Header Files\atn + + + Header Files\atn + + + Header Files\atn + + + Header Files\atn + + + Header Files\atn + + + Header Files\atn + + + Header Files\atn + + + Header Files\atn + + + Header Files\atn + + + Header Files\atn + + + Header Files\atn + + + Header Files\atn + + + Header Files\atn + + + Header Files\atn + + + Header Files\atn + + + Header Files\atn + + + Header Files\atn + + + Header Files\atn + + + Header Files\atn + + + Header Files\atn + + + Header Files\atn + + + Header Files\atn + + + Header Files\atn + + + Header Files\atn + + + Header Files\atn + + + Header Files\atn + + + Header Files\atn + + + Header Files\atn + + + Header Files\atn + + + Header Files\atn + + + Header Files\atn + + + Header Files\atn + + + Header Files\atn + + + Header Files\atn + + + Header Files\atn + + + Header Files\atn + + + Header Files\atn + + + Header Files\atn + + + Header Files\atn + + + Header Files\atn + + + Header Files\dfa + + + Header Files\dfa + + + Header Files\dfa + + + Header Files\dfa + + + Header Files\misc + + + Header Files\misc + + + Header Files\misc + + + Header Files\misc + + + Header Files\support + + + Header Files\support + + + Header Files\support + + + Header Files\support + + + Header Files\support + + + Header Files\tree + + + Header Files\tree + + + Header Files\tree + + + Header Files\tree + + + Header Files\tree + + + Header Files\tree + + + Header Files\tree + + + Header Files\tree + + + Header Files\tree + + + Header Files\tree + + + Header Files\tree + + + Header Files\tree + + + Header Files\tree + + + Header Files\tree + + + Header Files\tree\pattern + + + Header Files\tree\pattern + + + Header Files\tree\pattern + + + Header Files\tree\pattern + + + Header Files\tree\pattern + + + Header Files\tree\pattern + + + Header Files\tree\pattern + + + Header Files\tree\pattern + + + Header Files\tree\xpath + + + Header Files + + + Header Files\atn + + + Header Files\atn + + + Header Files\atn + + + Header Files\atn + + + Header Files\atn + + + Header Files\atn + + + Header Files\atn + + + Header Files\atn + + + Header Files\atn + + + Header Files\atn + + + Header Files\atn + + + Header Files\atn + + + Header Files\atn + + + Header Files\atn + + + Header Files\atn + + + Header Files\atn + + + Header Files\atn + + + Header Files\atn + + + Header Files\atn + + + Header Files\atn + + + Header Files\atn + + + Header Files\misc + + + Header Files + + + Header Files + + + Header Files\support + + + Header Files\tree\xpath + + + Header Files\tree\xpath + + + Header Files\tree\xpath + + + Header Files\tree\xpath + + + Header Files\tree\xpath + + + Header Files\tree\xpath + + + Header Files\tree\xpath + + + Header Files\tree\xpath + + + Header Files\tree\xpath + + + Header Files + + + Header Files + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files\atn + + + Source Files\atn + + + Source Files\atn + + + Source Files\atn + + + Source Files\atn + + + Source Files\atn + + + Source Files\atn + + + Source Files\atn + + + Source Files\atn + + + Source Files\atn + + + Source Files\atn + + + Source Files\atn + + + Source Files\atn + + + Source Files\atn + + + Source Files\atn + + + Source Files\atn + + + Source Files\atn + + + Source Files\atn + + + Source Files\atn + + + Source Files\atn + + + Source Files\atn + + + Source Files\atn + + + Source Files\atn + + + Source Files\atn + + + Source Files\atn + + + Source Files\atn + + + Source Files\atn + + + Source Files\atn + + + Source Files\atn + + + Source Files\atn + + + Source Files\atn + + + Source Files\atn + + + Source Files\atn + + + Source Files\atn + + + Source Files\atn + + + Source Files\atn + + + Source Files\atn + + + Source Files\atn + + + Source Files\atn + + + Source Files\atn + + + Source Files\atn + + + Source Files\atn + + + Source Files\atn + + + Source Files\atn + + + Source Files\dfa + + + Source Files\dfa + + + Source Files\dfa + + + Source Files\dfa + + + Source Files\misc + + + Source Files\misc + + + Source Files\misc + + + Source Files\support + + + Source Files\support + + + Source Files\support + + + Source Files\tree + + + Source Files\tree + + + Source Files\tree + + + Source Files\tree + + + Source Files\tree + + + Source Files\tree\pattern + + + Source Files\tree\pattern + + + Source Files\tree\pattern + + + Source Files\tree\pattern + + + Source Files\tree\pattern + + + Source Files\tree\pattern + + + Source Files\tree\pattern + + + Source Files\atn + + + Source Files\atn + + + Source Files\atn + + + Source Files\atn + + + Source Files\atn + + + Source Files\atn + + + Source Files\atn + + + Source Files\atn + + + Source Files\atn + + + Source Files\atn + + + Source Files\atn + + + Source Files\atn + + + Source Files\atn + + + Source Files\atn + + + Source Files\atn + + + Source Files\atn + + + Source Files\atn + + + Source Files\atn + + + Source Files\atn + + + Source Files + + + Source Files + + + Source Files\support + + + Source Files\tree\xpath + + + Source Files\tree\xpath + + + Source Files\tree\xpath + + + Source Files\tree\xpath + + + Source Files\tree\xpath + + + Source Files\tree\xpath + + + Source Files\tree\xpath + + + Source Files\tree\xpath + + + Source Files\tree\xpath + + + Source Files\tree\xpath + + + Source Files + + + \ No newline at end of file diff --git a/runtime/Cpp/runtime/deploy-windows.cmd b/runtime/Cpp/runtime/deploy-windows.cmd new file mode 100644 index 000000000..4f88fc42d --- /dev/null +++ b/runtime/Cpp/runtime/deploy-windows.cmd @@ -0,0 +1,46 @@ +@echo off + +rem Clean left overs from previous builds if there are any +if exist bin rmdir /S /Q bin +if exist obj rmdir /S /Q obj +if exist lib rmdir /S /Q lib +if exist antlr4-runtime rmdir /S /Q antlr4-runtime +if exist antlr4-cpp-runtime-windows.zip erase antlr4-cpp-runtime-windows.zip + +rem Binaries +if exist "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\VsDevCmd.bat" ( + call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\VsDevCmd.bat" + + msbuild antlr4cpp-vs2013.vcxproj /p:configuration="Release DLL" /p:platform=Win32 + msbuild antlr4cpp-vs2013.vcxproj /p:configuration="Release Static" /p:platform=Win32 + msbuild antlr4cpp-vs2013.vcxproj /p:configuration="Release DLL" /p:platform=x64 + msbuild antlr4cpp-vs2013.vcxproj /p:configuration="Release Static" /p:platform=x64 +) + +if exist "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\VsDevCmd.bat" ( + call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\VsDevCmd.bat" + + msbuild antlr4cpp-vs2015.vcxproj /p:configuration="Release DLL" /p:platform=Win32 + msbuild antlr4cpp-vs2015.vcxproj /p:configuration="Release Static" /p:platform=Win32 + msbuild antlr4cpp-vs2015.vcxproj /p:configuration="Release DLL" /p:platform=x64 + msbuild antlr4cpp-vs2015.vcxproj /p:configuration="Release Static" /p:platform=x64 +) + +rem Headers +xcopy src\*.h antlr4-runtime\ /s + +rem Zip up and clean up +7z a antlr4-cpp-runtime-windows.zip antlr4-runtime +xcopy bin\*.dll lib\ /s +xcopy bin\*.lib lib\ /s +7z a antlr4-cpp-runtime-windows.zip lib + +rmdir /S /Q antlr4-runtime +rmdir /S /Q lib +rmdir /S /Q bin +rmdir /S /Q obj + +rem Deploy +rem copy antlr4-cpp-runtime-windows.zip ~/antlr/sites/website-antlr4/download + +:end diff --git a/runtime/Cpp/runtime/src/ANTLRInputStream.cpp b/runtime/Cpp/runtime/src/ANTLRInputStream.cpp index 2de82788b..ed553eaeb 100755 --- a/runtime/Cpp/runtime/src/ANTLRInputStream.cpp +++ b/runtime/Cpp/runtime/src/ANTLRInputStream.cpp @@ -48,8 +48,8 @@ ANTLRInputStream::ANTLRInputStream(const std::string &input) { load(input); } -ANTLRInputStream::ANTLRInputStream(const char data[], size_t numberOfActualCharsInArray) - : ANTLRInputStream(std::string(data, numberOfActualCharsInArray)) { +ANTLRInputStream::ANTLRInputStream(const char data_[], size_t numberOfActualCharsInArray) + : ANTLRInputStream(std::string(data_, numberOfActualCharsInArray)) { } ANTLRInputStream::ANTLRInputStream(std::wistream &stream) { @@ -57,7 +57,7 @@ ANTLRInputStream::ANTLRInputStream(std::wistream &stream) { } void ANTLRInputStream::load(const std::string &input) { - data = utfConverter.from_bytes(input); + _data = utfConverter.from_bytes(input); p = 0; } @@ -65,21 +65,25 @@ void ANTLRInputStream::load(std::wistream &stream) { if (!stream.good() || stream.eof()) // No fail, bad or EOF. return; - data.clear(); + _data.clear(); p = 0; std::streampos startPosition = stream.tellg(); stream.seekg(0, std::ios::end); - data.reserve(stream.tellg() - startPosition); + _data.reserve(size_t(stream.tellg() - startPosition)); stream.seekg(startPosition, std::ios::beg); +#if defined(_MSC_VER) && _MSC_VER == 1900 + stream.imbue(std::locale(stream.getloc(), new std::codecvt_utf8<__int32>)); +#else stream.imbue(std::locale(stream.getloc(), new std::codecvt_utf8)); +#endif wchar_t c = 0xFFFE; stream >> std::noskipws >> c; if (c != 0xFFFE) // Ignore BOM if theres one. - data += c; + _data += c; for ( ; stream >> c; ) - data += c; + _data += c; } void ANTLRInputStream::reset() { @@ -87,12 +91,12 @@ void ANTLRInputStream::reset() { } void ANTLRInputStream::consume() { - if (p >= data.size()) { + if (p >= _data.size()) { assert(LA(1) == IntStream::EOF); throw IllegalStateException("cannot consume EOF"); } - if (p < data.size()) { + if (p < _data.size()) { p++; } } @@ -104,17 +108,17 @@ ssize_t ANTLRInputStream::LA(ssize_t i) { ssize_t position = (ssize_t)p; if (i < 0) { - i++; // e.g., translate LA(-1) to use offset i=0; then data[p+0-1] + i++; // e.g., translate LA(-1) to use offset i=0; then _data[p+0-1] if ((position + i - 1) < 0) { return IntStream::EOF; // invalid; no char before first char } } - if ((position + i - 1) >= (ssize_t)data.size()) { + if ((position + i - 1) >= (ssize_t)_data.size()) { return IntStream::EOF; } - return data[(size_t)(position + i - 1)]; + return _data[(size_t)(position + i - 1)]; } ssize_t ANTLRInputStream::LT(ssize_t i) { @@ -126,7 +130,7 @@ size_t ANTLRInputStream::index() { } size_t ANTLRInputStream::size() { - return data.size(); + return _data.size(); } // Mark/release do nothing. We have entire buffer. @@ -143,7 +147,7 @@ void ANTLRInputStream::seek(size_t index) { return; } // seek forward, consume until p hits index or n (whichever comes first) - index = std::min(index, data.size()); + index = std::min(index, _data.size()); while (p < index) { consume(); } @@ -158,16 +162,16 @@ std::string ANTLRInputStream::getText(const Interval &interval) { size_t stop = (size_t)interval.b; - if (stop >= data.size()) { - stop = data.size() - 1; + if (stop >= _data.size()) { + stop = _data.size() - 1; } size_t count = stop - start + 1; - if (start >= data.size()) { + if (start >= _data.size()) { return ""; } - return utfConverter.to_bytes(data.substr(start, count)); + return utfConverter.to_bytes(_data.substr(start, count)); } std::string ANTLRInputStream::getSourceName() const { @@ -178,7 +182,7 @@ std::string ANTLRInputStream::getSourceName() const { } std::string ANTLRInputStream::toString() const { - return utfConverter.to_bytes(data); + return utfConverter.to_bytes(_data); } void ANTLRInputStream::InitializeInstanceFields() { diff --git a/runtime/Cpp/runtime/src/ANTLRInputStream.h b/runtime/Cpp/runtime/src/ANTLRInputStream.h index d515b1504..67dc15281 100755 --- a/runtime/Cpp/runtime/src/ANTLRInputStream.h +++ b/runtime/Cpp/runtime/src/ANTLRInputStream.h @@ -41,7 +41,12 @@ namespace antlr4 { class ANTLR4CPP_PUBLIC ANTLRInputStream : public CharStream { protected: /// The data being scanned. - std::u32string data; // UTF-32 + // UTF-32 +#if defined(_MSC_VER) && _MSC_VER == 1900 + i32string _data; // Custom type for VS 2015. +#else + std::u32string _data; +#endif /// 0..n-1 index into string of next char size_t p; @@ -51,7 +56,7 @@ namespace antlr4 { std::string name; ANTLRInputStream(const std::string &input = ""); - ANTLRInputStream(const char data[], size_t numberOfActualCharsInArray); + ANTLRInputStream(const char data_[], size_t numberOfActualCharsInArray); ANTLRInputStream(std::wistream &stream); virtual void load(const std::string &input); diff --git a/runtime/Cpp/runtime/src/BailErrorStrategy.cpp b/runtime/Cpp/runtime/src/BailErrorStrategy.cpp index 87a08bfd0..4dab982c0 100755 --- a/runtime/Cpp/runtime/src/BailErrorStrategy.cpp +++ b/runtime/Cpp/runtime/src/BailErrorStrategy.cpp @@ -49,10 +49,11 @@ void BailErrorStrategy::recover(Parser *recognizer, std::exception_ptr e) { try { std::rethrow_exception(e); // Throw the exception to be able to catch and rethrow nested. - } catch (RecognitionException &inner) { #if defined(_MSC_FULL_VER) && _MSC_FULL_VER < 190023026 + } catch (RecognitionException &inner) { throw ParseCancellationException(inner.what()); #else + } catch (RecognitionException & /*inner*/) { std::throw_with_nested(ParseCancellationException()); #endif } @@ -72,10 +73,11 @@ Token* BailErrorStrategy::recoverInline(Parser *recognizer) { try { throw e; - } catch (InputMismatchException &inner) { #if defined(_MSC_FULL_VER) && _MSC_FULL_VER < 190023026 + } catch (InputMismatchException &inner) { throw ParseCancellationException(inner.what()); #else + } catch (InputMismatchException & /*inner*/) { std::throw_with_nested(ParseCancellationException()); #endif } diff --git a/runtime/Cpp/runtime/src/Lexer.cpp b/runtime/Cpp/runtime/src/Lexer.cpp index d78264401..ab1a13dd4 100755 --- a/runtime/Cpp/runtime/src/Lexer.cpp +++ b/runtime/Cpp/runtime/src/Lexer.cpp @@ -273,39 +273,24 @@ void Lexer::notifyListeners(const LexerNoViableAltException &e) { } std::string Lexer::getErrorDisplay(const std::string &s) { - std::u32string temp = utfConverter.from_bytes(s); std::stringstream ss; - for (auto c : temp) { - ss << getErrorDisplay(c); - } - return ss.str(); -} - -std::string Lexer::getErrorDisplay(ssize_t c) { - std::string s; - switch (c) { - case EOF : - s = ""; + for (auto c : s) { + switch (c) { + case '\n': + ss << "\\n"; break; - case '\n' : - s = "\\n"; + case '\t': + ss << "\\t"; break; - case '\t' : - s = "\\t"; - break; - case '\r' : - s = "\\r"; + case '\r': + ss << "\\r"; break; default: - s = utfConverter.to_bytes((char32_t)c); + ss << c; break; + } } - return s; -} - -std::string Lexer::getCharErrorDisplay(ssize_t c) { - std::string s = getErrorDisplay(c); - return "'" + s + "'"; + return ss.str(); } void Lexer::recover(RecognitionException * /*re*/) { diff --git a/runtime/Cpp/runtime/src/Lexer.h b/runtime/Cpp/runtime/src/Lexer.h index 61cb7e4c9..6eb8bd5ff 100755 --- a/runtime/Cpp/runtime/src/Lexer.h +++ b/runtime/Cpp/runtime/src/Lexer.h @@ -198,10 +198,6 @@ namespace antlr4 { virtual std::string getErrorDisplay(const std::string &s); - virtual std::string getErrorDisplay(ssize_t c); - - virtual std::string getCharErrorDisplay(ssize_t c); - /// Lexers can normally match any char in it's vocabulary after matching /// a token, so do the easy thing and just kill a character and hope /// it all works out. You can instead use the rule invocation stack diff --git a/runtime/Cpp/runtime/src/Token.cpp b/runtime/Cpp/runtime/src/Token.cpp deleted file mode 100755 index d9befe851..000000000 --- a/runtime/Cpp/runtime/src/Token.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - * [The "BSD license"] - * Copyright (c) 2016 Mike Lischke - * Copyright (c) 2013 Terence Parr - * Copyright (c) 2013 Dan McLaughlin - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "support/StringUtils.h" - -#include "Token.h" - -using namespace antlr4; - diff --git a/runtime/Cpp/runtime/src/UnbufferedCharStream.cpp b/runtime/Cpp/runtime/src/UnbufferedCharStream.cpp index 6dddf556d..3ccf78598 100755 --- a/runtime/Cpp/runtime/src/UnbufferedCharStream.cpp +++ b/runtime/Cpp/runtime/src/UnbufferedCharStream.cpp @@ -84,11 +84,12 @@ size_t UnbufferedCharStream::fill(size_t n) { try { char32_t c = nextChar(); add(c); - } catch (IOException &ioe) { #if defined(_MSC_FULL_VER) && _MSC_FULL_VER < 190023026 + } catch (IOException &ioe) { // throw_with_nested is not available before VS 2015. throw ioe; #else + } catch (IOException & /*ioe*/) { std::throw_with_nested(RuntimeException()); #endif } diff --git a/runtime/Cpp/runtime/src/UnbufferedCharStream.h b/runtime/Cpp/runtime/src/UnbufferedCharStream.h index 0f4280985..2e8333672 100755 --- a/runtime/Cpp/runtime/src/UnbufferedCharStream.h +++ b/runtime/Cpp/runtime/src/UnbufferedCharStream.h @@ -77,7 +77,12 @@ namespace antlr4 { /// A moving window buffer of the data being scanned. While there's a marker, /// we keep adding to buffer. Otherwise, resets so /// we start filling at index 0 again. - std::u32string _data; // UTF-32 encoded. + // UTF-32 encoded. +#if defined(_MSC_VER) && _MSC_VER == 1900 + i32string _data; // Custom type for VS 2015. +#else + std::u32string _data; +#endif /// /// 0..n-1 index into of next character. diff --git a/runtime/Cpp/runtime/src/antlr4-common.h b/runtime/Cpp/runtime/src/antlr4-common.h index 8b1004ce3..fae5447a6 100644 --- a/runtime/Cpp/runtime/src/antlr4-common.h +++ b/runtime/Cpp/runtime/src/antlr4-common.h @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -67,7 +68,13 @@ typedef int ssize_t; #endif - #ifdef _DLL + #if _MSC_VER == 1900 + // VS 2015 has a known bug when using std::codecvt_utf8 + // so we have to temporarily use __int32 instead. + typedef std::basic_string<__int32> i32string; + #endif + + #ifdef _WINDLL #ifdef ANTLR4CPP_EXPORTS #define ANTLR4CPP_PUBLIC __declspec(dllexport) #define EXPIMP_TEMPLATE @@ -80,6 +87,8 @@ #define EXPIMP_TEMPLATE #endif + EXPIMP_TEMPLATE class ANTLR4CPP_PUBLIC std::exception; // Needed for VS 2015. + #elif __APPLE__ #define GUID_CFUUID #define ANTLR4CPP_PUBLIC diff --git a/runtime/Cpp/runtime/src/atn/ATNType.h b/runtime/Cpp/runtime/src/atn/ATNType.h index 04a6e1a72..ddb684579 100755 --- a/runtime/Cpp/runtime/src/atn/ATNType.h +++ b/runtime/Cpp/runtime/src/atn/ATNType.h @@ -37,7 +37,7 @@ namespace antlr4 { namespace atn { /// Represents the type of recognizer an ATN applies to. - ANTLR4CPP_PUBLIC enum class ATNType { + enum class ATNType { LEXER = 0, PARSER = 1, }; diff --git a/runtime/Cpp/runtime/src/dfa/DFAState.cpp b/runtime/Cpp/runtime/src/dfa/DFAState.cpp index 8b6c904ed..5184915ca 100755 --- a/runtime/Cpp/runtime/src/dfa/DFAState.cpp +++ b/runtime/Cpp/runtime/src/dfa/DFAState.cpp @@ -30,7 +30,7 @@ */ #include "atn/ATNConfigSet.h" -#include "SemanticContext.h" +#include "atn/SemanticContext.h" #include "atn/ATNConfig.h" #include "misc/MurmurHash.h" diff --git a/runtime/Cpp/runtime/src/support/StringUtils.h b/runtime/Cpp/runtime/src/support/StringUtils.h index 5cc301fef..8e23935a8 100644 --- a/runtime/Cpp/runtime/src/support/StringUtils.h +++ b/runtime/Cpp/runtime/src/support/StringUtils.h @@ -34,8 +34,13 @@ namespace antlrcpp { // For all conversions utf8 <-> utf32. + // VS 2015 has a bug in std::codecvt_utf8 (VS 2013 works fine). +#if defined(_MSC_VER) && _MSC_VER == 1900 + static std::wstring_convert, __int32> utfConverter; +#else static std::wstring_convert, char32_t> utfConverter; - +#endif + void replaceAll(std::string& str, const std::string& from, const std::string& to); ANTLR4CPP_PUBLIC std::string ws2s(const std::wstring &wstr); diff --git a/runtime/Cpp/runtime/src/tree/Trees.cpp b/runtime/Cpp/runtime/src/tree/Trees.cpp index cf35d5943..bc222a6e1 100755 --- a/runtime/Cpp/runtime/src/tree/Trees.cpp +++ b/runtime/Cpp/runtime/src/tree/Trees.cpp @@ -38,7 +38,7 @@ #include "misc/Interval.h" #include "Token.h" #include "CommonToken.h" -#include "Predicate.h" +#include "misc/Predicate.h" #include "tree/Trees.h" diff --git a/runtime/Cpp/runtime/src/tree/pattern/ParseTreePatternMatcher.cpp b/runtime/Cpp/runtime/src/tree/pattern/ParseTreePatternMatcher.cpp index 6e7eccdd1..2136329f2 100755 --- a/runtime/Cpp/runtime/src/tree/pattern/ParseTreePatternMatcher.cpp +++ b/runtime/Cpp/runtime/src/tree/pattern/ParseTreePatternMatcher.cpp @@ -120,11 +120,12 @@ ParseTreePattern ParseTreePatternMatcher::compile(const std::string &pattern, in #endif } catch (RecognitionException &re) { throw re; - } catch (std::exception &e) { #if defined(_MSC_FULL_VER) && _MSC_FULL_VER < 190023026 + } catch (std::exception &e) { // throw_with_nested is not available before VS 2015. throw e; #else + } catch (std::exception & /*e*/) { std::throw_with_nested("Cannot invoke start rule"); // Wrap any other exception. We should however probably use one of the ANTLR exceptions here. #endif } diff --git a/runtime/Cpp/runtime/src/tree/xpath/XPath.cpp b/runtime/Cpp/runtime/src/tree/xpath/XPath.cpp index d9f0da865..fd5721f4e 100755 --- a/runtime/Cpp/runtime/src/tree/xpath/XPath.cpp +++ b/runtime/Cpp/runtime/src/tree/xpath/XPath.cpp @@ -39,7 +39,7 @@ #include "XPathRuleAnywhereElement.h" #include "XPathRuleElement.h" -#include "ParseTree.h" +#include "tree/ParseTree.h" #include "XPath.h" @@ -65,7 +65,7 @@ std::vector XPath::split(const std::string &path) { CommonTokenStream tokenStream(&lexer); try { tokenStream.fill(); - } catch (LexerNoViableAltException &e) { + } catch (LexerNoViableAltException &) { int pos = lexer.getCharPositionInLine(); std::string msg = "Invalid tokens or characters at index " + std::to_string(pos) + " in path '" + path + "'"; throw IllegalArgumentException(msg); diff --git a/runtime/Cpp/runtime/src/tree/xpath/XPathElement.cpp b/runtime/Cpp/runtime/src/tree/xpath/XPathElement.cpp index 9c8946e8e..49d189803 100755 --- a/runtime/Cpp/runtime/src/tree/xpath/XPathElement.cpp +++ b/runtime/Cpp/runtime/src/tree/xpath/XPathElement.cpp @@ -29,7 +29,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "CPPUtils.h" +#include "support/CPPUtils.h" #include "XPathElement.h" diff --git a/runtime/Cpp/runtime/src/tree/xpath/XPathRuleAnywhereElement.cpp b/runtime/Cpp/runtime/src/tree/xpath/XPathRuleAnywhereElement.cpp index 1d8024b05..39c8ec688 100755 --- a/runtime/Cpp/runtime/src/tree/xpath/XPathRuleAnywhereElement.cpp +++ b/runtime/Cpp/runtime/src/tree/xpath/XPathRuleAnywhereElement.cpp @@ -29,10 +29,10 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "ParseTree.h" -#include "Trees.h" +#include "tree/ParseTree.h" +#include "tree/Trees.h" -#include "XPathRuleAnywhereElement.h" +#include "tree/xpath/XPathRuleAnywhereElement.h" using namespace antlr4::tree; using namespace antlr4::tree::xpath; diff --git a/runtime/Cpp/runtime/src/tree/xpath/XPathRuleElement.cpp b/runtime/Cpp/runtime/src/tree/xpath/XPathRuleElement.cpp index 474157277..ba96cf070 100755 --- a/runtime/Cpp/runtime/src/tree/xpath/XPathRuleElement.cpp +++ b/runtime/Cpp/runtime/src/tree/xpath/XPathRuleElement.cpp @@ -29,8 +29,8 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "ParseTree.h" -#include "Trees.h" +#include "tree/ParseTree.h" +#include "tree/Trees.h" #include "XPathRuleElement.h" diff --git a/runtime/Cpp/runtime/src/tree/xpath/XPathTokenAnywhereElement.cpp b/runtime/Cpp/runtime/src/tree/xpath/XPathTokenAnywhereElement.cpp index b963cf856..54a187a53 100755 --- a/runtime/Cpp/runtime/src/tree/xpath/XPathTokenAnywhereElement.cpp +++ b/runtime/Cpp/runtime/src/tree/xpath/XPathTokenAnywhereElement.cpp @@ -29,8 +29,8 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "ParseTree.h" -#include "Trees.h" +#include "tree/ParseTree.h" +#include "tree/Trees.h" #include "XPathTokenAnywhereElement.h" diff --git a/runtime/Cpp/runtime/src/tree/xpath/XPathTokenElement.cpp b/runtime/Cpp/runtime/src/tree/xpath/XPathTokenElement.cpp index 2bd9d9934..6e129f7b2 100755 --- a/runtime/Cpp/runtime/src/tree/xpath/XPathTokenElement.cpp +++ b/runtime/Cpp/runtime/src/tree/xpath/XPathTokenElement.cpp @@ -29,9 +29,9 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "ParseTree.h" -#include "Trees.h" -#include "CPPUtils.h" +#include "tree/ParseTree.h" +#include "tree/Trees.h" +#include "support/CPPUtils.h" #include "Token.h" #include "XPathTokenElement.h" diff --git a/runtime/Cpp/runtime/src/tree/xpath/XPathWildcardAnywhereElement.cpp b/runtime/Cpp/runtime/src/tree/xpath/XPathWildcardAnywhereElement.cpp index 0ad3495e1..8d88707e8 100755 --- a/runtime/Cpp/runtime/src/tree/xpath/XPathWildcardAnywhereElement.cpp +++ b/runtime/Cpp/runtime/src/tree/xpath/XPathWildcardAnywhereElement.cpp @@ -30,8 +30,8 @@ */ #include "XPath.h" -#include "ParseTree.h" -#include "Trees.h" +#include "tree/ParseTree.h" +#include "tree/Trees.h" #include "XPathWildcardAnywhereElement.h" diff --git a/runtime/Cpp/runtime/src/tree/xpath/XPathWildcardElement.cpp b/runtime/Cpp/runtime/src/tree/xpath/XPathWildcardElement.cpp index 110fafc4d..b88a9e2af 100755 --- a/runtime/Cpp/runtime/src/tree/xpath/XPathWildcardElement.cpp +++ b/runtime/Cpp/runtime/src/tree/xpath/XPathWildcardElement.cpp @@ -30,8 +30,8 @@ */ #include "XPath.h" -#include "ParseTree.h" -#include "Trees.h" +#include "tree/ParseTree.h" +#include "tree/Trees.h" #include "XPathWildcardElement.h"