diff --git a/runtime/Cpp/CMakeLists.txt b/runtime/Cpp/CMakeLists.txt index 8b766ed1f..cfa341985 100644 --- a/runtime/Cpp/CMakeLists.txt +++ b/runtime/Cpp/CMakeLists.txt @@ -89,7 +89,6 @@ MACRO(ADD_PRECOMPILED_HEADER _targetName _input ) SET(_output "${_outdir}/${CMAKE_BUILD_TYPE}.c++") STRING(TOUPPER "CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}" _flags_var_name) SET(_compiler_FLAGS ${${_flags_var_name}}) - GET_DIRECTORY_PROPERTY(_directory_flags INCLUDE_DIRECTORIES) FOREACH(item ${_directory_flags}) LIST(APPEND _compiler_FLAGS "-I${item}") @@ -110,8 +109,14 @@ MACRO(ADD_PRECOMPILED_HEADER _targetName _input ) ADD_DEPENDENCIES(${_targetName} ${_targetName}_gch) #SET(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-include ${_name} -Winvalid-pch -H") #SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -include ${_name} -Winvalid-pch") + GET_TARGET_PROPERTY(old_compile_flags ${_targetName} COMPILE_FLAGS) + IF(old_compile_flags STREQUAL "old_compile_flags-NOTFOUND") + SET(old_compile_flags "-include ${_name} -Winvalid-pch") + ELSE() + SET(old_compile_flags "${old_compile_flags} -include ${_name} -Winvalid-pch") + ENDIF() SET_TARGET_PROPERTIES(${_targetName} PROPERTIES - COMPILE_FLAGS "-include ${_name} -Winvalid-pch" + COMPILE_FLAGS "${old_compile_flags}" ) ENDMACRO(ADD_PRECOMPILED_HEADER) diff --git a/runtime/Cpp/README.md b/runtime/Cpp/README.md index 095e1ace1..d4eb2c128 100644 --- a/runtime/Cpp/README.md +++ b/runtime/Cpp/README.md @@ -18,8 +18,11 @@ The C++ target has been the work of the following people: * David Sisson, dsisson@google.com * [Mike Lischke](www.soft-gems.net), mike@lischke-online.de -Project Status --------------------------------------------------------------------------------- +## Other contributors + +* Marcin Szalowicz, mszalowicz@mailplus.pl (cmake build setup) + +## Project Status * Building on OS X, Windows, and Linux (Ubuntu) * No errors and warnings diff --git a/runtime/Cpp/demo/CMakeLists.txt b/runtime/Cpp/demo/CMakeLists.txt index e158d7743..f94fc870d 100644 --- a/runtime/Cpp/demo/CMakeLists.txt +++ b/runtime/Cpp/demo/CMakeLists.txt @@ -26,7 +26,7 @@ include_directories( #file(GLOB antlr4-demo_SRC "${PROJECT_SOURCE_DIR}/demo/generated/*") set(antlr4-demo_SRC - Linux/main.cpp + ${PROJECT_SOURCE_DIR}/demo/Linux/main.cpp ${PROJECT_SOURCE_DIR}/demo/generated/TLexer.cpp ${PROJECT_SOURCE_DIR}/demo/generated/TParser.cpp ${PROJECT_SOURCE_DIR}/demo/generated/TParserBaseListener.cpp @@ -35,6 +35,14 @@ set(antlr4-demo_SRC ${PROJECT_SOURCE_DIR}/demo/generated/TParserVisitor.cpp ) +foreach( src_file ${antlr4-demo_SRC} ) + set_source_files_properties( + ${src_file} + PROPERTIES + COMPILE_FLAGS -Wno-overloaded-virtual + ) +endforeach( src_file ${antlr4-demo_SRC} ) + add_executable(antlr4-demo ${antlr4-demo_SRC} ) @@ -44,15 +52,6 @@ add_dependencies(antlr4-demo GenerateParser) target_link_libraries(antlr4-demo antlr4_static) -#foreach(src ${antlr4-demo_SRC}) -# get_source_file_property(old_compile_flags ${src} COMPILE_FLAGS) -# if(old_compile_flags STREQUAL "NOTFOUND") -# set(old_compile_flags "") -# endif() -# set_source_files_properties(${src} PROPERTIES COMPILE_FLAGS -# "${old_compile_flags} -include \"${PROJECT_SOURCE_DIR}/runtime/src/antlrcpp-Prefix.h\"") -#endforeach() - install(TARGETS antlr4-demo DESTINATION "share" COMPONENT dev diff --git a/runtime/Cpp/demo/Mac/antlr4-cpp-demo/main.cpp b/runtime/Cpp/demo/Mac/antlr4-cpp-demo/main.cpp index 0d91591c0..5e59f119f 100644 --- a/runtime/Cpp/demo/Mac/antlr4-cpp-demo/main.cpp +++ b/runtime/Cpp/demo/Mac/antlr4-cpp-demo/main.cpp @@ -17,7 +17,7 @@ using namespace antlrcpptest; using namespace org::antlr::v4::runtime; -int main(int argc, const char * argv[]) { +int main(int , const char **) { ANTLRInputStream input(L"(((x))) * y + z; a + (x * (y ? 0 : 1) + z);"); TLexer lexer(&input); diff --git a/runtime/Cpp/demo/Mac/antlrcpp-demo.xcodeproj/project.pbxproj b/runtime/Cpp/demo/Mac/antlrcpp-demo.xcodeproj/project.pbxproj index bb47040e1..6f09b18ed 100644 --- a/runtime/Cpp/demo/Mac/antlrcpp-demo.xcodeproj/project.pbxproj +++ b/runtime/Cpp/demo/Mac/antlrcpp-demo.xcodeproj/project.pbxproj @@ -446,6 +446,7 @@ GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_PARAMETER = YES; GCC_WARN_UNUSED_VARIABLE = YES; HEADER_SEARCH_PATHS = ( ../../runtime/src/tree/pattern, @@ -490,6 +491,7 @@ GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_PARAMETER = YES; GCC_WARN_UNUSED_VARIABLE = YES; HEADER_SEARCH_PATHS = ( ../../runtime/src/tree/pattern, diff --git a/runtime/Cpp/demo/TLexer.g4 b/runtime/Cpp/demo/TLexer.g4 index af429c2c1..2893a0b64 100644 --- a/runtime/Cpp/demo/TLexer.g4 +++ b/runtime/Cpp/demo/TLexer.g4 @@ -9,10 +9,18 @@ lexer grammar TLexer; @lexer::preinclude {/* lexer precinclude section */} // Follows directly after the standard #includes in h + cpp files. -@lexer::postinclude {/* lexer postinclude section */} +@lexer::postinclude { +/* lexer postinclude section */ +#ifndef _WIN32 +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif +} + +// Directly preceds the lexer class declaration in the h file (e.g. for additional types etc.). +@lexer::context {/* lexer context section */} // Appears in the public part of the lexer in the h file. -@lexer::declarations {/* public lexer declarations section */ +@lexer::members {/* public lexer declarations section */ bool canTestFoo() { return true; } bool isItFoo() { return true; } bool isItBar() { return true; } @@ -22,7 +30,7 @@ void myBarLexerAction() { /* do something*/ }; } // Appears in the private part of the lexer in the h file. -@lexer::members {/* private lexer declarations/members section */} +@lexer::declarations {/* private lexer declarations/members section */} // Appears in line with the other class member definitions in the cpp file. @lexer::definitions {/* lexer definitions section */} diff --git a/runtime/Cpp/demo/TParser.g4 b/runtime/Cpp/demo/TParser.g4 index 1c71a4de7..056783c1e 100644 --- a/runtime/Cpp/demo/TParser.g4 +++ b/runtime/Cpp/demo/TParser.g4 @@ -13,42 +13,34 @@ options { @parser::preinclude {/* parser precinclude section */} // Follows directly after the standard #includes in h + cpp files. -@parser::postinclude {/* parser postinclude section */} +@parser::postinclude { +/* parser postinclude section */ +#ifndef _WIN32 +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif +} -// Appears in the public part of the parser in the h file. -@parser::declarations {/* public parser declarations section */} +// Directly preceeds the parser class declaration in the h file (e.g. for additional types etc.). +@parser::context {/* parser context section */} // Appears in the private part of the parser in the h file. +// The function bodies could also appear in the definitions section, but I want to maximize +// Java compatibility, so we can also create a Java parser from this grammar. +// Still, some tweaking is necessary after the Java file generation (e.g. bool -> boolean). @parser::members { -/* private parser declarations/members section */ -bool myAction(); -bool doesItBlend(); -void cleanUp(); -void doInit(); -void doAfter(); +/* public parser declarations/members section */ +bool myAction() { return true; } +bool doesItBlend() { return true; } +void cleanUp() {} +void doInit() {} +void doAfter() {} } +// Appears in the public part of the parser in the h file. +@parser::declarations {/* private parser declarations section */} + // Appears in line with the other class member definitions in the cpp file. -@parser::definitions { -/* parser definitions section */ -bool TParser::myAction() { - return true; -} - -bool TParser::doesItBlend() { - return true; -} - -void TParser::cleanUp() { -} - -void TParser::doInit() { -} - -void TParser::doAfter() { -} - -} +@parser::definitions {/* parser definitions section */} // Additionally there are similar sections for (base)listener and (base)visitor files. @parser::listenerpreinclude {/* listener preinclude section */} @@ -76,14 +68,14 @@ void TParser::doAfter() { @parser::basevisitordefinitions {/* base visitor definitions section */} // Actual grammar start. -main: stat+; +main: stat+ EOF; divide : ID (and_ GreaterThan)? {doesItBlend()}?; and_ @init{ doInit(); } @after { doAfter(); } : And ; conquer: divide+ | {doesItBlend()}? and_ { myAction(); } - | ID (LessThan* divide)?? + | ID (LessThan* divide)?? { $ID.text; } ; // Unused rule to demonstrate some of the special features. diff --git a/runtime/Cpp/runtime/CMakeLists.txt b/runtime/Cpp/runtime/CMakeLists.txt index 454b60dcf..57902a7ca 100644 --- a/runtime/Cpp/runtime/CMakeLists.txt +++ b/runtime/Cpp/runtime/CMakeLists.txt @@ -20,30 +20,42 @@ file(GLOB libantlrcpp_SRC "${PROJECT_SOURCE_DIR}/runtime/src/tree/pattern/*.cpp" ) +list(REMOVE_ITEM libantlrcpp_SRC ${PROJECT_SOURCE_DIR}/runtime/src/misc/TestRig.cpp) + add_library(antlr4_shared SHARED ${libantlrcpp_SRC}) add_library(antlr4_static STATIC ${libantlrcpp_SRC}) -add_precompiled_header(antlr4_shared ${PROJECT_SOURCE_DIR}/runtime/src/antlrcpp-Prefix.h) -add_precompiled_header(antlr4_static ${PROJECT_SOURCE_DIR}/runtime/src/antlrcpp-Prefix.h) + if(CMAKE_SYSTEM_NAME MATCHES "Linux") target_link_libraries(antlr4_shared ${UUID_LIBRARIES}) target_link_libraries(antlr4_static ${UUID_LIBRARIES}) elseif(APPLE) -# target_link_libraries(antlr4 "-framework CoreFoundation") target_link_libraries(antlr4_shared ${COREFOUNDATION_LIBRARY}) target_link_libraries(antlr4_static ${COREFOUNDATION_LIBRARY}) - endif() +set(disabled_compile_warnings "-Wno-overloaded-virtual") +if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") + set(disabled_compile_warnings "${disabled_compile_warnings} -Wno-dollar-in-identifier-extension -Wno-four-char-constants") +elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") + set(disabled_compile_warnings "${disabled_compile_warnings} -Wno-multichar") +endif() + + set_target_properties(antlr4_shared PROPERTIES VERSION ${ANTLR_VERSION} SOVERSION ${ANTLR_VERSION} - OUTPUT_NAME antlr4) + OUTPUT_NAME antlr4 + COMPILE_FLAGS "${disabled_compile_warnings}") set_target_properties(antlr4_static PROPERTIES VERSION ${ANTLR_VERSION} SOVERSION ${ANTLR_VERSION} - OUTPUT_NAME antlr4) + OUTPUT_NAME antlr4 + COMPILE_FLAGS "${disabled_compile_warnings}") + +add_precompiled_header(antlr4_shared ${PROJECT_SOURCE_DIR}/runtime/src/antlrcpp-Prefix.h) +add_precompiled_header(antlr4_static ${PROJECT_SOURCE_DIR}/runtime/src/antlrcpp-Prefix.h) install(TARGETS antlr4_shared DESTINATION lib) diff --git a/runtime/Cpp/runtime/antlr4cpp.vcxproj b/runtime/Cpp/runtime/antlr4cpp.vcxproj index 3c77ba75a..09243f50e 100644 --- a/runtime/Cpp/runtime/antlr4cpp.vcxproj +++ b/runtime/Cpp/runtime/antlr4cpp.vcxproj @@ -173,7 +173,6 @@ - @@ -186,7 +185,6 @@ - @@ -252,7 +250,6 @@ - @@ -266,11 +263,9 @@ - - @@ -285,7 +280,6 @@ - Create Create diff --git a/runtime/Cpp/runtime/antlr4cpp.vcxproj.filters b/runtime/Cpp/runtime/antlr4cpp.vcxproj.filters index 80cb15f5c..a33a3d67b 100644 --- a/runtime/Cpp/runtime/antlr4cpp.vcxproj.filters +++ b/runtime/Cpp/runtime/antlr4cpp.vcxproj.filters @@ -595,9 +595,6 @@ Source Files - - Source Files - Source Files @@ -610,9 +607,6 @@ Source Files - - Source Files - Source Files\atn @@ -646,9 +640,6 @@ Source Files\atn - - Source Files\atn - Source Files\atn @@ -784,9 +775,6 @@ Source Files\tree - - Source Files\tree - Source Files\tree @@ -841,9 +829,6 @@ Source Files\atn - - Source Files\atn - Source Files\atn @@ -883,8 +868,5 @@ Source Files\atn - - Source Files\misc - \ No newline at end of file diff --git a/runtime/Cpp/runtime/antlrcpp.xcodeproj/project.pbxproj b/runtime/Cpp/runtime/antlrcpp.xcodeproj/project.pbxproj index 4a8222be2..a510c7525 100644 --- a/runtime/Cpp/runtime/antlrcpp.xcodeproj/project.pbxproj +++ b/runtime/Cpp/runtime/antlrcpp.xcodeproj/project.pbxproj @@ -102,9 +102,6 @@ 276E5D851CDB57AA003FF4B4 /* ATNState.h in Headers */ = {isa = PBXBuildFile; fileRef = 276E5C2A1CDB57AA003FF4B4 /* ATNState.h */; }; 276E5D861CDB57AA003FF4B4 /* ATNState.h in Headers */ = {isa = PBXBuildFile; fileRef = 276E5C2A1CDB57AA003FF4B4 /* ATNState.h */; }; 276E5D871CDB57AA003FF4B4 /* ATNState.h in Headers */ = {isa = PBXBuildFile; fileRef = 276E5C2A1CDB57AA003FF4B4 /* ATNState.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 276E5D881CDB57AA003FF4B4 /* ATNType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 276E5C2B1CDB57AA003FF4B4 /* ATNType.cpp */; }; - 276E5D891CDB57AA003FF4B4 /* ATNType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 276E5C2B1CDB57AA003FF4B4 /* ATNType.cpp */; }; - 276E5D8A1CDB57AA003FF4B4 /* ATNType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 276E5C2B1CDB57AA003FF4B4 /* ATNType.cpp */; }; 276E5D8B1CDB57AA003FF4B4 /* ATNType.h in Headers */ = {isa = PBXBuildFile; fileRef = 276E5C2C1CDB57AA003FF4B4 /* ATNType.h */; }; 276E5D8C1CDB57AA003FF4B4 /* ATNType.h in Headers */ = {isa = PBXBuildFile; fileRef = 276E5C2C1CDB57AA003FF4B4 /* ATNType.h */; }; 276E5D8D1CDB57AA003FF4B4 /* ATNType.h in Headers */ = {isa = PBXBuildFile; fileRef = 276E5C2C1CDB57AA003FF4B4 /* ATNType.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -189,9 +186,6 @@ 276E5DDC1CDB57AA003FF4B4 /* LexerActionExecutor.h in Headers */ = {isa = PBXBuildFile; fileRef = 276E5C471CDB57AA003FF4B4 /* LexerActionExecutor.h */; }; 276E5DDD1CDB57AA003FF4B4 /* LexerActionExecutor.h in Headers */ = {isa = PBXBuildFile; fileRef = 276E5C471CDB57AA003FF4B4 /* LexerActionExecutor.h */; }; 276E5DDE1CDB57AA003FF4B4 /* LexerActionExecutor.h in Headers */ = {isa = PBXBuildFile; fileRef = 276E5C471CDB57AA003FF4B4 /* LexerActionExecutor.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 276E5DDF1CDB57AA003FF4B4 /* LexerActionType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 276E5C481CDB57AA003FF4B4 /* LexerActionType.cpp */; }; - 276E5DE01CDB57AA003FF4B4 /* LexerActionType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 276E5C481CDB57AA003FF4B4 /* LexerActionType.cpp */; }; - 276E5DE11CDB57AA003FF4B4 /* LexerActionType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 276E5C481CDB57AA003FF4B4 /* LexerActionType.cpp */; }; 276E5DE21CDB57AA003FF4B4 /* LexerActionType.h in Headers */ = {isa = PBXBuildFile; fileRef = 276E5C491CDB57AA003FF4B4 /* LexerActionType.h */; }; 276E5DE31CDB57AA003FF4B4 /* LexerActionType.h in Headers */ = {isa = PBXBuildFile; fileRef = 276E5C491CDB57AA003FF4B4 /* LexerActionType.h */; }; 276E5DE41CDB57AA003FF4B4 /* LexerActionType.h in Headers */ = {isa = PBXBuildFile; fileRef = 276E5C491CDB57AA003FF4B4 /* LexerActionType.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -588,9 +582,6 @@ 276E5F6E1CDB57AA003FF4B4 /* MurmurHash.h in Headers */ = {isa = PBXBuildFile; fileRef = 276E5CCF1CDB57AA003FF4B4 /* MurmurHash.h */; }; 276E5F6F1CDB57AA003FF4B4 /* MurmurHash.h in Headers */ = {isa = PBXBuildFile; fileRef = 276E5CCF1CDB57AA003FF4B4 /* MurmurHash.h */; }; 276E5F701CDB57AA003FF4B4 /* MurmurHash.h in Headers */ = {isa = PBXBuildFile; fileRef = 276E5CCF1CDB57AA003FF4B4 /* MurmurHash.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 276E5F711CDB57AA003FF4B4 /* Predicate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 276E5CD01CDB57AA003FF4B4 /* Predicate.cpp */; }; - 276E5F721CDB57AA003FF4B4 /* Predicate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 276E5CD01CDB57AA003FF4B4 /* Predicate.cpp */; }; - 276E5F731CDB57AA003FF4B4 /* Predicate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 276E5CD01CDB57AA003FF4B4 /* Predicate.cpp */; }; 276E5F741CDB57AA003FF4B4 /* Predicate.h in Headers */ = {isa = PBXBuildFile; fileRef = 276E5CD11CDB57AA003FF4B4 /* Predicate.h */; }; 276E5F751CDB57AA003FF4B4 /* Predicate.h in Headers */ = {isa = PBXBuildFile; fileRef = 276E5CD11CDB57AA003FF4B4 /* Predicate.h */; }; 276E5F761CDB57AA003FF4B4 /* Predicate.h in Headers */ = {isa = PBXBuildFile; fileRef = 276E5CD11CDB57AA003FF4B4 /* Predicate.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -684,15 +675,9 @@ 276E5FCE1CDB57AA003FF4B4 /* Token.h in Headers */ = {isa = PBXBuildFile; fileRef = 276E5CF01CDB57AA003FF4B4 /* Token.h */; }; 276E5FCF1CDB57AA003FF4B4 /* Token.h in Headers */ = {isa = PBXBuildFile; fileRef = 276E5CF01CDB57AA003FF4B4 /* Token.h */; }; 276E5FD01CDB57AA003FF4B4 /* Token.h in Headers */ = {isa = PBXBuildFile; fileRef = 276E5CF01CDB57AA003FF4B4 /* Token.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 276E5FD11CDB57AA003FF4B4 /* TokenFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 276E5CF11CDB57AA003FF4B4 /* TokenFactory.cpp */; }; - 276E5FD21CDB57AA003FF4B4 /* TokenFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 276E5CF11CDB57AA003FF4B4 /* TokenFactory.cpp */; }; - 276E5FD31CDB57AA003FF4B4 /* TokenFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 276E5CF11CDB57AA003FF4B4 /* TokenFactory.cpp */; }; 276E5FD41CDB57AA003FF4B4 /* TokenFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 276E5CF21CDB57AA003FF4B4 /* TokenFactory.h */; }; 276E5FD51CDB57AA003FF4B4 /* TokenFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 276E5CF21CDB57AA003FF4B4 /* TokenFactory.h */; }; 276E5FD61CDB57AA003FF4B4 /* TokenFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 276E5CF21CDB57AA003FF4B4 /* TokenFactory.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 276E5FD71CDB57AA003FF4B4 /* TokenSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 276E5CF31CDB57AA003FF4B4 /* TokenSource.cpp */; }; - 276E5FD81CDB57AA003FF4B4 /* TokenSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 276E5CF31CDB57AA003FF4B4 /* TokenSource.cpp */; }; - 276E5FD91CDB57AA003FF4B4 /* TokenSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 276E5CF31CDB57AA003FF4B4 /* TokenSource.cpp */; }; 276E5FDA1CDB57AA003FF4B4 /* TokenSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 276E5CF41CDB57AA003FF4B4 /* TokenSource.h */; }; 276E5FDB1CDB57AA003FF4B4 /* TokenSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 276E5CF41CDB57AA003FF4B4 /* TokenSource.h */; }; 276E5FDC1CDB57AA003FF4B4 /* TokenSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 276E5CF41CDB57AA003FF4B4 /* TokenSource.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -723,15 +708,9 @@ 276E5FF51CDB57AA003FF4B4 /* ParseTree.h in Headers */ = {isa = PBXBuildFile; fileRef = 276E5CFE1CDB57AA003FF4B4 /* ParseTree.h */; }; 276E5FF61CDB57AA003FF4B4 /* ParseTree.h in Headers */ = {isa = PBXBuildFile; fileRef = 276E5CFE1CDB57AA003FF4B4 /* ParseTree.h */; }; 276E5FF71CDB57AA003FF4B4 /* ParseTree.h in Headers */ = {isa = PBXBuildFile; fileRef = 276E5CFE1CDB57AA003FF4B4 /* ParseTree.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 276E5FF81CDB57AA003FF4B4 /* ParseTreeListener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 276E5CFF1CDB57AA003FF4B4 /* ParseTreeListener.cpp */; }; - 276E5FF91CDB57AA003FF4B4 /* ParseTreeListener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 276E5CFF1CDB57AA003FF4B4 /* ParseTreeListener.cpp */; }; - 276E5FFA1CDB57AA003FF4B4 /* ParseTreeListener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 276E5CFF1CDB57AA003FF4B4 /* ParseTreeListener.cpp */; }; 276E5FFB1CDB57AA003FF4B4 /* ParseTreeListener.h in Headers */ = {isa = PBXBuildFile; fileRef = 276E5D001CDB57AA003FF4B4 /* ParseTreeListener.h */; }; 276E5FFC1CDB57AA003FF4B4 /* ParseTreeListener.h in Headers */ = {isa = PBXBuildFile; fileRef = 276E5D001CDB57AA003FF4B4 /* ParseTreeListener.h */; }; 276E5FFD1CDB57AA003FF4B4 /* ParseTreeListener.h in Headers */ = {isa = PBXBuildFile; fileRef = 276E5D001CDB57AA003FF4B4 /* ParseTreeListener.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 276E5FFE1CDB57AA003FF4B4 /* ParseTreeProperty.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 276E5D011CDB57AA003FF4B4 /* ParseTreeProperty.cpp */; }; - 276E5FFF1CDB57AA003FF4B4 /* ParseTreeProperty.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 276E5D011CDB57AA003FF4B4 /* ParseTreeProperty.cpp */; }; - 276E60001CDB57AA003FF4B4 /* ParseTreeProperty.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 276E5D011CDB57AA003FF4B4 /* ParseTreeProperty.cpp */; }; 276E60011CDB57AA003FF4B4 /* ParseTreeProperty.h in Headers */ = {isa = PBXBuildFile; fileRef = 276E5D021CDB57AA003FF4B4 /* ParseTreeProperty.h */; }; 276E60021CDB57AA003FF4B4 /* ParseTreeProperty.h in Headers */ = {isa = PBXBuildFile; fileRef = 276E5D021CDB57AA003FF4B4 /* ParseTreeProperty.h */; }; 276E60031CDB57AA003FF4B4 /* ParseTreeProperty.h in Headers */ = {isa = PBXBuildFile; fileRef = 276E5D021CDB57AA003FF4B4 /* ParseTreeProperty.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -837,9 +816,6 @@ 276E606D1CDB57AA003FF4B4 /* VocabularyImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 276E5D281CDB57AA003FF4B4 /* VocabularyImpl.h */; }; 276E606E1CDB57AA003FF4B4 /* VocabularyImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 276E5D281CDB57AA003FF4B4 /* VocabularyImpl.h */; }; 276E606F1CDB57AA003FF4B4 /* VocabularyImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 276E5D281CDB57AA003FF4B4 /* VocabularyImpl.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 276E60701CDB57AA003FF4B4 /* WritableToken.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 276E5D291CDB57AA003FF4B4 /* WritableToken.cpp */; }; - 276E60711CDB57AA003FF4B4 /* WritableToken.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 276E5D291CDB57AA003FF4B4 /* WritableToken.cpp */; }; - 276E60721CDB57AA003FF4B4 /* WritableToken.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 276E5D291CDB57AA003FF4B4 /* WritableToken.cpp */; }; 276E60731CDB57AA003FF4B4 /* WritableToken.h in Headers */ = {isa = PBXBuildFile; fileRef = 276E5D2A1CDB57AA003FF4B4 /* WritableToken.h */; }; 276E60741CDB57AA003FF4B4 /* WritableToken.h in Headers */ = {isa = PBXBuildFile; fileRef = 276E5D2A1CDB57AA003FF4B4 /* WritableToken.h */; }; 276E60751CDB57AA003FF4B4 /* WritableToken.h in Headers */ = {isa = PBXBuildFile; fileRef = 276E5D2A1CDB57AA003FF4B4 /* WritableToken.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -883,7 +859,6 @@ 276E5C281CDB57AA003FF4B4 /* ATNSimulator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATNSimulator.h; sourceTree = ""; }; 276E5C291CDB57AA003FF4B4 /* ATNState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ATNState.cpp; sourceTree = ""; }; 276E5C2A1CDB57AA003FF4B4 /* ATNState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATNState.h; sourceTree = ""; }; - 276E5C2B1CDB57AA003FF4B4 /* ATNType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ATNType.cpp; sourceTree = ""; }; 276E5C2C1CDB57AA003FF4B4 /* ATNType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATNType.h; sourceTree = ""; }; 276E5C2D1CDB57AA003FF4B4 /* AtomTransition.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AtomTransition.cpp; sourceTree = ""; }; 276E5C2E1CDB57AA003FF4B4 /* AtomTransition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AtomTransition.h; sourceTree = ""; }; @@ -912,7 +887,6 @@ 276E5C451CDB57AA003FF4B4 /* LexerAction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LexerAction.h; sourceTree = ""; }; 276E5C461CDB57AA003FF4B4 /* LexerActionExecutor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LexerActionExecutor.cpp; sourceTree = ""; }; 276E5C471CDB57AA003FF4B4 /* LexerActionExecutor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LexerActionExecutor.h; sourceTree = ""; }; - 276E5C481CDB57AA003FF4B4 /* LexerActionType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LexerActionType.cpp; sourceTree = ""; }; 276E5C491CDB57AA003FF4B4 /* LexerActionType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LexerActionType.h; sourceTree = ""; }; 276E5C4A1CDB57AA003FF4B4 /* LexerATNConfig.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LexerATNConfig.cpp; sourceTree = ""; wrapsLines = 0; }; 276E5C4B1CDB57AA003FF4B4 /* LexerATNConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LexerATNConfig.h; sourceTree = ""; }; @@ -960,7 +934,7 @@ 276E5C761CDB57AA003FF4B4 /* PredicateEvalInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PredicateEvalInfo.h; sourceTree = ""; }; 276E5C771CDB57AA003FF4B4 /* PredicateTransition.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PredicateTransition.cpp; sourceTree = ""; }; 276E5C781CDB57AA003FF4B4 /* PredicateTransition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PredicateTransition.h; sourceTree = ""; }; - 276E5C791CDB57AA003FF4B4 /* PredictionContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PredictionContext.cpp; sourceTree = ""; }; + 276E5C791CDB57AA003FF4B4 /* PredictionContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PredictionContext.cpp; sourceTree = ""; wrapsLines = 0; }; 276E5C7A1CDB57AA003FF4B4 /* PredictionContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PredictionContext.h; sourceTree = ""; }; 276E5C7B1CDB57AA003FF4B4 /* PredictionMode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PredictionMode.cpp; sourceTree = ""; }; 276E5C7C1CDB57AA003FF4B4 /* PredictionMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PredictionMode.h; sourceTree = ""; }; @@ -1037,7 +1011,7 @@ 276E5CC41CDB57AA003FF4B4 /* LexerInterpreter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LexerInterpreter.h; sourceTree = ""; }; 276E5CC51CDB57AA003FF4B4 /* LexerNoViableAltException.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LexerNoViableAltException.cpp; sourceTree = ""; }; 276E5CC61CDB57AA003FF4B4 /* LexerNoViableAltException.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LexerNoViableAltException.h; sourceTree = ""; }; - 276E5CC71CDB57AA003FF4B4 /* ListTokenSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ListTokenSource.cpp; sourceTree = ""; }; + 276E5CC71CDB57AA003FF4B4 /* ListTokenSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ListTokenSource.cpp; sourceTree = ""; wrapsLines = 0; }; 276E5CC81CDB57AA003FF4B4 /* ListTokenSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ListTokenSource.h; sourceTree = ""; }; 276E5CCA1CDB57AA003FF4B4 /* Interval.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Interval.cpp; sourceTree = ""; }; 276E5CCB1CDB57AA003FF4B4 /* Interval.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Interval.h; sourceTree = ""; }; @@ -1045,7 +1019,6 @@ 276E5CCD1CDB57AA003FF4B4 /* IntervalSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IntervalSet.h; sourceTree = ""; }; 276E5CCE1CDB57AA003FF4B4 /* MurmurHash.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MurmurHash.cpp; sourceTree = ""; }; 276E5CCF1CDB57AA003FF4B4 /* MurmurHash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MurmurHash.h; sourceTree = ""; }; - 276E5CD01CDB57AA003FF4B4 /* Predicate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Predicate.cpp; sourceTree = ""; }; 276E5CD11CDB57AA003FF4B4 /* Predicate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Predicate.h; sourceTree = ""; }; 276E5CD21CDB57AA003FF4B4 /* TestRig.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestRig.cpp; sourceTree = ""; }; 276E5CD31CDB57AA003FF4B4 /* TestRig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestRig.h; sourceTree = ""; }; @@ -1077,9 +1050,7 @@ 276E5CEE1CDB57AA003FF4B4 /* Strings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Strings.h; sourceTree = ""; }; 276E5CEF1CDB57AA003FF4B4 /* Token.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Token.cpp; sourceTree = ""; }; 276E5CF01CDB57AA003FF4B4 /* Token.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Token.h; sourceTree = ""; }; - 276E5CF11CDB57AA003FF4B4 /* TokenFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TokenFactory.cpp; sourceTree = ""; }; 276E5CF21CDB57AA003FF4B4 /* TokenFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TokenFactory.h; sourceTree = ""; }; - 276E5CF31CDB57AA003FF4B4 /* TokenSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TokenSource.cpp; sourceTree = ""; }; 276E5CF41CDB57AA003FF4B4 /* TokenSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TokenSource.h; sourceTree = ""; }; 276E5CF51CDB57AA003FF4B4 /* TokenStream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TokenStream.cpp; sourceTree = ""; }; 276E5CF61CDB57AA003FF4B4 /* TokenStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TokenStream.h; sourceTree = ""; }; @@ -1090,9 +1061,7 @@ 276E5CFC1CDB57AA003FF4B4 /* ErrorNodeImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ErrorNodeImpl.cpp; sourceTree = ""; }; 276E5CFD1CDB57AA003FF4B4 /* ErrorNodeImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ErrorNodeImpl.h; sourceTree = ""; }; 276E5CFE1CDB57AA003FF4B4 /* ParseTree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ParseTree.h; sourceTree = ""; }; - 276E5CFF1CDB57AA003FF4B4 /* ParseTreeListener.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ParseTreeListener.cpp; sourceTree = ""; }; 276E5D001CDB57AA003FF4B4 /* ParseTreeListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ParseTreeListener.h; sourceTree = ""; }; - 276E5D011CDB57AA003FF4B4 /* ParseTreeProperty.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ParseTreeProperty.cpp; sourceTree = ""; }; 276E5D021CDB57AA003FF4B4 /* ParseTreeProperty.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ParseTreeProperty.h; sourceTree = ""; }; 276E5D031CDB57AA003FF4B4 /* ParseTreeVisitor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ParseTreeVisitor.h; sourceTree = ""; }; 276E5D041CDB57AA003FF4B4 /* ParseTreeWalker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ParseTreeWalker.cpp; sourceTree = ""; }; @@ -1128,7 +1097,6 @@ 276E5D261CDB57AA003FF4B4 /* Vocabulary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Vocabulary.h; sourceTree = ""; }; 276E5D271CDB57AA003FF4B4 /* VocabularyImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VocabularyImpl.cpp; sourceTree = ""; }; 276E5D281CDB57AA003FF4B4 /* VocabularyImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VocabularyImpl.h; sourceTree = ""; }; - 276E5D291CDB57AA003FF4B4 /* WritableToken.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WritableToken.cpp; sourceTree = ""; }; 276E5D2A1CDB57AA003FF4B4 /* WritableToken.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WritableToken.h; sourceTree = ""; }; 27874F1D1CCB7A0700AF1C53 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; }; 37C147171B4D5A04008EDDDB /* libantlrcpp_static.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libantlrcpp_static.a; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -1244,9 +1212,7 @@ 276E5CE31CDB57AA003FF4B4 /* RuleContext.h */, 276E5CEF1CDB57AA003FF4B4 /* Token.cpp */, 276E5CF01CDB57AA003FF4B4 /* Token.h */, - 276E5CF11CDB57AA003FF4B4 /* TokenFactory.cpp */, 276E5CF21CDB57AA003FF4B4 /* TokenFactory.h */, - 276E5CF31CDB57AA003FF4B4 /* TokenSource.cpp */, 276E5CF41CDB57AA003FF4B4 /* TokenSource.h */, 276E5CF51CDB57AA003FF4B4 /* TokenStream.cpp */, 276E5CF61CDB57AA003FF4B4 /* TokenStream.h */, @@ -1259,7 +1225,6 @@ 276E5D261CDB57AA003FF4B4 /* Vocabulary.h */, 276E5D271CDB57AA003FF4B4 /* VocabularyImpl.cpp */, 276E5D281CDB57AA003FF4B4 /* VocabularyImpl.h */, - 276E5D291CDB57AA003FF4B4 /* WritableToken.cpp */, 276E5D2A1CDB57AA003FF4B4 /* WritableToken.h */, ); name = runtime; @@ -1293,7 +1258,6 @@ 276E5C281CDB57AA003FF4B4 /* ATNSimulator.h */, 276E5C291CDB57AA003FF4B4 /* ATNState.cpp */, 276E5C2A1CDB57AA003FF4B4 /* ATNState.h */, - 276E5C2B1CDB57AA003FF4B4 /* ATNType.cpp */, 276E5C2C1CDB57AA003FF4B4 /* ATNType.h */, 276E5C2D1CDB57AA003FF4B4 /* AtomTransition.cpp */, 276E5C2E1CDB57AA003FF4B4 /* AtomTransition.h */, @@ -1322,7 +1286,6 @@ 276E5C451CDB57AA003FF4B4 /* LexerAction.h */, 276E5C461CDB57AA003FF4B4 /* LexerActionExecutor.cpp */, 276E5C471CDB57AA003FF4B4 /* LexerActionExecutor.h */, - 276E5C481CDB57AA003FF4B4 /* LexerActionType.cpp */, 276E5C491CDB57AA003FF4B4 /* LexerActionType.h */, 276E5C4A1CDB57AA003FF4B4 /* LexerATNConfig.cpp */, 276E5C4B1CDB57AA003FF4B4 /* LexerATNConfig.h */, @@ -1430,7 +1393,6 @@ 276E5CCD1CDB57AA003FF4B4 /* IntervalSet.h */, 276E5CCE1CDB57AA003FF4B4 /* MurmurHash.cpp */, 276E5CCF1CDB57AA003FF4B4 /* MurmurHash.h */, - 276E5CD01CDB57AA003FF4B4 /* Predicate.cpp */, 276E5CD11CDB57AA003FF4B4 /* Predicate.h */, 276E5CD21CDB57AA003FF4B4 /* TestRig.cpp */, 276E5CD31CDB57AA003FF4B4 /* TestRig.h */, @@ -1464,9 +1426,7 @@ 276E5CFC1CDB57AA003FF4B4 /* ErrorNodeImpl.cpp */, 276E5CFD1CDB57AA003FF4B4 /* ErrorNodeImpl.h */, 276E5CFE1CDB57AA003FF4B4 /* ParseTree.h */, - 276E5CFF1CDB57AA003FF4B4 /* ParseTreeListener.cpp */, 276E5D001CDB57AA003FF4B4 /* ParseTreeListener.h */, - 276E5D011CDB57AA003FF4B4 /* ParseTreeProperty.cpp */, 276E5D021CDB57AA003FF4B4 /* ParseTreeProperty.h */, 276E5D031CDB57AA003FF4B4 /* ParseTreeVisitor.h */, 276E5D041CDB57AA003FF4B4 /* ParseTreeWalker.cpp */, @@ -2141,13 +2101,11 @@ 276E5E6E1CDB57AA003FF4B4 /* PredicateTransition.cpp in Sources */, 276E5E7A1CDB57AA003FF4B4 /* PredictionMode.cpp in Sources */, 276E605D1CDB57AA003FF4B4 /* UnbufferedCharStream.cpp in Sources */, - 276E5F731CDB57AA003FF4B4 /* Predicate.cpp in Sources */, 276E5F341CDB57AA003FF4B4 /* InputMismatchException.cpp in Sources */, 276E5E741CDB57AA003FF4B4 /* PredictionContext.cpp in Sources */, 276E5E171CDB57AA003FF4B4 /* LexerPushModeAction.cpp in Sources */, 276E5DA21CDB57AA003FF4B4 /* BlockEndState.cpp in Sources */, 276E5EF21CDB57AA003FF4B4 /* CommonTokenFactory.cpp in Sources */, - 276E5DE11CDB57AA003FF4B4 /* LexerActionType.cpp in Sources */, 276E5DF31CDB57AA003FF4B4 /* LexerChannelAction.cpp in Sources */, 276E5E921CDB57AA003FF4B4 /* RuleStopState.cpp in Sources */, 276E60631CDB57AA003FF4B4 /* UnbufferedTokenStream.cpp in Sources */, @@ -2180,7 +2138,6 @@ 276E5D841CDB57AA003FF4B4 /* ATNState.cpp in Sources */, 276E5FCD1CDB57AA003FF4B4 /* Token.cpp in Sources */, 276E60241CDB57AA003FF4B4 /* RuleTagToken.cpp in Sources */, - 276E5D8A1CDB57AA003FF4B4 /* ATNType.cpp in Sources */, 276E5E501CDB57AA003FF4B4 /* ParserATNSimulator.cpp in Sources */, 276E602A1CDB57AA003FF4B4 /* TagChunk.cpp in Sources */, 276E5F7F1CDB57AA003FF4B4 /* NoViableAltException.cpp in Sources */, @@ -2190,7 +2147,6 @@ 276E5FAF1CDB57AA003FF4B4 /* Arrays.cpp in Sources */, 276E5ECE1CDB57AA003FF4B4 /* WildcardTransition.cpp in Sources */, 276E5E861CDB57AA003FF4B4 /* RangeTransition.cpp in Sources */, - 276E60721CDB57AA003FF4B4 /* WritableToken.cpp in Sources */, 276E5D7E1CDB57AA003FF4B4 /* ATNSimulator.cpp in Sources */, 276E5F791CDB57AA003FF4B4 /* TestRig.cpp in Sources */, 276E5D9C1CDB57AA003FF4B4 /* BasicState.cpp in Sources */, @@ -2220,8 +2176,6 @@ 276E5EFE1CDB57AA003FF4B4 /* ConsoleErrorListener.cpp in Sources */, 276E5EAA1CDB57AA003FF4B4 /* SingletonPredictionContext.cpp in Sources */, 276E5E681CDB57AA003FF4B4 /* PredicateEvalInfo.cpp in Sources */, - 276E5FD31CDB57AA003FF4B4 /* TokenFactory.cpp in Sources */, - 276E60001CDB57AA003FF4B4 /* ParseTreeProperty.cpp in Sources */, 276E5F281CDB57AA003FF4B4 /* Exceptions.cpp in Sources */, 276E5F851CDB57AA003FF4B4 /* Parser.cpp in Sources */, 276E5DC01CDB57AA003FF4B4 /* DecisionState.cpp in Sources */, @@ -2229,8 +2183,6 @@ 276E5EF81CDB57AA003FF4B4 /* CommonTokenStream.cpp in Sources */, 276E60121CDB57AA003FF4B4 /* ParseTreeMatch.cpp in Sources */, 276E5EEC1CDB57AA003FF4B4 /* CommonToken.cpp in Sources */, - 276E5FD91CDB57AA003FF4B4 /* TokenSource.cpp in Sources */, - 276E5FFA1CDB57AA003FF4B4 /* ParseTreeListener.cpp in Sources */, 276E5D901CDB57AA003FF4B4 /* AtomTransition.cpp in Sources */, 276E5E0B1CDB57AA003FF4B4 /* LexerMoreAction.cpp in Sources */, 276E5F3A1CDB57AA003FF4B4 /* InterpreterRuleContext.cpp in Sources */, @@ -2278,13 +2230,11 @@ 276E5E6D1CDB57AA003FF4B4 /* PredicateTransition.cpp in Sources */, 276E5E791CDB57AA003FF4B4 /* PredictionMode.cpp in Sources */, 276E605C1CDB57AA003FF4B4 /* UnbufferedCharStream.cpp in Sources */, - 276E5F721CDB57AA003FF4B4 /* Predicate.cpp in Sources */, 276E5F331CDB57AA003FF4B4 /* InputMismatchException.cpp in Sources */, 276E5E731CDB57AA003FF4B4 /* PredictionContext.cpp in Sources */, 276E5E161CDB57AA003FF4B4 /* LexerPushModeAction.cpp in Sources */, 276E5DA11CDB57AA003FF4B4 /* BlockEndState.cpp in Sources */, 276E5EF11CDB57AA003FF4B4 /* CommonTokenFactory.cpp in Sources */, - 276E5DE01CDB57AA003FF4B4 /* LexerActionType.cpp in Sources */, 276E5DF21CDB57AA003FF4B4 /* LexerChannelAction.cpp in Sources */, 276E5E911CDB57AA003FF4B4 /* RuleStopState.cpp in Sources */, 276E60621CDB57AA003FF4B4 /* UnbufferedTokenStream.cpp in Sources */, @@ -2317,7 +2267,6 @@ 276E5D831CDB57AA003FF4B4 /* ATNState.cpp in Sources */, 276E5FCC1CDB57AA003FF4B4 /* Token.cpp in Sources */, 276E60231CDB57AA003FF4B4 /* RuleTagToken.cpp in Sources */, - 276E5D891CDB57AA003FF4B4 /* ATNType.cpp in Sources */, 276E5E4F1CDB57AA003FF4B4 /* ParserATNSimulator.cpp in Sources */, 276E60291CDB57AA003FF4B4 /* TagChunk.cpp in Sources */, 276E5F7E1CDB57AA003FF4B4 /* NoViableAltException.cpp in Sources */, @@ -2327,7 +2276,6 @@ 276E5FAE1CDB57AA003FF4B4 /* Arrays.cpp in Sources */, 276E5ECD1CDB57AA003FF4B4 /* WildcardTransition.cpp in Sources */, 276E5E851CDB57AA003FF4B4 /* RangeTransition.cpp in Sources */, - 276E60711CDB57AA003FF4B4 /* WritableToken.cpp in Sources */, 276E5D7D1CDB57AA003FF4B4 /* ATNSimulator.cpp in Sources */, 276E5F781CDB57AA003FF4B4 /* TestRig.cpp in Sources */, 276E5D9B1CDB57AA003FF4B4 /* BasicState.cpp in Sources */, @@ -2357,8 +2305,6 @@ 276E5EFD1CDB57AA003FF4B4 /* ConsoleErrorListener.cpp in Sources */, 276E5EA91CDB57AA003FF4B4 /* SingletonPredictionContext.cpp in Sources */, 276E5E671CDB57AA003FF4B4 /* PredicateEvalInfo.cpp in Sources */, - 276E5FD21CDB57AA003FF4B4 /* TokenFactory.cpp in Sources */, - 276E5FFF1CDB57AA003FF4B4 /* ParseTreeProperty.cpp in Sources */, 276E5F271CDB57AA003FF4B4 /* Exceptions.cpp in Sources */, 276E5F841CDB57AA003FF4B4 /* Parser.cpp in Sources */, 276E5DBF1CDB57AA003FF4B4 /* DecisionState.cpp in Sources */, @@ -2366,8 +2312,6 @@ 276E5EF71CDB57AA003FF4B4 /* CommonTokenStream.cpp in Sources */, 276E60111CDB57AA003FF4B4 /* ParseTreeMatch.cpp in Sources */, 276E5EEB1CDB57AA003FF4B4 /* CommonToken.cpp in Sources */, - 276E5FD81CDB57AA003FF4B4 /* TokenSource.cpp in Sources */, - 276E5FF91CDB57AA003FF4B4 /* ParseTreeListener.cpp in Sources */, 276E5D8F1CDB57AA003FF4B4 /* AtomTransition.cpp in Sources */, 276E5E0A1CDB57AA003FF4B4 /* LexerMoreAction.cpp in Sources */, 276E5F391CDB57AA003FF4B4 /* InterpreterRuleContext.cpp in Sources */, @@ -2415,13 +2359,11 @@ 276E5E6C1CDB57AA003FF4B4 /* PredicateTransition.cpp in Sources */, 276E5E781CDB57AA003FF4B4 /* PredictionMode.cpp in Sources */, 276E605B1CDB57AA003FF4B4 /* UnbufferedCharStream.cpp in Sources */, - 276E5F711CDB57AA003FF4B4 /* Predicate.cpp in Sources */, 276E5F321CDB57AA003FF4B4 /* InputMismatchException.cpp in Sources */, 276E5E721CDB57AA003FF4B4 /* PredictionContext.cpp in Sources */, 276E5E151CDB57AA003FF4B4 /* LexerPushModeAction.cpp in Sources */, 276E5DA01CDB57AA003FF4B4 /* BlockEndState.cpp in Sources */, 276E5EF01CDB57AA003FF4B4 /* CommonTokenFactory.cpp in Sources */, - 276E5DDF1CDB57AA003FF4B4 /* LexerActionType.cpp in Sources */, 276E5DF11CDB57AA003FF4B4 /* LexerChannelAction.cpp in Sources */, 276E5E901CDB57AA003FF4B4 /* RuleStopState.cpp in Sources */, 276E60611CDB57AA003FF4B4 /* UnbufferedTokenStream.cpp in Sources */, @@ -2454,7 +2396,6 @@ 276E5D821CDB57AA003FF4B4 /* ATNState.cpp in Sources */, 276E5FCB1CDB57AA003FF4B4 /* Token.cpp in Sources */, 276E60221CDB57AA003FF4B4 /* RuleTagToken.cpp in Sources */, - 276E5D881CDB57AA003FF4B4 /* ATNType.cpp in Sources */, 276E5E4E1CDB57AA003FF4B4 /* ParserATNSimulator.cpp in Sources */, 276E60281CDB57AA003FF4B4 /* TagChunk.cpp in Sources */, 276E5F7D1CDB57AA003FF4B4 /* NoViableAltException.cpp in Sources */, @@ -2464,7 +2405,6 @@ 276E5FAD1CDB57AA003FF4B4 /* Arrays.cpp in Sources */, 276E5ECC1CDB57AA003FF4B4 /* WildcardTransition.cpp in Sources */, 276E5E841CDB57AA003FF4B4 /* RangeTransition.cpp in Sources */, - 276E60701CDB57AA003FF4B4 /* WritableToken.cpp in Sources */, 276E5D7C1CDB57AA003FF4B4 /* ATNSimulator.cpp in Sources */, 276E5F771CDB57AA003FF4B4 /* TestRig.cpp in Sources */, 276E5D9A1CDB57AA003FF4B4 /* BasicState.cpp in Sources */, @@ -2494,8 +2434,6 @@ 276E5EFC1CDB57AA003FF4B4 /* ConsoleErrorListener.cpp in Sources */, 276E5EA81CDB57AA003FF4B4 /* SingletonPredictionContext.cpp in Sources */, 276E5E661CDB57AA003FF4B4 /* PredicateEvalInfo.cpp in Sources */, - 276E5FD11CDB57AA003FF4B4 /* TokenFactory.cpp in Sources */, - 276E5FFE1CDB57AA003FF4B4 /* ParseTreeProperty.cpp in Sources */, 276E5F261CDB57AA003FF4B4 /* Exceptions.cpp in Sources */, 276E5F831CDB57AA003FF4B4 /* Parser.cpp in Sources */, 276E5DBE1CDB57AA003FF4B4 /* DecisionState.cpp in Sources */, @@ -2503,8 +2441,6 @@ 276E5EF61CDB57AA003FF4B4 /* CommonTokenStream.cpp in Sources */, 276E60101CDB57AA003FF4B4 /* ParseTreeMatch.cpp in Sources */, 276E5EEA1CDB57AA003FF4B4 /* CommonToken.cpp in Sources */, - 276E5FD71CDB57AA003FF4B4 /* TokenSource.cpp in Sources */, - 276E5FF81CDB57AA003FF4B4 /* ParseTreeListener.cpp in Sources */, 276E5D8E1CDB57AA003FF4B4 /* AtomTransition.cpp in Sources */, 276E5E091CDB57AA003FF4B4 /* LexerMoreAction.cpp in Sources */, 276E5F381CDB57AA003FF4B4 /* InterpreterRuleContext.cpp in Sources */, diff --git a/runtime/Cpp/runtime/src/ANTLRInputStream.cpp b/runtime/Cpp/runtime/src/ANTLRInputStream.cpp index 982a30fb3..7f8994e62 100755 --- a/runtime/Cpp/runtime/src/ANTLRInputStream.cpp +++ b/runtime/Cpp/runtime/src/ANTLRInputStream.cpp @@ -86,7 +86,7 @@ void ANTLRInputStream::reset() { void ANTLRInputStream::consume() { if (p >= data.size()) { - assert(LA(1) == EOF); + assert(LA(1) == IntStream::EOF); throw IllegalStateException("cannot consume EOF"); } @@ -104,12 +104,12 @@ ssize_t ANTLRInputStream::LA(ssize_t i) { if (i < 0) { i++; // e.g., translate LA(-1) to use offset i=0; then data[p+0-1] if ((position + i - 1) < 0) { - return EOF; // invalid; no char before first char + return IntStream::EOF; // invalid; no char before first char } } if ((position + i - 1) >= (ssize_t)data.size()) { - return EOF; + return IntStream::EOF; } return data[(size_t)(position + i - 1)]; diff --git a/runtime/Cpp/runtime/src/BailErrorStrategy.cpp b/runtime/Cpp/runtime/src/BailErrorStrategy.cpp index 95ad1e1c3..8a612d82e 100755 --- a/runtime/Cpp/runtime/src/BailErrorStrategy.cpp +++ b/runtime/Cpp/runtime/src/BailErrorStrategy.cpp @@ -83,5 +83,5 @@ Ref BailErrorStrategy::recoverInline(Parser *recognizer) { #endif } -void BailErrorStrategy::sync(Parser */*recognizer*/) { +void BailErrorStrategy::sync(Parser * /*recognizer*/) { } diff --git a/runtime/Cpp/runtime/src/BaseErrorListener.cpp b/runtime/Cpp/runtime/src/BaseErrorListener.cpp index 7e549420c..3629c1830 100755 --- a/runtime/Cpp/runtime/src/BaseErrorListener.cpp +++ b/runtime/Cpp/runtime/src/BaseErrorListener.cpp @@ -34,18 +34,18 @@ using namespace org::antlr::v4::runtime; -void BaseErrorListener::syntaxError(IRecognizer */*recognizer*/, Ref /*offendingSymbol*/, size_t /*line*/, +void BaseErrorListener::syntaxError(IRecognizer * /*recognizer*/, Ref /*offendingSymbol*/, size_t /*line*/, int /*charPositionInLine*/, const std::wstring &/*msg*/, std::exception_ptr /*e*/) { } -void BaseErrorListener::reportAmbiguity(Parser */*recognizer*/, const dfa::DFA &/*dfa*/, size_t /*startIndex*/, +void BaseErrorListener::reportAmbiguity(Parser * /*recognizer*/, const dfa::DFA &/*dfa*/, size_t /*startIndex*/, size_t /*stopIndex*/, bool /*exact*/, const antlrcpp::BitSet &/*ambigAlts*/, Ref /*configs*/) { } -void BaseErrorListener::reportAttemptingFullContext(Parser */*recognizer*/, const dfa::DFA &/*dfa*/, size_t /*startIndex*/, +void BaseErrorListener::reportAttemptingFullContext(Parser * /*recognizer*/, const dfa::DFA &/*dfa*/, size_t /*startIndex*/, size_t /*stopIndex*/, const antlrcpp::BitSet &/*conflictingAlts*/, Ref /*configs*/) { } -void BaseErrorListener::reportContextSensitivity(Parser */*recognizer*/, const dfa::DFA &/*dfa*/, size_t /*startIndex*/, +void BaseErrorListener::reportContextSensitivity(Parser * /*recognizer*/, const dfa::DFA &/*dfa*/, size_t /*startIndex*/, size_t /*stopIndex*/, int /*prediction*/, Ref /*configs*/) { } diff --git a/runtime/Cpp/runtime/src/BufferedTokenStream.cpp b/runtime/Cpp/runtime/src/BufferedTokenStream.cpp index b2c162133..7178e39b5 100755 --- a/runtime/Cpp/runtime/src/BufferedTokenStream.cpp +++ b/runtime/Cpp/runtime/src/BufferedTokenStream.cpp @@ -90,7 +90,7 @@ void BufferedTokenStream::consume() { skipEofCheck = false; } - if (!skipEofCheck && LA(1) == EOF) { + if (!skipEofCheck && LA(1) == Token::EOF) { throw IllegalStateException("cannot consume EOF"); } @@ -123,7 +123,7 @@ size_t BufferedTokenStream::fetch(size_t n) { (std::dynamic_pointer_cast(t))->setTokenIndex((int)_tokens.size()); } _tokens.push_back(t); - if (t->getType() == EOF) { + if (t->getType() == Token::EOF) { _fetchedEOF = true; return i + 1; } @@ -156,7 +156,7 @@ std::vector> BufferedTokenStream::get(size_t start, size_t stop) { } for (size_t i = start; i <= stop; i++) { Ref t = _tokens[i]; - if (t->getType() == EOF) { + if (t->getType() == Token::EOF) { break; } subset.push_back(t); @@ -266,7 +266,7 @@ ssize_t BufferedTokenStream::nextTokenOnChannel(size_t i, size_t channel) { Ref token = _tokens[i]; while (token->getChannel() != channel) { - if (token->getType() == EOF) { + if (token->getType() == Token::EOF) { return i; } i++; @@ -285,7 +285,7 @@ ssize_t BufferedTokenStream::previousTokenOnChannel(size_t i, size_t channel) { while (true) { Ref token = _tokens[i]; - if (token->getType() == EOF || token->getChannel() == channel) { + if (token->getType() == Token::EOF || token->getChannel() == channel) { return i; } @@ -395,7 +395,7 @@ std::wstring BufferedTokenStream::getText(const misc::Interval &interval) { std::wstringstream ss; for (size_t i = (size_t)start; i <= (size_t)stop; i++) { Ref t = _tokens[i]; - if (t->getType() == EOF) { + if (t->getType() == Token::EOF) { break; } ss << t->getText(); diff --git a/runtime/Cpp/runtime/src/CharStream.cpp b/runtime/Cpp/runtime/src/CharStream.cpp index cb2778bc0..f2529c053 100755 --- a/runtime/Cpp/runtime/src/CharStream.cpp +++ b/runtime/Cpp/runtime/src/CharStream.cpp @@ -34,4 +34,4 @@ using namespace org::antlr::v4::runtime; CharStream::~CharStream() { -}; +} diff --git a/runtime/Cpp/runtime/src/CommonTokenStream.cpp b/runtime/Cpp/runtime/src/CommonTokenStream.cpp index d38ef3f45..ff3b8760a 100755 --- a/runtime/Cpp/runtime/src/CommonTokenStream.cpp +++ b/runtime/Cpp/runtime/src/CommonTokenStream.cpp @@ -97,7 +97,7 @@ int CommonTokenStream::getNumberOfOnChannelTokens() { if (t->getChannel() == channel) { n++; } - if (t->getType() == EOF) { + if (t->getType() == Token::EOF) { break; } } diff --git a/runtime/Cpp/runtime/src/ConsoleErrorListener.cpp b/runtime/Cpp/runtime/src/ConsoleErrorListener.cpp index fa2c1dc43..c6a34981e 100755 --- a/runtime/Cpp/runtime/src/ConsoleErrorListener.cpp +++ b/runtime/Cpp/runtime/src/ConsoleErrorListener.cpp @@ -35,7 +35,7 @@ using namespace org::antlr::v4::runtime; ConsoleErrorListener ConsoleErrorListener::INSTANCE; -void ConsoleErrorListener::syntaxError(IRecognizer */*recognizer*/, Ref /*offendingSymbol*/, +void ConsoleErrorListener::syntaxError(IRecognizer * /*recognizer*/, Ref /*offendingSymbol*/, size_t line, int charPositionInLine, const std::wstring &msg, std::exception_ptr /*e*/) { std::wcerr << L"line " << line << L":" << charPositionInLine << L" " << msg << std::endl; } diff --git a/runtime/Cpp/runtime/src/DefaultErrorStrategy.cpp b/runtime/Cpp/runtime/src/DefaultErrorStrategy.cpp index 438edba05..10d0fd022 100755 --- a/runtime/Cpp/runtime/src/DefaultErrorStrategy.cpp +++ b/runtime/Cpp/runtime/src/DefaultErrorStrategy.cpp @@ -52,15 +52,15 @@ void DefaultErrorStrategy::reset(Parser *recognizer) { endErrorCondition(recognizer); } -void DefaultErrorStrategy::beginErrorCondition(Parser */*recognizer*/) { +void DefaultErrorStrategy::beginErrorCondition(Parser * /*recognizer*/) { errorRecoveryMode = true; } -bool DefaultErrorStrategy::inErrorRecoveryMode(Parser */*recognizer*/) { +bool DefaultErrorStrategy::inErrorRecoveryMode(Parser * /*recognizer*/) { return errorRecoveryMode; } -void DefaultErrorStrategy::endErrorCondition(Parser */*recognizer*/) { +void DefaultErrorStrategy::endErrorCondition(Parser * /*recognizer*/) { errorRecoveryMode = false; lastErrorIndex = -1; } @@ -120,7 +120,7 @@ void DefaultErrorStrategy::sync(Parser *recognizer) { ssize_t la = tokens->LA(1); // try cheaper subset first; might get lucky. seems to shave a wee bit off - if (recognizer->getATN().nextTokens(s).contains((int)la) || la == EOF) { + if (recognizer->getATN().nextTokens(s).contains((int)la) || la == Token::EOF) { return; } @@ -161,7 +161,7 @@ void DefaultErrorStrategy::reportNoViableAlternative(Parser *recognizer, const N TokenStream *tokens = recognizer->getTokenStream(); std::wstring input; if (tokens != nullptr) { - if (e.getStartToken()->getType() == EOF) { + if (e.getStartToken()->getType() == Token::EOF) { input = L""; } else { input = tokens->getText(e.getStartToken(), e.getOffendingToken()); @@ -270,14 +270,14 @@ Ref DefaultErrorStrategy::getMissingSymbol(Parser *recognizer) { misc::IntervalSet expecting = getExpectedTokens(recognizer); ssize_t expectedTokenType = expecting.getMinElement(); // get any element std::wstring tokenText; - if (expectedTokenType == EOF) { + if (expectedTokenType == Token::EOF) { tokenText = L""; } else { tokenText = L"getVocabulary()->getDisplayName(expectedTokenType) + L">"; } Ref current = currentSymbol; Ref lookback = recognizer->getTokenStream()->LT(-1); - if (current->getType() == EOF && lookback != nullptr) { + if (current->getType() == Token::EOF && lookback != nullptr) { current = lookback; } return std::dynamic_pointer_cast(recognizer->getTokenFactory()->create({ current->getTokenSource(), @@ -295,7 +295,7 @@ std::wstring DefaultErrorStrategy::getTokenErrorDisplay(Ref t) { } std::wstring s = getSymbolText(t); if (s == L"") { - if (getSymbolType(t) == EOF) { + if (getSymbolType(t) == Token::EOF) { s = L""; } else { s = std::wstring(L"<") + std::to_wstring(getSymbolType(t)) + std::wstring(L">"); @@ -342,7 +342,7 @@ misc::IntervalSet DefaultErrorStrategy::getErrorRecoverySet(Parser *recognizer) void DefaultErrorStrategy::consumeUntil(Parser *recognizer, const misc::IntervalSet &set) { ssize_t ttype = recognizer->getInputStream()->LA(1); - while (ttype != EOF && !set.contains((int)ttype)) { + while (ttype != Token::EOF && !set.contains((int)ttype)) { recognizer->consume(); ttype = recognizer->getInputStream()->LA(1); } diff --git a/runtime/Cpp/runtime/src/IntStream.h b/runtime/Cpp/runtime/src/IntStream.h index 58164fc30..d1392e25a 100755 --- a/runtime/Cpp/runtime/src/IntStream.h +++ b/runtime/Cpp/runtime/src/IntStream.h @@ -54,6 +54,8 @@ namespace runtime { /// class ANTLR4CPP_PUBLIC IntStream { public: + static const ssize_t EOF = -1; + /// The value returned by when the end of the stream is /// reached. /// No explicit EOF definition. We got EOF on all platforms. diff --git a/runtime/Cpp/runtime/src/Lexer.cpp b/runtime/Cpp/runtime/src/Lexer.cpp index 6fbd902a8..c3c049566 100755 --- a/runtime/Cpp/runtime/src/Lexer.cpp +++ b/runtime/Cpp/runtime/src/Lexer.cpp @@ -51,17 +51,17 @@ void Lexer::reset() { // wack Lexer state variables _input->seek(0); // rewind the input - _token.reset(); - _type = Token::INVALID_TYPE; - _channel = Token::DEFAULT_CHANNEL; - _tokenStartCharIndex = -1; - _tokenStartCharPositionInLine = -1; - _tokenStartLine = -1; - _text = L""; + token.reset(); + type = Token::INVALID_TYPE; + channel = Token::DEFAULT_CHANNEL; + tokenStartCharIndex = -1; + tokenStartCharPositionInLine = -1; + tokenStartLine = -1; + text = L""; - _hitEOF = false; - _mode = Lexer::DEFAULT_MODE; - _modeStack.clear(); + hitEOF = false; + mode = Lexer::DEFAULT_MODE; + modeStack.clear(); getInterpreter()->reset(); } @@ -79,74 +79,74 @@ Ref Lexer::nextToken() { while (true) { outerContinue: - if (_hitEOF) { + if (hitEOF) { emitEOF(); - return _token; + return token; } - _token.reset(); - _channel = Token::DEFAULT_CHANNEL; - _tokenStartCharIndex = (int)_input->index(); - _tokenStartCharPositionInLine = getInterpreter()->getCharPositionInLine(); - _tokenStartLine = (int)getInterpreter()->getLine(); - _text = L""; + token.reset(); + channel = Token::DEFAULT_CHANNEL; + tokenStartCharIndex = (int)_input->index(); + tokenStartCharPositionInLine = getInterpreter()->getCharPositionInLine(); + tokenStartLine = (int)getInterpreter()->getLine(); + text = L""; do { - _type = Token::INVALID_TYPE; + type = Token::INVALID_TYPE; int ttype; try { - ttype = getInterpreter()->match(_input, (size_t)_mode); + ttype = getInterpreter()->match(_input, mode); } catch (LexerNoViableAltException &e) { notifyListeners(e); // report error recover(e); ttype = SKIP; } if (_input->LA(1) == EOF) { - _hitEOF = true; + hitEOF = true; } - if (_type == Token::INVALID_TYPE) { - _type = ttype; + if (type == Token::INVALID_TYPE) { + type = ttype; } - if (_type == SKIP) { + if (type == SKIP) { goto outerContinue; } - } while (_type == MORE); - if (_token == nullptr) { + } while (type == MORE); + if (token == nullptr) { emit(); } - return _token; + return token; } } void Lexer::skip() { - _type = SKIP; + type = SKIP; } void Lexer::more() { - _type = MORE; + type = MORE; } -void Lexer::mode(int m) { - _mode = m; +void Lexer::setMode(size_t m) { + mode = m; } -void Lexer::pushMode(int m) { +void Lexer::pushMode(size_t m) { if (atn::LexerATNSimulator::debug) { std::wcout << std::wstring(L"pushMode ") << m << std::endl; } - _modeStack.push_back(_mode); - mode(m); + modeStack.push_back(mode); + setMode(m); } -int Lexer::popMode() { - if (_modeStack.empty()) { +size_t Lexer::popMode() { + if (modeStack.empty()) { throw EmptyStackException(); } if (atn::LexerATNSimulator::debug) { - std::wcout << std::wstring(L"popMode back to ") << _modeStack.back() << std::endl; + std::wcout << std::wstring(L"popMode back to ") << modeStack.back() << std::endl; } - mode(_modeStack.back()); - _modeStack.pop_back(); - return _mode; + setMode(modeStack.back()); + modeStack.pop_back(); + return mode; } @@ -168,12 +168,12 @@ CharStream* Lexer::getInputStream() { } void Lexer::emit(Ref token) { - _token = token; + this->token = token; } Ref Lexer::emit() { - Ref t = std::dynamic_pointer_cast(_factory->create({ this, _input }, _type, _text, _channel, - _tokenStartCharIndex, getCharIndex() - 1, _tokenStartLine, _tokenStartCharPositionInLine)); + Ref t = std::dynamic_pointer_cast(_factory->create({ this, _input }, (int)type, text, channel, + tokenStartCharIndex, getCharIndex() - 1, (int)tokenStartLine, tokenStartCharPositionInLine)); emit(t); return t; } @@ -208,38 +208,38 @@ int Lexer::getCharIndex() { } std::wstring Lexer::getText() { - if (_text != L"") { - return _text; + if (!text.empty()) { + return text; } return getInterpreter()->getText(_input); } void Lexer::setText(const std::wstring &text) { - this->_text = text; + this->text = text; } Ref Lexer::getToken() { - return _token; + return token; } void Lexer::setToken(Ref token) { - _token = token; + this->token = token; } -void Lexer::setType(int ttype) { - _type = ttype; +void Lexer::setType(ssize_t ttype) { + type = ttype; } -int Lexer::getType() { - return _type; +ssize_t Lexer::getType() { + return type; } void Lexer::setChannel(int channel) { - _channel = channel; + this->channel = channel; } int Lexer::getChannel() { - return _channel; + return channel; } std::vector> Lexer::getAllTokens() { @@ -260,11 +260,11 @@ void Lexer::recover(const LexerNoViableAltException &/*e*/) { } void Lexer::notifyListeners(const LexerNoViableAltException &e) { - std::wstring text = _input->getText(misc::Interval(_tokenStartCharIndex, (int)_input->index())); + std::wstring text = _input->getText(misc::Interval(tokenStartCharIndex, (int)_input->index())); std::wstring msg = std::wstring(L"token recognition error at: '") + getErrorDisplay(text) + std::wstring(L"'"); ProxyErrorListener &listener = getErrorListenerDispatch(); - listener.syntaxError(this, nullptr, (size_t)_tokenStartLine, _tokenStartCharPositionInLine, msg, + listener.syntaxError(this, nullptr, tokenStartLine, tokenStartCharPositionInLine, msg, std::make_exception_ptr(e)); } @@ -303,19 +303,19 @@ std::wstring Lexer::getCharErrorDisplay(int c) { return std::wstring(L"'") + s + std::wstring(L"'"); } -void Lexer::recover(RecognitionException */*re*/) { +void Lexer::recover(RecognitionException * /*re*/) { // TO_DO: Do we lose character or line position information? _input->consume(); } void Lexer::InitializeInstanceFields() { - _token = nullptr; + token = nullptr; _factory = CommonTokenFactory::DEFAULT; - _tokenStartCharIndex = -1; - _tokenStartLine = 0; - _tokenStartCharPositionInLine = 0; - _hitEOF = false; - _channel = 0; - _type = 0; - _mode = Lexer::DEFAULT_MODE; + tokenStartCharIndex = -1; + tokenStartLine = 0; + tokenStartCharPositionInLine = 0; + hitEOF = false; + channel = 0; + type = 0; + mode = Lexer::DEFAULT_MODE; } diff --git a/runtime/Cpp/runtime/src/Lexer.h b/runtime/Cpp/runtime/src/Lexer.h index 4e1c5d5c1..75f7e7c32 100755 --- a/runtime/Cpp/runtime/src/Lexer.h +++ b/runtime/Cpp/runtime/src/Lexer.h @@ -70,44 +70,44 @@ namespace runtime { /// emissions, then set this to the last token to be matched or /// something nonnull so that the auto token emit mechanism will not /// emit another token. - Ref _token; + Ref token; /// /// What character index in the stream did the current token start at? /// Needed, for example, to get the text for current token. Set at /// the start of nextToken. /// - int _tokenStartCharIndex; + int tokenStartCharIndex; /// /// The line on which the first character of the token resides - int _tokenStartLine; + size_t tokenStartLine; /// /// The character position of first character within the line - int _tokenStartCharPositionInLine; + int tokenStartCharPositionInLine; /// /// Once we see EOF on char stream, next token will be EOF. /// If you have DONE : EOF ; then you see DONE EOF. /// - bool _hitEOF; + bool hitEOF; /// /// The channel number for the current token - int _channel; + int channel; /// /// The token type for the current token - int _type; + ssize_t type; // Use the vector as a stack. - std::vector _modeStack; - int _mode; + std::vector modeStack; + size_t mode; /// You can set the text for the current token to override what is in /// the input char buffer. Use setText() or can set this instance var. - std::wstring _text; + std::wstring text; Lexer(CharStream *input); @@ -123,9 +123,9 @@ namespace runtime { /// and emits it. virtual void skip(); virtual void more(); - virtual void mode(int m); - virtual void pushMode(int m); - virtual int popMode(); + virtual void setMode(size_t m); + virtual void pushMode(size_t m); + virtual size_t popMode(); template void setTokenFactory(TokenFactory *factory) { @@ -191,9 +191,9 @@ namespace runtime { virtual void setToken(Ref token); - virtual void setType(int ttype); + virtual void setType(ssize_t ttype); - virtual int getType(); + virtual ssize_t getType(); virtual void setChannel(int channel); diff --git a/runtime/Cpp/runtime/src/ListTokenSource.cpp b/runtime/Cpp/runtime/src/ListTokenSource.cpp index a09358559..0c50ab376 100755 --- a/runtime/Cpp/runtime/src/ListTokenSource.cpp +++ b/runtime/Cpp/runtime/src/ListTokenSource.cpp @@ -74,7 +74,7 @@ Ref ListTokenSource::nextToken() { } int stop = std::max(-1, start - 1); - eofToken = std::dynamic_pointer_cast(_factory->create({ this, getInputStream() }, EOF, L"EOF", + eofToken = std::dynamic_pointer_cast(_factory->create({ this, getInputStream() }, Token::EOF, L"EOF", Token::DEFAULT_CHANNEL, start, stop, (int)getLine(), getCharPositionInLine())); } @@ -82,7 +82,7 @@ Ref ListTokenSource::nextToken() { } Ref t = tokens[i]; - if (i == tokens.size() - 1 && t->getType() == EOF) { + if (i == tokens.size() - 1 && t->getType() == Token::EOF) { eofToken = t; } diff --git a/runtime/Cpp/runtime/src/Recognizer.h b/runtime/Cpp/runtime/src/Recognizer.h index b358b406f..ee6c03db1 100755 --- a/runtime/Cpp/runtime/src/Recognizer.h +++ b/runtime/Cpp/runtime/src/Recognizer.h @@ -41,6 +41,8 @@ namespace runtime { class ANTLR4CPP_PUBLIC Recognizer : public IRecognizer { public: + static const ssize_t EOF = -1; + Recognizer(); virtual ~Recognizer() {}; diff --git a/runtime/Cpp/runtime/src/RuleContext.cpp b/runtime/Cpp/runtime/src/RuleContext.cpp index d188ef194..1b963dd6b 100755 --- a/runtime/Cpp/runtime/src/RuleContext.cpp +++ b/runtime/Cpp/runtime/src/RuleContext.cpp @@ -164,7 +164,7 @@ std::wstring RuleContext::toString(const std::vector &ruleNames, R std::wstring RuleContext::toString() { return toString(nullptr); -}; +} std::wstring RuleContext::toString(Recognizer *recog) { return toString(recog, ParserRuleContext::EMPTY); diff --git a/runtime/Cpp/runtime/src/Token.h b/runtime/Cpp/runtime/src/Token.h index ac8254bd2..c841d5f90 100755 --- a/runtime/Cpp/runtime/src/Token.h +++ b/runtime/Cpp/runtime/src/Token.h @@ -47,17 +47,12 @@ namespace runtime { public: static const size_t INVALID_TYPE = 0; - /// /// During lookahead operations, this "token" signifies we hit rule end ATN state /// and did not follow it despite needing to. - /// static const ssize_t EPSILON = -2; - static const size_t MIN_USER_TOKEN_TYPE = 1; + static const ssize_t EOF = IntStream::EOF; - //static const size_t _EOF = IntStream::_EOF; no need to define another EOF. - - // This isn't necessary virtual ~Token() {}; /// diff --git a/runtime/Cpp/runtime/src/TokenFactory.cpp b/runtime/Cpp/runtime/src/TokenFactory.cpp deleted file mode 100755 index 8e5fae024..000000000 --- a/runtime/Cpp/runtime/src/TokenFactory.cpp +++ /dev/null @@ -1,34 +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 "TokenFactory.h" - -using namespace org::antlr::v4::runtime; diff --git a/runtime/Cpp/runtime/src/TokenFactory.h b/runtime/Cpp/runtime/src/TokenFactory.h index 44ad989ad..ccc21f04f 100755 --- a/runtime/Cpp/runtime/src/TokenFactory.h +++ b/runtime/Cpp/runtime/src/TokenFactory.h @@ -47,7 +47,7 @@ namespace runtime { /// This is the method used to create tokens in the lexer and in the /// error handling strategy. If text!=null, than the start and stop positions /// are wiped to -1 in the text override is set in the CommonToken. - virtual Ref create(std::pair source, int type, const std::wstring &text, + virtual Ref create(std::pair source, int type, const std::wstring &text, int channel, int start, int stop, int line, int charPositionInLine) = 0; /// Generically useful diff --git a/runtime/Cpp/runtime/src/TokenSource.cpp b/runtime/Cpp/runtime/src/TokenSource.cpp deleted file mode 100755 index 1b677b749..000000000 --- a/runtime/Cpp/runtime/src/TokenSource.cpp +++ /dev/null @@ -1,34 +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 "TokenSource.h" - -using namespace org::antlr::v4::runtime; diff --git a/runtime/Cpp/runtime/src/TokenSource.h b/runtime/Cpp/runtime/src/TokenSource.h index d0eadc368..abcc9cf53 100755 --- a/runtime/Cpp/runtime/src/TokenSource.h +++ b/runtime/Cpp/runtime/src/TokenSource.h @@ -101,7 +101,7 @@ namespace runtime { /// /// The to use for creating tokens. template - void setTokenFactory(TokenFactory */*factory*/) {}; + void setTokenFactory(TokenFactory * /*factory*/) {} /// /// Gets the this token source is currently using for diff --git a/runtime/Cpp/runtime/src/TokenStreamRewriter.cpp b/runtime/Cpp/runtime/src/TokenStreamRewriter.cpp index e2f7fdcd1..f9d4971eb 100755 --- a/runtime/Cpp/runtime/src/TokenStreamRewriter.cpp +++ b/runtime/Cpp/runtime/src/TokenStreamRewriter.cpp @@ -56,7 +56,7 @@ TokenStreamRewriter::RewriteOperation::RewriteOperation(TokenStreamRewriter *out this->text = text; } -size_t TokenStreamRewriter::RewriteOperation::execute(std::wstring */*buf*/) { +size_t TokenStreamRewriter::RewriteOperation::execute(std::wstring * /*buf*/) { return index; } @@ -78,7 +78,7 @@ TokenStreamRewriter::InsertBeforeOp::InsertBeforeOp(TokenStreamRewriter *outerIn size_t TokenStreamRewriter::InsertBeforeOp::execute(std::wstring *buf) { buf->append(text); - if (outerInstance->tokens->get(index)->getType() != EOF) { + if (outerInstance->tokens->get(index)->getType() != Token::EOF) { buf->append(outerInstance->tokens->get(index)->getText()); } return index + 1; @@ -306,7 +306,7 @@ std::wstring TokenStreamRewriter::getText(const std::wstring &programName, const Ref t = tokens->get(i); if (op == nullptr) { // no operation at that index, just dump token - if (t->getType() != EOF) { + if (t->getType() != Token::EOF) { buf.append(t->getText()); } i++; // move to next token diff --git a/runtime/Cpp/runtime/src/TokenStreamRewriter.h b/runtime/Cpp/runtime/src/TokenStreamRewriter.h index 8138be3f2..96383b8e0 100755 --- a/runtime/Cpp/runtime/src/TokenStreamRewriter.h +++ b/runtime/Cpp/runtime/src/TokenStreamRewriter.h @@ -314,7 +314,7 @@ namespace runtime { /// /// Get all operations before an index of a particular kind template - std::vector getKindOfOps(std::vector rewrites, T */*kind*/, size_t before) { + std::vector getKindOfOps(std::vector rewrites, T * /*kind*/, size_t before) { std::vector ops = std::vector(); for (size_t i = 0; i < before && i < rewrites.size(); i++) { TokenStreamRewriter::RewriteOperation *op = dynamic_cast(rewrites[i]); diff --git a/runtime/Cpp/runtime/src/VocabularyImpl.cpp b/runtime/Cpp/runtime/src/VocabularyImpl.cpp index e88968b07..efb5518e2 100755 --- a/runtime/Cpp/runtime/src/VocabularyImpl.cpp +++ b/runtime/Cpp/runtime/src/VocabularyImpl.cpp @@ -29,6 +29,8 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include "Token.h" + #include "VocabularyImpl.h" using namespace org::antlr::v4::runtime::dfa; @@ -99,7 +101,7 @@ std::wstring VocabularyImpl::getSymbolicName(ssize_t tokenType) const { return _symbolicNames[tokenType]; } - if (tokenType == EOF) { + if (tokenType == Token::EOF) { return L"EOF"; } diff --git a/runtime/Cpp/runtime/src/WritableToken.cpp b/runtime/Cpp/runtime/src/WritableToken.cpp deleted file mode 100755 index 10f52313a..000000000 --- a/runtime/Cpp/runtime/src/WritableToken.cpp +++ /dev/null @@ -1,34 +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 "WritableToken.h" - -using namespace org::antlr::v4::runtime; diff --git a/runtime/Cpp/runtime/src/antlrcpp-Prefix.h b/runtime/Cpp/runtime/src/antlrcpp-Prefix.h index ab97ee93d..c2872c1ea 100644 --- a/runtime/Cpp/runtime/src/antlrcpp-Prefix.h +++ b/runtime/Cpp/runtime/src/antlrcpp-Prefix.h @@ -115,4 +115,10 @@ #endif #endif +// We have to undefine this symbol as ANTLR will use this name for own members and even +// generated functions. Because EOF is a global macro we cannot use e.g. a namespace scope to disambiguate. +#ifdef EOF +#undef EOF +#endif + template using Ref = std::shared_ptr; diff --git a/runtime/Cpp/runtime/src/atn/ATN.cpp b/runtime/Cpp/runtime/src/atn/ATN.cpp index 267615727..4ba7c84bb 100755 --- a/runtime/Cpp/runtime/src/atn/ATN.cpp +++ b/runtime/Cpp/runtime/src/atn/ATN.cpp @@ -179,7 +179,7 @@ misc::IntervalSet ATN::getExpectedTokens(int stateNumber, Ref conte } if (following.contains(Token::EPSILON)) { - expected.add(EOF); + expected.add(Token::EOF); } return expected; diff --git a/runtime/Cpp/runtime/src/atn/ATNConfigSet.cpp b/runtime/Cpp/runtime/src/atn/ATNConfigSet.cpp index d26a136f9..7f38f6419 100755 --- a/runtime/Cpp/runtime/src/atn/ATNConfigSet.cpp +++ b/runtime/Cpp/runtime/src/atn/ATNConfigSet.cpp @@ -275,7 +275,7 @@ std::wstring ATNConfigSet::toString() { return ss.str(); } -bool ATNConfigSet::remove(void */*o*/) { +bool ATNConfigSet::remove(void * /*o*/) { throw UnsupportedOperationException(); } diff --git a/runtime/Cpp/runtime/src/atn/ATNDeserializer.cpp b/runtime/Cpp/runtime/src/atn/ATNDeserializer.cpp index 7368e1082..9aaf8d8c2 100755 --- a/runtime/Cpp/runtime/src/atn/ATNDeserializer.cpp +++ b/runtime/Cpp/runtime/src/atn/ATNDeserializer.cpp @@ -231,7 +231,7 @@ ATN ATNDeserializer::deserialize(const std::wstring& input) { if (atn.grammarType == ATNType::LEXER) { int tokenType = data[p++]; if (tokenType == 0xFFFF) { - tokenType = EOF; + tokenType = Token::EOF; } atn.ruleToTokenType[i] = tokenType; @@ -626,7 +626,7 @@ Transition *ATNDeserializer::edgeFactory(const ATN &atn, int type, int /*src*/, return new EpsilonTransition(target); case Transition::RANGE : if (arg3 != 0) { - return new RangeTransition(target, EOF, arg2); + return new RangeTransition(target, Token::EOF, arg2); } else { return new RangeTransition(target, arg1, arg2); } @@ -638,7 +638,7 @@ Transition *ATNDeserializer::edgeFactory(const ATN &atn, int type, int /*src*/, return new PrecedencePredicateTransition(target, arg1); case Transition::ATOM : if (arg3 != 0) { - return new AtomTransition(target, EOF); + return new AtomTransition(target, Token::EOF); } else { return new AtomTransition(target, arg1); } diff --git a/runtime/Cpp/runtime/src/atn/ATNSerializer.cpp b/runtime/Cpp/runtime/src/atn/ATNSerializer.cpp index b82768639..42a49a096 100755 --- a/runtime/Cpp/runtime/src/atn/ATNSerializer.cpp +++ b/runtime/Cpp/runtime/src/atn/ATNSerializer.cpp @@ -161,7 +161,7 @@ std::vector ATNSerializer::serialize() { ATNState *ruleStartState = atn->ruleToStartState[r]; data.push_back((size_t)ruleStartState->stateNumber); if (atn->grammarType == ATNType::LEXER) { - if (atn->ruleToTokenType[r] == EOF) { + if (atn->ruleToTokenType[r] == Token::EOF) { data.push_back(WCHAR_MAX); } else { @@ -181,8 +181,8 @@ std::vector ATNSerializer::serialize() { size_t nsets = sets.size(); data.push_back(nsets); for (auto set : sets) { - bool containsEof = set.contains(EOF); - if (containsEof && set.getIntervals().at(0).b == EOF) { + bool containsEof = set.contains(Token::EOF); + if (containsEof && set.getIntervals().at(0).b == Token::EOF) { data.push_back(set.getIntervals().size() - 1); } else { @@ -191,8 +191,8 @@ std::vector ATNSerializer::serialize() { data.push_back(containsEof ? 1 : 0); for (auto &interval : set.getIntervals()) { - if (interval.a == EOF) { - if (interval.b == EOF) { + if (interval.a == Token::EOF) { + if (interval.b == Token::EOF) { continue; } else { data.push_back(0); @@ -255,7 +255,7 @@ std::vector ATNSerializer::serialize() { case Transition::RANGE: arg1 = (static_cast(t))->from; arg2 = (static_cast(t))->to; - if (arg1 == EOF) { + if (arg1 == Token::EOF) { arg1 = 0; arg3 = 1; } @@ -263,7 +263,7 @@ std::vector ATNSerializer::serialize() { break; case Transition::ATOM: arg1 = (static_cast(t))->_label; - if (arg1 == EOF) { + if (arg1 == Token::EOF) { arg1 = 0; arg3 = 1; } @@ -505,7 +505,7 @@ std::wstring ATNSerializer::decode(const std::wstring &inpdata) { buf.append(std::to_wstring(i)).append(L":"); bool containsEof = data[p++] != 0; if (containsEof) { - buf.append(getTokenName(EOF)); + buf.append(getTokenName(Token::EOF)); } for (int j = 0; j < nintervals; j++) { diff --git a/runtime/Cpp/runtime/src/atn/ATNState.cpp b/runtime/Cpp/runtime/src/atn/ATNState.cpp index 02d02a228..d3bf44965 100755 --- a/runtime/Cpp/runtime/src/atn/ATNState.cpp +++ b/runtime/Cpp/runtime/src/atn/ATNState.cpp @@ -46,7 +46,7 @@ ATNState::~ATNState() { for (auto transition : transitions) { delete transition; } -}; +} const std::vector ATNState::serializationNames = { L"INVALID", L"BASIC", L"RULE_START", L"BLOCK_START", diff --git a/runtime/Cpp/runtime/src/atn/ATNType.cpp b/runtime/Cpp/runtime/src/atn/ATNType.cpp deleted file mode 100755 index e12418f89..000000000 --- a/runtime/Cpp/runtime/src/atn/ATNType.cpp +++ /dev/null @@ -1,34 +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 "ATNType.h" - -using namespace org::antlr::v4::runtime::atn; diff --git a/runtime/Cpp/runtime/src/atn/LL1Analyzer.cpp b/runtime/Cpp/runtime/src/atn/LL1Analyzer.cpp index f707acbde..00a4101e4 100755 --- a/runtime/Cpp/runtime/src/atn/LL1Analyzer.cpp +++ b/runtime/Cpp/runtime/src/atn/LL1Analyzer.cpp @@ -107,7 +107,7 @@ void LL1Analyzer::_LOOK(ATNState *s, ATNState *stopState, Ref look.add(Token::EPSILON); return; } else if (ctx->isEmpty() && addEOF) { - look.add(EOF); + look.add(Token::EOF); return; } } @@ -117,7 +117,7 @@ void LL1Analyzer::_LOOK(ATNState *s, ATNState *stopState, Ref look.add(Token::EPSILON); return; } else if (ctx->isEmpty() && addEOF) { - look.add(EOF); + look.add(Token::EOF); return; } @@ -127,7 +127,7 @@ void LL1Analyzer::_LOOK(ATNState *s, ATNState *stopState, Ref ATNState *returnState = _atn.states[(size_t)ctx->getReturnState(i)]; bool removed = calledRuleStack.test((size_t)returnState->ruleIndex); - auto onExit = finally([&] { + auto onExit = finally([removed, &calledRuleStack, returnState] { if (removed) { calledRuleStack.set((size_t)returnState->ruleIndex); } @@ -150,7 +150,7 @@ void LL1Analyzer::_LOOK(ATNState *s, ATNState *stopState, Ref } Ref newContext = SingletonPredictionContext::create(ctx, (static_cast(t))->followState->stateNumber); - auto onExit = finally([&] { + auto onExit = finally([t, &calledRuleStack] { calledRuleStack[(size_t)((static_cast(t))->target->ruleIndex)] = false; }); diff --git a/runtime/Cpp/runtime/src/atn/LexerATNSimulator.cpp b/runtime/Cpp/runtime/src/atn/LexerATNSimulator.cpp index 03af7bcab..12b37b969 100755 --- a/runtime/Cpp/runtime/src/atn/LexerATNSimulator.cpp +++ b/runtime/Cpp/runtime/src/atn/LexerATNSimulator.cpp @@ -92,7 +92,7 @@ int LexerATNSimulator::match(CharStream *input, size_t mode) { _mode = mode; ssize_t mark = input->mark(); - auto onExit = finally([&] { + auto onExit = finally([input, mark] { input->release(mark); }); @@ -202,13 +202,13 @@ int LexerATNSimulator::execATN(CharStream *input, dfa::DFAState *ds0) { // capturing the accept state so the input index, line, and char // position accurately reflect the state of the interpreter at the // end of the token. - if (t != EOF) { + if (t != Token::EOF) { consume(input); } if (target->isAcceptState) { captureSimState(input, target); - if (t == EOF) { + if (t == Token::EOF) { break; } } @@ -262,8 +262,8 @@ int LexerATNSimulator::failOrAccept(CharStream *input, Ref reach, return _prevAccept.dfaState->prediction; } else { // if no accept and EOF is first char, return EOF - if (t == EOF && input->index() == (size_t)_startIndex) { - return EOF; + if (t == Token::EOF && input->index() == (size_t)_startIndex) { + return Token::EOF; } throw LexerNoViableAltException(_recog, input, (size_t)_startIndex, reach); @@ -296,7 +296,7 @@ void LexerATNSimulator::getReachableConfigSet(CharStream *input, ReffixOffsetBeforeMatch((int)input->index() - _startIndex); } - bool treatEofAsEpsilon = t == EOF; + bool treatEofAsEpsilon = t == Token::EOF; Ref config = std::make_shared(std::static_pointer_cast(c), target, lexerActionExecutor); @@ -483,7 +483,7 @@ Ref LexerATNSimulator::getEpsilonTarget(CharStream *input, Refmatches(EOF, Lexer::MIN_CHAR_VALUE, Lexer::MAX_CHAR_VALUE)) { + if (t->matches(Token::EOF, Lexer::MIN_CHAR_VALUE, Lexer::MAX_CHAR_VALUE)) { c = std::make_shared(config, t->target); break; } @@ -510,7 +510,7 @@ bool LexerATNSimulator::evaluatePredicate(CharStream *input, int ruleIndex, int size_t index = input->index(); ssize_t marker = input->mark(); - auto onExit = finally([&] { + auto onExit = finally([this, input, savedCharPositionInLine, savedLine, index, marker] { _charPositionInLine = savedCharPositionInLine; _line = savedLine; input->seek(index); diff --git a/runtime/Cpp/runtime/src/atn/LexerActionType.cpp b/runtime/Cpp/runtime/src/atn/LexerActionType.cpp deleted file mode 100755 index fbcd06d52..000000000 --- a/runtime/Cpp/runtime/src/atn/LexerActionType.cpp +++ /dev/null @@ -1,34 +0,0 @@ -/* - * [The "BSD license"] - * Copyright (c) 2016 Mike Lischke - * Copyright (c) 2013 Terence Parr - * Copyright (c) 2013 Sam Harwell - * 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 "LexerActionType.h" - -using namespace org::antlr::v4::runtime::atn; diff --git a/runtime/Cpp/runtime/src/atn/LexerModeAction.cpp b/runtime/Cpp/runtime/src/atn/LexerModeAction.cpp index d15804b85..a491b837b 100755 --- a/runtime/Cpp/runtime/src/atn/LexerModeAction.cpp +++ b/runtime/Cpp/runtime/src/atn/LexerModeAction.cpp @@ -54,7 +54,7 @@ bool LexerModeAction::isPositionDependent() const { } void LexerModeAction::execute(Lexer *lexer) { - lexer->mode(_mode); + lexer->setMode(_mode); } size_t LexerModeAction::hashCode() const { diff --git a/runtime/Cpp/runtime/src/atn/ParserATNSimulator.cpp b/runtime/Cpp/runtime/src/atn/ParserATNSimulator.cpp index 20ed94726..f908912b6 100755 --- a/runtime/Cpp/runtime/src/atn/ParserATNSimulator.cpp +++ b/runtime/Cpp/runtime/src/atn/ParserATNSimulator.cpp @@ -104,7 +104,7 @@ int ParserATNSimulator::adaptivePredict(TokenStream *input, int decision, Refseek(index); @@ -268,7 +268,7 @@ int ParserATNSimulator::execATN(dfa::DFA &dfa, dfa::DFAState *s0, TokenStream *i previousD = D; - if (t != EOF) { + if (t != Token::EOF) { input->consume(); t = input->LA(1); } @@ -424,7 +424,7 @@ int ParserATNSimulator::execATNWithFullContext(dfa::DFA &dfa, dfa::DFAState *D, } previous = reach; - if (t != EOF) { + if (t != Token::EOF) { input->consume(); t = input->LA(1); } @@ -498,7 +498,7 @@ Ref ParserATNSimulator::computeReachSet(Ref closure_ if (is(c->state)) { assert(c->context->isEmpty()); - if (fullCtx || t == EOF) { + if (fullCtx || t == Token::EOF) { skippedStopStates.push_back(c); } @@ -527,7 +527,7 @@ Ref ParserATNSimulator::computeReachSet(Ref closure_ * condition is not true when one or more configurations have been * withheld in skippedStopStates, or when the current symbol is EOF. */ - if (skippedStopStates.empty() && t != EOF) { + if (skippedStopStates.empty() && t != Token::EOF) { if (intermediate->size() == 1) { // Don't pursue the closure if there is just one state. // It can only have one alternative; just add to result @@ -548,13 +548,13 @@ Ref ParserATNSimulator::computeReachSet(Ref closure_ reach = std::make_shared(fullCtx); ATNConfig::Set closureBusy; - bool treatEofAsEpsilon = t == EOF; + bool treatEofAsEpsilon = t == Token::EOF; for (auto c : intermediate->configs) { closure(c, reach, closureBusy, false, fullCtx, treatEofAsEpsilon); } } - if (t == EOF) { + if (t == Token::EOF) { /* After consuming EOF no additional input is possible, so we are * only interested in configurations which reached the end of the * decision rule (local context) or end of the start rule (full @@ -1013,7 +1013,7 @@ Ref ParserATNSimulator::getEpsilonTarget(Ref config, Trans // EOF transitions act like epsilon transitions after the first EOF // transition is traversed if (treatEofAsEpsilon) { - if (t->matches(EOF, 0, 1)) { + if (t->matches(Token::EOF, 0, 1)) { return std::make_shared(config, t->target); } } @@ -1135,7 +1135,7 @@ BitSet ParserATNSimulator::getConflictingAltsOrUniqueAlt(Ref confi } std::wstring ParserATNSimulator::getTokenName(ssize_t t) { - if (t == EOF) { + if (t == Token::EOF) { return L"EOF"; } @@ -1270,7 +1270,7 @@ void ParserATNSimulator::reportContextSensitivity(dfa::DFA &dfa, int prediction, } } -void ParserATNSimulator::reportAmbiguity(dfa::DFA &dfa, dfa::DFAState */*D*/, size_t startIndex, size_t stopIndex, +void ParserATNSimulator::reportAmbiguity(dfa::DFA &dfa, dfa::DFAState * /*D*/, size_t startIndex, size_t stopIndex, bool exact, const antlrcpp::BitSet &ambigAlts, Ref configs) { if (debug || retry_debug) { misc::Interval interval = misc::Interval((int)startIndex, (int)stopIndex); diff --git a/runtime/Cpp/runtime/src/atn/PredictionContext.cpp b/runtime/Cpp/runtime/src/atn/PredictionContext.cpp index 9307d5489..a969a6399 100755 --- a/runtime/Cpp/runtime/src/atn/PredictionContext.cpp +++ b/runtime/Cpp/runtime/src/atn/PredictionContext.cpp @@ -76,7 +76,7 @@ Ref PredictionContext::fromRuleContext(const ATN &atn, RefhashCode()); + if (parent.expired()) + hash = MurmurHash::update(hash, 0); + else + hash = MurmurHash::update(hash, parent.lock()->hashCode()); } for (auto returnState : returnStates) { @@ -555,7 +558,7 @@ std::wstring PredictionContext::toString() const { return antlrcpp::toString(this); } -std::wstring PredictionContext::toString(Recognizer */*recog*/) const { +std::wstring PredictionContext::toString(Recognizer * /*recog*/) const { return toString(); } diff --git a/runtime/Cpp/runtime/src/atn/SemanticContext.cpp b/runtime/Cpp/runtime/src/atn/SemanticContext.cpp index 507ea32ce..76a916522 100755 --- a/runtime/Cpp/runtime/src/atn/SemanticContext.cpp +++ b/runtime/Cpp/runtime/src/atn/SemanticContext.cpp @@ -338,7 +338,7 @@ std::wstring SemanticContext::OR::toString() const { const Ref SemanticContext::NONE = std::make_shared(-1, -1, false); -Ref SemanticContext::evalPrecedence(Recognizer */*parser*/, Ref /*parserCallStack*/) { +Ref SemanticContext::evalPrecedence(Recognizer * /*parser*/, Ref /*parserCallStack*/) { return shared_from_this(); } diff --git a/runtime/Cpp/runtime/src/atn/SingletonPredictionContext.cpp b/runtime/Cpp/runtime/src/atn/SingletonPredictionContext.cpp index ebf23ed4a..d651c500a 100755 --- a/runtime/Cpp/runtime/src/atn/SingletonPredictionContext.cpp +++ b/runtime/Cpp/runtime/src/atn/SingletonPredictionContext.cpp @@ -56,11 +56,13 @@ size_t SingletonPredictionContext::size() const { std::weak_ptr SingletonPredictionContext::getParent(size_t index) const { assert(index == 0); + ((void)(index)); // Make Release build happy return parent; } int SingletonPredictionContext::getReturnState(size_t index) const { assert(index == 0); + ((void)(index)); // Make Release build happy return returnState; } diff --git a/runtime/Cpp/runtime/src/misc/IntervalSet.cpp b/runtime/Cpp/runtime/src/misc/IntervalSet.cpp index 41863a393..fa9508591 100755 --- a/runtime/Cpp/runtime/src/misc/IntervalSet.cpp +++ b/runtime/Cpp/runtime/src/misc/IntervalSet.cpp @@ -394,7 +394,7 @@ std::wstring IntervalSet::toString(bool elemAreChar) const { int a = interval.a; int b = interval.b; if (a == b) { - if (a == EOF) { + if (a == Token::EOF) { ss << L""; } else if (elemAreChar) { ss << L"'" << static_cast(a) << L"'"; @@ -462,7 +462,7 @@ std::wstring IntervalSet::elementName(const std::vector &tokenName } std::wstring IntervalSet::elementName(Ref vocabulary, ssize_t a) const { - if (a == EOF) { + if (a == Token::EOF) { return L""; } else if (a == Token::EPSILON) { return L""; diff --git a/runtime/Cpp/runtime/src/misc/Predicate.cpp b/runtime/Cpp/runtime/src/misc/Predicate.cpp deleted file mode 100755 index a36d4bce6..000000000 --- a/runtime/Cpp/runtime/src/misc/Predicate.cpp +++ /dev/null @@ -1,32 +0,0 @@ -/* - * [The "BSD license"] - * Copyright (c) 2016 Mike Lischke - * Copyright (c) 2014 Terence Parr - * Copyright (c) 2014 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 "Predicate.h" diff --git a/runtime/Cpp/runtime/src/tree/AbstractParseTreeVisitor.h b/runtime/Cpp/runtime/src/tree/AbstractParseTreeVisitor.h index 86585435c..b35f9f9ad 100755 --- a/runtime/Cpp/runtime/src/tree/AbstractParseTreeVisitor.h +++ b/runtime/Cpp/runtime/src/tree/AbstractParseTreeVisitor.h @@ -88,7 +88,7 @@ namespace tree { /// The default implementation returns the result of /// . /// - virtual T* visitTerminal(TerminalNode *node) override { + virtual T* visitTerminal(/* TerminalNode *node */) override { return defaultResult(); } @@ -98,7 +98,7 @@ namespace tree { /// The default implementation returns the result of /// . /// - virtual T* visitErrorNode(ErrorNode *node) override { + virtual T* visitErrorNode(/* ErrorNode *node */) override { return defaultResult(); } @@ -135,7 +135,7 @@ namespace tree { /// a child node. /// /// The updated aggregate result. - virtual T* aggregateResult(T* aggregate, T* nextResult) { + virtual T* aggregateResult(/* T* aggregate, */ T* nextResult) { return nextResult; } @@ -162,7 +162,7 @@ namespace tree { /// {@code true} to continue visiting children. Otherwise return /// {@code false} to stop visiting children and immediately return the /// current aggregate result from . - virtual bool shouldVisitNextChild(RuleNode *node, T currentResult) { + virtual bool shouldVisitNextChild(/*RuleNode *node, T currentResult*/) { return true; } diff --git a/runtime/Cpp/runtime/src/tree/ParseTreeListener.cpp b/runtime/Cpp/runtime/src/tree/ParseTreeListener.cpp deleted file mode 100755 index b8ba56d8e..000000000 --- a/runtime/Cpp/runtime/src/tree/ParseTreeListener.cpp +++ /dev/null @@ -1,34 +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 "ParseTreeListener.h" - -using namespace org::antlr::v4::runtime::tree; diff --git a/runtime/Cpp/runtime/src/tree/ParseTreeProperty.cpp b/runtime/Cpp/runtime/src/tree/ParseTreeProperty.cpp deleted file mode 100755 index 0ec3ced46..000000000 --- a/runtime/Cpp/runtime/src/tree/ParseTreeProperty.cpp +++ /dev/null @@ -1,34 +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 "ParseTreeProperty.h" - -using namespace org::antlr::v4::runtime::tree; diff --git a/runtime/Cpp/runtime/src/tree/TerminalNodeImpl.cpp b/runtime/Cpp/runtime/src/tree/TerminalNodeImpl.cpp index b2d0dae78..62ddeb35f 100755 --- a/runtime/Cpp/runtime/src/tree/TerminalNodeImpl.cpp +++ b/runtime/Cpp/runtime/src/tree/TerminalNodeImpl.cpp @@ -62,12 +62,12 @@ std::wstring TerminalNodeImpl::getText() { return symbol->getText(); } -std::wstring TerminalNodeImpl::toStringTree(Parser */*parser*/) { +std::wstring TerminalNodeImpl::toStringTree(Parser * /*parser*/) { return toString(); } std::wstring TerminalNodeImpl::toString() { - if (symbol->getType() == EOF) { + if (symbol->getType() == Token::EOF) { return L""; } return symbol->getText(); diff --git a/runtime/Cpp/runtime/src/tree/pattern/ParseTreePatternMatcher.cpp b/runtime/Cpp/runtime/src/tree/pattern/ParseTreePatternMatcher.cpp index 145c24951..9d8a1b09f 100755 --- a/runtime/Cpp/runtime/src/tree/pattern/ParseTreePatternMatcher.cpp +++ b/runtime/Cpp/runtime/src/tree/pattern/ParseTreePatternMatcher.cpp @@ -136,7 +136,7 @@ ParseTreePattern ParseTreePatternMatcher::compile(const std::wstring &pattern, i } // Make sure tree pattern compilation checks for a complete parse - if (tokens->LA(1) != EOF) { + if (tokens->LA(1) != Token::EOF) { throw StartRuleDoesNotConsumeFullPattern(); } @@ -288,7 +288,7 @@ std::vector> ParseTreePatternMatcher::tokenize(const std::wstring &pa ANTLRInputStream input(textChunk.getText()); _lexer->setInputStream(&input); Ref t = _lexer->nextToken(); - while (t->getType() != EOF) { + while (t->getType() != Token::EOF) { tokens.push_back(t); t = _lexer->nextToken(); } diff --git a/tool/resources/org/antlr/v4/tool/templates/codegen/Cpp/Cpp.stg b/tool/resources/org/antlr/v4/tool/templates/codegen/Cpp/Cpp.stg index 385846cde..a7235a8af 100644 --- a/tool/resources/org/antlr/v4/tool/templates/codegen/Cpp/Cpp.stg +++ b/tool/resources/org/antlr/v4/tool/templates/codegen/Cpp/Cpp.stg @@ -41,30 +41,26 @@ cppTypeInitMap ::= [ ] LexerHeader(lexer, atn, actionFuncs, sempredFuncs, superClass = {Lexer}) ::= << - -class Token { + + +class : public { public: + enum { = }; separator=", ", wrap, anchor> }; -}; -class Mode { -public: enum { = ,}; separator="\n", anchor> }; -}; -class : public Lexer { -public: (CharStream *input); ~(); - + virtual std::wstring getGrammarFileName() const override; virtual const std::vector\& getRuleNames() const override; @@ -94,7 +90,7 @@ private: static Ref\ _vocabulary; - + // Individual action functions triggered by action() above. @@ -110,7 +106,7 @@ private: >> Lexer(lexer, atn, actionFuncs, sempredFuncs, superClass = {Lexer}) ::= << -::(CharStream *input) : Lexer(input) { +::(CharStream *input) : (input) { _interpreter = new atn::LexerATNSimulator(this, _atn, _decisionToDFA, _sharedContextCache); } @@ -245,7 +241,7 @@ bool Sempred(Ref\<\> context, int predicateIndex); >> RuleSempredFunction(r, actions) ::= << -bool ::Sempred(Ref\<\> context, int predicateIndex) { +bool ::Sempred(Ref\<\> /*context*/, int predicateIndex) { switch (predicateIndex) { : return ;}; separator="\n"> @@ -260,24 +256,22 @@ bool ::Sempred(Ref\<\> context, int p //-------------------------------------------------------------------------------------------------- ParserHeader(parser, funcs, atn, sempredFuncs, superClass = {Parser}) ::= << - -class Token { -public: - enum { - = }; separator=", ", wrap, anchor> - }; -}; - - -class Rule { -public: - enum { - = }; separator=", ", wrap, anchor> - }; -}; + class : public { public: + + enum { + = }; separator=", ", wrap, anchor> + }; + + + + enum { + = }; separator=", ", wrap, anchor> + }; + + (TokenStream *input); ~(); @@ -287,7 +281,7 @@ public: virtual const std::vector\& getRuleNames() const override; virtual Ref\ getVocabulary() const override; - + Context;}; separator = "\n"> @@ -309,7 +303,7 @@ private: static Ref\ _vocabulary; - + struct Initializer { Initializer(); @@ -443,13 +437,13 @@ RuleFunction(currentRule, args, code, locals, ruleCtx, altLabelCtxs, namedAction }; separator = "\n"> Ref\<::\> ::() { - Ref\<\> result = std::make_shared\<\>(_ctx, getState()}>); - enterRule(result, , Rule::Rule); + Ref\<\> _localctx = std::make_shared\<\>(_ctx, getState()}>); + enterRule(_localctx, , ::Rule); - + - auto onExit = finally([this] { - + auto onExit = finally([=] { + exitRule(); }); try { @@ -464,13 +458,13 @@ Ref\<::\> ::( catch (RecognitionException &e) { - result->exception = std::make_exception_ptr(e); + _localctx->exception = std::make_exception_ptr(e); _errHandler->reportError(this, e); _errHandler->recover(this, e); } - return result; + return _localctx; } >> @@ -492,15 +486,15 @@ Ref\<::\> ::(::\> ::(int precedence}>) { Ref\ parentContext = _ctx; int parentState = getState(); - Ref\<::\> result = std::make_shared\<\>(_ctx, parentState}>); - Ref\<::\> previousContext = result; + Ref\<::\> _localctx = std::make_shared\<\>(_ctx, parentState}>); + Ref\<::\> previousContext = _localctx; int startState = ; - enterRecursionRule(result, , Rule::Rule, precedence); + enterRecursionRule(_localctx, , ::Rule, precedence); - auto onExit = finally([&] { + auto onExit = finally([=] { unrollRecursionContexts(parentContext); }); @@ -511,11 +505,11 @@ Ref\<::\> ::(in } catch (RecognitionException &e) { - result->exception = std::make_exception_ptr(e); + _localctx->exception = std::make_exception_ptr(e); _errHandler->reportError(this, e); _errHandler->recover(this, e); } - return result; + return _localctx; } >> @@ -558,7 +552,7 @@ StructDecl(struct, ctorAttrs, attrs, getters, dispatchMethods, interfaces, exten }; separator = "\n"> ssize_t ::::getRuleIndex() const { - return (ssize_t)Rule::Rule; + return ::Rule; } @@ -598,9 +592,9 @@ AltLabelStructDecl(struct, attrs, getters, dispatchMethods) ::= << CodeBlockForOuterMostAltHeader(currentOuterMostAltCodeBlock, locals, preamble, ops) ::= "" CodeBlockForOuterMostAlt(currentOuterMostAltCodeBlock, locals, preamble, ops) ::= << -result = std::dynamic_pointer_cast\<\>(std::make_shared\<::Context>(result)); +_localctx = std::dynamic_pointer_cast\<\>(std::make_shared\<::Context>(_localctx)); -enterOuterAlt(result, ); +enterOuterAlt(_localctx, ); >> @@ -619,46 +613,46 @@ _errHandler->sync(this); switch (_input->LA(1)) { - - break; + + break; }; separator = "\n"> default: - + } >> -LL1OptionalBlockHeader(choice, alts, error) ::= <> -LL1OptionalBlock(choice, alts, error) ::= <);YYY +LL1OptionalBlockHeader(choice, alts, error) ::= "" +LL1OptionalBlock(choice, alts, error) ::= << +setState(); switch (_input->LA(1)) { - - - break;}; separator="\n"> + + + break;}; separator="\n"> default: - + } >> -LL1OptionalBlockSingleAltHeader(choice, expr, alts, preamble, error, followExpr) ::= "" +LL1OptionalBlockSingleAltHeader(choice, expr, alts, preamble, error, followExpr) ::= "" LL1OptionalBlockSingleAlt(choice, expr, alts, preamble, error, followExpr) ::= << setState(); if () { - + } >> -LL1StarBlockSingleAltHeader(choice, loopExpr, alts, preamble, iteration) ::= "LL1StarBlockSingleAltHeader" +LL1StarBlockSingleAltHeader(choice, loopExpr, alts, preamble, iteration) ::= "" LL1StarBlockSingleAlt(choice, loopExpr, alts, preamble, iteration) ::= << setState(); _errHandler->sync(this); while () { - - setState(); - _errHandler->sync(this); - + + setState(); + _errHandler->sync(this); + } >> @@ -668,10 +662,10 @@ setState(); _errHandler->sync(this); do { - - setState(); - _errHandler->sync(this); - + + setState(); + _errHandler->sync(this); + } while (); >> @@ -685,8 +679,8 @@ _errHandler->sync(this); switch (getInterpreter\()->adaptivePredict(_input, , _ctx)) { : - - break; + + break; }; separator="\n"> } >> @@ -698,8 +692,8 @@ _errHandler->sync(this); switch (getInterpreter\()->adaptivePredict(_input, , _ctx)) { +1: - - break; + + break; }; separator = "\n"> } >> @@ -710,13 +704,13 @@ setState(); _errHandler->sync(this); alt = getInterpreter\()->adaptivePredict(_input, , _ctx); while (alt != && alt != -1) { - if ( alt == 1 + 1) { - - - } - setState(); - _errHandler->sync(this); - alt = getInterpreter\()->adaptivePredict(_input, , _ctx); + if ( alt == 1 + 1) { + + + } + setState(); + _errHandler->sync(this); + alt = getInterpreter\()->adaptivePredict(_input, , _ctx); } >> @@ -726,17 +720,17 @@ setState(); _errHandler->sync(this); alt = getInterpreter\()->adaptivePredict(_input, , _ctx); do { - switch (alt) { - + 1: - - break; - }; separator="\n"> - default: - - } - setState(); - _errHandler->sync(this); - alt = getInterpreter\()->adaptivePredict(_input, , _ctx); + switch (alt) { + + 1: + + break; +}; separator="\n"> + default: + + } + setState(); + _errHandler->sync(this); + alt = getInterpreter\()->adaptivePredict(_input, , _ctx); } while (alt != && alt != -1); >> @@ -767,16 +761,16 @@ isZero ::= [ ] offsetShift(shiftAmount, offset, prefix = false) ::= <% -(Token:: - )Token:: +(:: - ):: %> // produces more efficient bytecode when bits.ttypes contains at most two items bitsetInlineComparison(s, bits) ::= <% - == Token::}; separator = " || "> + == ::}; separator = " || "> %> cases(ttypes) ::= << -Token:::}; separator="\n"> +:::}; separator="\n"> >> InvokeRuleHeader(r, argExprsChunks) ::= "InvokeRuleHeader" @@ -789,7 +783,7 @@ setState(); MatchTokenHeader(m) ::= "" MatchToken(m) ::= << setState(); - = }>match(Token::); + = }>match(::); >> MatchSetHeader(m, expr, capture) ::= "" @@ -833,7 +827,7 @@ if (!()) throw FailedPredicateException(this, ) { - + } >> @@ -843,9 +837,9 @@ LexerSkipCommand() ::= "skip();" LexerMoreCommand() ::= "more();" LexerPopModeCommand() ::= "popMode();" -LexerTypeCommand(arg, grammar) ::= "_type = Token::;" -LexerChannelCommand(arg, grammar) ::= "_channel = ;" -LexerModeCommand(arg, grammar) ::= "_mode = Mode::;" +LexerTypeCommand(arg, grammar) ::= "type = ::;" +LexerChannelCommand(arg, grammar) ::= "channel = ;" +LexerModeCommand(arg, grammar) ::= "mode = Mode::;" LexerPushModeCommand(arg, grammar) ::= "pushMode(Mode::);" // TODO: untested @@ -855,9 +849,9 @@ ActionText(t) ::= "" ActionTemplateHeader(t) ::= "" ActionTemplate(t) ::= "" -ArgRef(a) ::= "ArgRef(a) result." -LocalRef(a) ::= "LocalRef(a) result." -RetValueRef(a) ::= "RetValueRef(a) result." +ArgRef(a) ::= "ArgRef(a) _localctx." +LocalRef(a) ::= "LocalRef(a) _localctx." +RetValueRef(a) ::= "RetValueRef(a) _localctx." QRetValueRef(a) ::= "QRetValueRef(a) .." /** How to translate $tokenLabel */ TokenRef(t) ::= "TokenRef(t) ." @@ -867,7 +861,9 @@ SetAttr(s,rhsChunks) ::= "SetAttr(s,rhsChunks) . = ;" InputSymbolType() ::= " *" -TokenPropertyRef_text(t) ::= "TokenPropertyRef_text(t) (. != nullptr ? ..getText() : null)" +TokenPropertyRef_textHeader(t) ::= "" +TokenPropertyRef_text(t) ::= "(-> != nullptr ? ->->getText() : nullptr)" + TokenPropertyRef_type(t) ::= "TokenPropertyRef_type(t) (. != nullptr ? ..getType() : 0)" TokenPropertyRef_line(t) ::= "TokenPropertyRef_line(t) (. != nullptr ? ..getLine() : 0)" TokenPropertyRef_pos(t) ::= "TokenPropertyRef_pos(t) (. != nullptr ? ..getCharPositionInLine() : 0)" @@ -880,14 +876,14 @@ RulePropertyRef_stop(r) ::= "RulePropertyRef_stop(r) (. != n RulePropertyRef_text(r) ::= "RulePropertyRef_text(r) (. != nullptr ? _input->getText(..start,..stop) : null)" RulePropertyRef_ctx(r) ::= "RulePropertyRef_ctx(r)." -ThisRulePropertyRef_start(r) ::= "ThisRulePropertyRef_start(r) result->start" -ThisRulePropertyRef_stop(r) ::= "ThisRulePropertyRef_stop(r) result->stop" -ThisRulePropertyRef_text(r) ::= "ThisRulePropertyRef_text(r) input->getText(result->start, _input->LT(-1))" -ThisRulePropertyRef_ctx(r) ::= "ThisRulePropertyRef_ctx(r) result" +ThisRulePropertyRef_start(r) ::= "ThisRulePropertyRef_start(r) _localctx->start" +ThisRulePropertyRef_stop(r) ::= "ThisRulePropertyRef_stop(r) _localctx->stop" +ThisRulePropertyRef_text(r) ::= "ThisRulePropertyRef_text(r) input->getText(_localctx->start, _input->LT(-1))" +ThisRulePropertyRef_ctx(r) ::= "ThisRulePropertyRef_ctx(r) _localctx" NonLocalAttrRef(s) ::= "NonLocalAttrRef(s) ((Context)getInvokingContext())." SetNonLocalAttr(s, rhsChunks) ::= - "SetNonLocalAttr(s, rhsChunks) ((Context)getInvokingContext()). = ;" + "SetNonLocalAttr(s, rhsChunks) ((Context)getInvokingContext()). = ;" AddToLabelListHeader(a) ::= "" AddToLabelList(a) ::= << @@ -914,7 +910,7 @@ RuleContextListDecl(rdecl) ::= "" ContextTokenGetterDeclHeader(t) ::= "Ref\ ();" ContextTokenGetterDecl(t) ::= << Ref\ ::::() { - return getToken(Token::, 0); + return getToken(::, 0); } >> @@ -922,7 +918,7 @@ Ref\ ::::() { ContextTokenListGetterDeclHeader(t) ::= "std::vector\> ();" ContextTokenListGetterDecl(t) ::= << std::vector\\> ::::() { - return getTokens(Token::); + return getTokens(::); } >> @@ -930,7 +926,7 @@ std::vector\\> ::::() ContextTokenListIndexedGetterDeclHeader(t) ::= "Ref\ (int i);" ContextTokenListIndexedGetterDecl(t) ::= << Ref\ ::::(int i) { - return getToken(Token::, (size_t)i); + return getToken(::, (size_t)i); } >> @@ -1005,10 +1001,10 @@ AttributeDeclHeader(d) ::= " = stop = _input->LT(-1);" recRuleAltStartAction(ruleName, ctxName, label) ::= << -result = std::make_shared\<Context>(parentContext, parentState); -result->