forked from jasder/antlr
Merge branch 'master' of https://github.com/DanMcLaughlin/antlr4 into feature/addtests
This commit is contained in:
commit
eb5760b872
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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 */}
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -173,7 +173,6 @@
|
|||
<ClCompile Include="src\atn\ATNSerializer.cpp" />
|
||||
<ClCompile Include="src\atn\ATNSimulator.cpp" />
|
||||
<ClCompile Include="src\atn\ATNState.cpp" />
|
||||
<ClCompile Include="src\atn\ATNType.cpp" />
|
||||
<ClCompile Include="src\atn\AtomTransition.cpp" />
|
||||
<ClCompile Include="src\atn\BasicBlockStartState.cpp" />
|
||||
<ClCompile Include="src\atn\BasicState.cpp" />
|
||||
|
@ -186,7 +185,6 @@
|
|||
<ClCompile Include="src\atn\EpsilonTransition.cpp" />
|
||||
<ClCompile Include="src\atn\ErrorInfo.cpp" />
|
||||
<ClCompile Include="src\atn\LexerActionExecutor.cpp" />
|
||||
<ClCompile Include="src\atn\LexerActionType.cpp" />
|
||||
<ClCompile Include="src\atn\LexerATNConfig.cpp" />
|
||||
<ClCompile Include="src\atn\LexerATNSimulator.cpp" />
|
||||
<ClCompile Include="src\atn\LexerChannelAction.cpp" />
|
||||
|
@ -252,7 +250,6 @@
|
|||
<ClCompile Include="src\misc\Interval.cpp" />
|
||||
<ClCompile Include="src\misc\IntervalSet.cpp" />
|
||||
<ClCompile Include="src\misc\MurmurHash.cpp" />
|
||||
<ClCompile Include="src\misc\Predicate.cpp" />
|
||||
<ClCompile Include="src\NoViableAltException.cpp" />
|
||||
<ClCompile Include="src\Parser.cpp" />
|
||||
<ClCompile Include="src\ParserInterpreter.cpp" />
|
||||
|
@ -266,11 +263,9 @@
|
|||
<ClCompile Include="src\support\guid.cpp" />
|
||||
<ClCompile Include="src\support\Strings.cpp" />
|
||||
<ClCompile Include="src\Token.cpp" />
|
||||
<ClCompile Include="src\TokenFactory.cpp" />
|
||||
<ClCompile Include="src\TokenStream.cpp" />
|
||||
<ClCompile Include="src\TokenStreamRewriter.cpp" />
|
||||
<ClCompile Include="src\tree\ErrorNodeImpl.cpp" />
|
||||
<ClCompile Include="src\tree\ParseTreeProperty.cpp" />
|
||||
<ClCompile Include="src\tree\ParseTreeWalker.cpp" />
|
||||
<ClCompile Include="src\tree\pattern\ParseTreeMatch.cpp" />
|
||||
<ClCompile Include="src\tree\pattern\ParseTreePattern.cpp" />
|
||||
|
@ -285,7 +280,6 @@
|
|||
<ClCompile Include="src\UnbufferedCharStream.cpp" />
|
||||
<ClCompile Include="src\UnbufferedTokenStream.cpp" />
|
||||
<ClCompile Include="src\VocabularyImpl.cpp" />
|
||||
<ClCompile Include="src\WritableToken.cpp" />
|
||||
<ClCompile Include="antlrcpp-Prefix.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
|
|
|
@ -595,9 +595,6 @@
|
|||
<ClCompile Include="src\Token.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\TokenFactory.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\TokenStream.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
@ -610,9 +607,6 @@
|
|||
<ClCompile Include="src\UnbufferedTokenStream.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\WritableToken.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\atn\AbstractPredicateTransition.cpp">
|
||||
<Filter>Source Files\atn</Filter>
|
||||
</ClCompile>
|
||||
|
@ -646,9 +640,6 @@
|
|||
<ClCompile Include="src\atn\ATNState.cpp">
|
||||
<Filter>Source Files\atn</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\atn\ATNType.cpp">
|
||||
<Filter>Source Files\atn</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\atn\AtomTransition.cpp">
|
||||
<Filter>Source Files\atn</Filter>
|
||||
</ClCompile>
|
||||
|
@ -784,9 +775,6 @@
|
|||
<ClCompile Include="src\tree\ErrorNodeImpl.cpp">
|
||||
<Filter>Source Files\tree</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\tree\ParseTreeProperty.cpp">
|
||||
<Filter>Source Files\tree</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\tree\ParseTreeWalker.cpp">
|
||||
<Filter>Source Files\tree</Filter>
|
||||
</ClCompile>
|
||||
|
@ -841,9 +829,6 @@
|
|||
<ClCompile Include="src\atn\LexerActionExecutor.cpp">
|
||||
<Filter>Source Files\atn</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\atn\LexerActionType.cpp">
|
||||
<Filter>Source Files\atn</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\atn\LexerChannelAction.cpp">
|
||||
<Filter>Source Files\atn</Filter>
|
||||
</ClCompile>
|
||||
|
@ -883,8 +868,5 @@
|
|||
<ClCompile Include="src\atn\ProfilingATNSimulator.cpp">
|
||||
<Filter>Source Files\atn</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\misc\Predicate.cpp">
|
||||
<Filter>Source Files\misc</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -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 = "<group>"; };
|
||||
276E5C291CDB57AA003FF4B4 /* ATNState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ATNState.cpp; sourceTree = "<group>"; };
|
||||
276E5C2A1CDB57AA003FF4B4 /* ATNState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATNState.h; sourceTree = "<group>"; };
|
||||
276E5C2B1CDB57AA003FF4B4 /* ATNType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ATNType.cpp; sourceTree = "<group>"; };
|
||||
276E5C2C1CDB57AA003FF4B4 /* ATNType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ATNType.h; sourceTree = "<group>"; };
|
||||
276E5C2D1CDB57AA003FF4B4 /* AtomTransition.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AtomTransition.cpp; sourceTree = "<group>"; };
|
||||
276E5C2E1CDB57AA003FF4B4 /* AtomTransition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AtomTransition.h; sourceTree = "<group>"; };
|
||||
|
@ -912,7 +887,6 @@
|
|||
276E5C451CDB57AA003FF4B4 /* LexerAction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LexerAction.h; sourceTree = "<group>"; };
|
||||
276E5C461CDB57AA003FF4B4 /* LexerActionExecutor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LexerActionExecutor.cpp; sourceTree = "<group>"; };
|
||||
276E5C471CDB57AA003FF4B4 /* LexerActionExecutor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LexerActionExecutor.h; sourceTree = "<group>"; };
|
||||
276E5C481CDB57AA003FF4B4 /* LexerActionType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LexerActionType.cpp; sourceTree = "<group>"; };
|
||||
276E5C491CDB57AA003FF4B4 /* LexerActionType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LexerActionType.h; sourceTree = "<group>"; };
|
||||
276E5C4A1CDB57AA003FF4B4 /* LexerATNConfig.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LexerATNConfig.cpp; sourceTree = "<group>"; wrapsLines = 0; };
|
||||
276E5C4B1CDB57AA003FF4B4 /* LexerATNConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LexerATNConfig.h; sourceTree = "<group>"; };
|
||||
|
@ -960,7 +934,7 @@
|
|||
276E5C761CDB57AA003FF4B4 /* PredicateEvalInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PredicateEvalInfo.h; sourceTree = "<group>"; };
|
||||
276E5C771CDB57AA003FF4B4 /* PredicateTransition.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PredicateTransition.cpp; sourceTree = "<group>"; };
|
||||
276E5C781CDB57AA003FF4B4 /* PredicateTransition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PredicateTransition.h; sourceTree = "<group>"; };
|
||||
276E5C791CDB57AA003FF4B4 /* PredictionContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PredictionContext.cpp; sourceTree = "<group>"; };
|
||||
276E5C791CDB57AA003FF4B4 /* PredictionContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PredictionContext.cpp; sourceTree = "<group>"; wrapsLines = 0; };
|
||||
276E5C7A1CDB57AA003FF4B4 /* PredictionContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PredictionContext.h; sourceTree = "<group>"; };
|
||||
276E5C7B1CDB57AA003FF4B4 /* PredictionMode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PredictionMode.cpp; sourceTree = "<group>"; };
|
||||
276E5C7C1CDB57AA003FF4B4 /* PredictionMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PredictionMode.h; sourceTree = "<group>"; };
|
||||
|
@ -1037,7 +1011,7 @@
|
|||
276E5CC41CDB57AA003FF4B4 /* LexerInterpreter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LexerInterpreter.h; sourceTree = "<group>"; };
|
||||
276E5CC51CDB57AA003FF4B4 /* LexerNoViableAltException.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LexerNoViableAltException.cpp; sourceTree = "<group>"; };
|
||||
276E5CC61CDB57AA003FF4B4 /* LexerNoViableAltException.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LexerNoViableAltException.h; sourceTree = "<group>"; };
|
||||
276E5CC71CDB57AA003FF4B4 /* ListTokenSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ListTokenSource.cpp; sourceTree = "<group>"; };
|
||||
276E5CC71CDB57AA003FF4B4 /* ListTokenSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ListTokenSource.cpp; sourceTree = "<group>"; wrapsLines = 0; };
|
||||
276E5CC81CDB57AA003FF4B4 /* ListTokenSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ListTokenSource.h; sourceTree = "<group>"; };
|
||||
276E5CCA1CDB57AA003FF4B4 /* Interval.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Interval.cpp; sourceTree = "<group>"; };
|
||||
276E5CCB1CDB57AA003FF4B4 /* Interval.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Interval.h; sourceTree = "<group>"; };
|
||||
|
@ -1045,7 +1019,6 @@
|
|||
276E5CCD1CDB57AA003FF4B4 /* IntervalSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IntervalSet.h; sourceTree = "<group>"; };
|
||||
276E5CCE1CDB57AA003FF4B4 /* MurmurHash.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MurmurHash.cpp; sourceTree = "<group>"; };
|
||||
276E5CCF1CDB57AA003FF4B4 /* MurmurHash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MurmurHash.h; sourceTree = "<group>"; };
|
||||
276E5CD01CDB57AA003FF4B4 /* Predicate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Predicate.cpp; sourceTree = "<group>"; };
|
||||
276E5CD11CDB57AA003FF4B4 /* Predicate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Predicate.h; sourceTree = "<group>"; };
|
||||
276E5CD21CDB57AA003FF4B4 /* TestRig.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestRig.cpp; sourceTree = "<group>"; };
|
||||
276E5CD31CDB57AA003FF4B4 /* TestRig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestRig.h; sourceTree = "<group>"; };
|
||||
|
@ -1077,9 +1050,7 @@
|
|||
276E5CEE1CDB57AA003FF4B4 /* Strings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Strings.h; sourceTree = "<group>"; };
|
||||
276E5CEF1CDB57AA003FF4B4 /* Token.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Token.cpp; sourceTree = "<group>"; };
|
||||
276E5CF01CDB57AA003FF4B4 /* Token.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Token.h; sourceTree = "<group>"; };
|
||||
276E5CF11CDB57AA003FF4B4 /* TokenFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TokenFactory.cpp; sourceTree = "<group>"; };
|
||||
276E5CF21CDB57AA003FF4B4 /* TokenFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TokenFactory.h; sourceTree = "<group>"; };
|
||||
276E5CF31CDB57AA003FF4B4 /* TokenSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TokenSource.cpp; sourceTree = "<group>"; };
|
||||
276E5CF41CDB57AA003FF4B4 /* TokenSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TokenSource.h; sourceTree = "<group>"; };
|
||||
276E5CF51CDB57AA003FF4B4 /* TokenStream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TokenStream.cpp; sourceTree = "<group>"; };
|
||||
276E5CF61CDB57AA003FF4B4 /* TokenStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TokenStream.h; sourceTree = "<group>"; };
|
||||
|
@ -1090,9 +1061,7 @@
|
|||
276E5CFC1CDB57AA003FF4B4 /* ErrorNodeImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ErrorNodeImpl.cpp; sourceTree = "<group>"; };
|
||||
276E5CFD1CDB57AA003FF4B4 /* ErrorNodeImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ErrorNodeImpl.h; sourceTree = "<group>"; };
|
||||
276E5CFE1CDB57AA003FF4B4 /* ParseTree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ParseTree.h; sourceTree = "<group>"; };
|
||||
276E5CFF1CDB57AA003FF4B4 /* ParseTreeListener.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ParseTreeListener.cpp; sourceTree = "<group>"; };
|
||||
276E5D001CDB57AA003FF4B4 /* ParseTreeListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ParseTreeListener.h; sourceTree = "<group>"; };
|
||||
276E5D011CDB57AA003FF4B4 /* ParseTreeProperty.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ParseTreeProperty.cpp; sourceTree = "<group>"; };
|
||||
276E5D021CDB57AA003FF4B4 /* ParseTreeProperty.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ParseTreeProperty.h; sourceTree = "<group>"; };
|
||||
276E5D031CDB57AA003FF4B4 /* ParseTreeVisitor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ParseTreeVisitor.h; sourceTree = "<group>"; };
|
||||
276E5D041CDB57AA003FF4B4 /* ParseTreeWalker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ParseTreeWalker.cpp; sourceTree = "<group>"; };
|
||||
|
@ -1128,7 +1097,6 @@
|
|||
276E5D261CDB57AA003FF4B4 /* Vocabulary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Vocabulary.h; sourceTree = "<group>"; };
|
||||
276E5D271CDB57AA003FF4B4 /* VocabularyImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VocabularyImpl.cpp; sourceTree = "<group>"; };
|
||||
276E5D281CDB57AA003FF4B4 /* VocabularyImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VocabularyImpl.h; sourceTree = "<group>"; };
|
||||
276E5D291CDB57AA003FF4B4 /* WritableToken.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WritableToken.cpp; sourceTree = "<group>"; };
|
||||
276E5D2A1CDB57AA003FF4B4 /* WritableToken.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WritableToken.h; sourceTree = "<group>"; };
|
||||
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 */,
|
||||
|
|
|
@ -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)];
|
||||
|
|
|
@ -83,5 +83,5 @@ Ref<Token> BailErrorStrategy::recoverInline(Parser *recognizer) {
|
|||
#endif
|
||||
}
|
||||
|
||||
void BailErrorStrategy::sync(Parser */*recognizer*/) {
|
||||
void BailErrorStrategy::sync(Parser * /*recognizer*/) {
|
||||
}
|
||||
|
|
|
@ -34,18 +34,18 @@
|
|||
|
||||
using namespace org::antlr::v4::runtime;
|
||||
|
||||
void BaseErrorListener::syntaxError(IRecognizer */*recognizer*/, Ref<Token> /*offendingSymbol*/, size_t /*line*/,
|
||||
void BaseErrorListener::syntaxError(IRecognizer * /*recognizer*/, Ref<Token> /*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<atn::ATNConfigSet> /*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<atn::ATNConfigSet> /*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<atn::ATNConfigSet> /*configs*/) {
|
||||
}
|
||||
|
|
|
@ -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<WritableToken>(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<Ref<Token>> BufferedTokenStream::get(size_t start, size_t stop) {
|
|||
}
|
||||
for (size_t i = start; i <= stop; i++) {
|
||||
Ref<Token> 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> 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> 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<Token> t = _tokens[i];
|
||||
if (t->getType() == EOF) {
|
||||
if (t->getType() == Token::EOF) {
|
||||
break;
|
||||
}
|
||||
ss << t->getText();
|
||||
|
|
|
@ -34,4 +34,4 @@
|
|||
using namespace org::antlr::v4::runtime;
|
||||
|
||||
CharStream::~CharStream() {
|
||||
};
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ int CommonTokenStream::getNumberOfOnChannelTokens() {
|
|||
if (t->getChannel() == channel) {
|
||||
n++;
|
||||
}
|
||||
if (t->getType() == EOF) {
|
||||
if (t->getType() == Token::EOF) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ using namespace org::antlr::v4::runtime;
|
|||
|
||||
ConsoleErrorListener ConsoleErrorListener::INSTANCE;
|
||||
|
||||
void ConsoleErrorListener::syntaxError(IRecognizer */*recognizer*/, Ref<Token> /*offendingSymbol*/,
|
||||
void ConsoleErrorListener::syntaxError(IRecognizer * /*recognizer*/, Ref<Token> /*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;
|
||||
}
|
||||
|
|
|
@ -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"<EOF>";
|
||||
} else {
|
||||
input = tokens->getText(e.getStartToken(), e.getOffendingToken());
|
||||
|
@ -270,14 +270,14 @@ Ref<Token> 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"<missing EOF>";
|
||||
} else {
|
||||
tokenText = L"<missing " + recognizer->getVocabulary()->getDisplayName(expectedTokenType) + L">";
|
||||
}
|
||||
Ref<Token> current = currentSymbol;
|
||||
Ref<Token> 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<Token>(recognizer->getTokenFactory()->create({ current->getTokenSource(),
|
||||
|
@ -295,7 +295,7 @@ std::wstring DefaultErrorStrategy::getTokenErrorDisplay(Ref<Token> t) {
|
|||
}
|
||||
std::wstring s = getSymbolText(t);
|
||||
if (s == L"") {
|
||||
if (getSymbolType(t) == EOF) {
|
||||
if (getSymbolType(t) == Token::EOF) {
|
||||
s = L"<EOF>";
|
||||
} 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);
|
||||
}
|
||||
|
|
|
@ -54,6 +54,8 @@ namespace runtime {
|
|||
/// </summary>
|
||||
class ANTLR4CPP_PUBLIC IntStream {
|
||||
public:
|
||||
static const ssize_t EOF = -1;
|
||||
|
||||
/// The value returned by <seealso cref="#LA LA()"/> when the end of the stream is
|
||||
/// reached.
|
||||
/// No explicit EOF definition. We got EOF on all platforms.
|
||||
|
|
|
@ -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<atn::LexerATNSimulator>()->reset();
|
||||
}
|
||||
|
@ -79,74 +79,74 @@ Ref<Token> 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<atn::LexerATNSimulator>()->getCharPositionInLine();
|
||||
_tokenStartLine = (int)getInterpreter<atn::LexerATNSimulator>()->getLine();
|
||||
_text = L"";
|
||||
token.reset();
|
||||
channel = Token::DEFAULT_CHANNEL;
|
||||
tokenStartCharIndex = (int)_input->index();
|
||||
tokenStartCharPositionInLine = getInterpreter<atn::LexerATNSimulator>()->getCharPositionInLine();
|
||||
tokenStartLine = (int)getInterpreter<atn::LexerATNSimulator>()->getLine();
|
||||
text = L"";
|
||||
do {
|
||||
_type = Token::INVALID_TYPE;
|
||||
type = Token::INVALID_TYPE;
|
||||
int ttype;
|
||||
try {
|
||||
ttype = getInterpreter<atn::LexerATNSimulator>()->match(_input, (size_t)_mode);
|
||||
ttype = getInterpreter<atn::LexerATNSimulator>()->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 = token;
|
||||
this->token = token;
|
||||
}
|
||||
|
||||
Ref<Token> Lexer::emit() {
|
||||
Ref<Token> t = std::dynamic_pointer_cast<Token>(_factory->create({ this, _input }, _type, _text, _channel,
|
||||
_tokenStartCharIndex, getCharIndex() - 1, _tokenStartLine, _tokenStartCharPositionInLine));
|
||||
Ref<Token> t = std::dynamic_pointer_cast<Token>(_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<atn::LexerATNSimulator>()->getText(_input);
|
||||
}
|
||||
|
||||
void Lexer::setText(const std::wstring &text) {
|
||||
this->_text = text;
|
||||
this->text = text;
|
||||
}
|
||||
|
||||
Ref<Token> Lexer::getToken() {
|
||||
return _token;
|
||||
return token;
|
||||
}
|
||||
|
||||
void Lexer::setToken(Ref<Token> 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<Ref<Token>> 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;
|
||||
}
|
||||
|
|
|
@ -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> _token;
|
||||
Ref<Token> token;
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
int _tokenStartCharIndex;
|
||||
int tokenStartCharIndex;
|
||||
|
||||
/// <summary>
|
||||
/// The line on which the first character of the token resides </summary>
|
||||
int _tokenStartLine;
|
||||
size_t tokenStartLine;
|
||||
|
||||
/// <summary>
|
||||
/// The character position of first character within the line </summary>
|
||||
int _tokenStartCharPositionInLine;
|
||||
int tokenStartCharPositionInLine;
|
||||
|
||||
/// <summary>
|
||||
/// Once we see EOF on char stream, next token will be EOF.
|
||||
/// If you have DONE : EOF ; then you see DONE EOF.
|
||||
/// </summary>
|
||||
bool _hitEOF;
|
||||
bool hitEOF;
|
||||
|
||||
/// <summary>
|
||||
/// The channel number for the current token </summary>
|
||||
int _channel;
|
||||
int channel;
|
||||
|
||||
/// <summary>
|
||||
/// The token type for the current token </summary>
|
||||
int _type;
|
||||
ssize_t type;
|
||||
|
||||
// Use the vector as a stack.
|
||||
std::vector<int> _modeStack;
|
||||
int _mode;
|
||||
std::vector<size_t> 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<typename T1>
|
||||
void setTokenFactory(TokenFactory<T1> *factory) {
|
||||
|
@ -191,9 +191,9 @@ namespace runtime {
|
|||
|
||||
virtual void setToken(Ref<Token> token);
|
||||
|
||||
virtual void setType(int ttype);
|
||||
virtual void setType(ssize_t ttype);
|
||||
|
||||
virtual int getType();
|
||||
virtual ssize_t getType();
|
||||
|
||||
virtual void setChannel(int channel);
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ Ref<Token> ListTokenSource::nextToken() {
|
|||
}
|
||||
|
||||
int stop = std::max(-1, start - 1);
|
||||
eofToken = std::dynamic_pointer_cast<Token>(_factory->create({ this, getInputStream() }, EOF, L"EOF",
|
||||
eofToken = std::dynamic_pointer_cast<Token>(_factory->create({ this, getInputStream() }, Token::EOF, L"EOF",
|
||||
Token::DEFAULT_CHANNEL, start, stop, (int)getLine(), getCharPositionInLine()));
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ Ref<Token> ListTokenSource::nextToken() {
|
|||
}
|
||||
|
||||
Ref<Token> t = tokens[i];
|
||||
if (i == tokens.size() - 1 && t->getType() == EOF) {
|
||||
if (i == tokens.size() - 1 && t->getType() == Token::EOF) {
|
||||
eofToken = t;
|
||||
}
|
||||
|
||||
|
|
|
@ -41,6 +41,8 @@ namespace runtime {
|
|||
|
||||
class ANTLR4CPP_PUBLIC Recognizer : public IRecognizer {
|
||||
public:
|
||||
static const ssize_t EOF = -1;
|
||||
|
||||
Recognizer();
|
||||
virtual ~Recognizer() {};
|
||||
|
||||
|
|
|
@ -164,7 +164,7 @@ std::wstring RuleContext::toString(const std::vector<std::wstring> &ruleNames, R
|
|||
|
||||
std::wstring RuleContext::toString() {
|
||||
return toString(nullptr);
|
||||
};
|
||||
}
|
||||
|
||||
std::wstring RuleContext::toString(Recognizer *recog) {
|
||||
return toString(recog, ParserRuleContext::EMPTY);
|
||||
|
|
|
@ -47,17 +47,12 @@ namespace runtime {
|
|||
public:
|
||||
static const size_t INVALID_TYPE = 0;
|
||||
|
||||
/// <summary>
|
||||
/// During lookahead operations, this "token" signifies we hit rule end ATN state
|
||||
/// and did not follow it despite needing to.
|
||||
/// </summary>
|
||||
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() {};
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -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;
|
|
@ -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<Symbol> create(std::pair<TokenSource*, CharStream*> source, int type, const std::wstring &text,
|
||||
virtual Ref<Symbol> create(std::pair<TokenSource *, CharStream *> source, int type, const std::wstring &text,
|
||||
int channel, int start, int stop, int line, int charPositionInLine) = 0;
|
||||
|
||||
/// Generically useful
|
||||
|
|
|
@ -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;
|
|
@ -101,7 +101,7 @@ namespace runtime {
|
|||
/// </summary>
|
||||
/// <param name="factory"> The <seealso cref="TokenFactory"/> to use for creating tokens. </param>
|
||||
template<typename T1>
|
||||
void setTokenFactory(TokenFactory<T1> */*factory*/) {};
|
||||
void setTokenFactory(TokenFactory<T1> * /*factory*/) {}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <seealso cref="TokenFactory"/> this token source is currently using for
|
||||
|
|
|
@ -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<Token> 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
|
||||
|
|
|
@ -314,7 +314,7 @@ namespace runtime {
|
|||
/// <summary>
|
||||
/// Get all operations before an index of a particular kind </summary>
|
||||
template <typename T, typename T1>
|
||||
std::vector<T*> getKindOfOps(std::vector<T1*> rewrites, T */*kind*/, size_t before) {
|
||||
std::vector<T*> getKindOfOps(std::vector<T1*> rewrites, T * /*kind*/, size_t before) {
|
||||
std::vector<T*> ops = std::vector<T*>();
|
||||
for (size_t i = 0; i < before && i < rewrites.size(); i++) {
|
||||
TokenStreamRewriter::RewriteOperation *op = dynamic_cast<RewriteOperation*>(rewrites[i]);
|
||||
|
|
|
@ -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";
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
|
@ -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<class T> using Ref = std::shared_ptr<T>;
|
||||
|
|
|
@ -179,7 +179,7 @@ misc::IntervalSet ATN::getExpectedTokens(int stateNumber, Ref<RuleContext> conte
|
|||
}
|
||||
|
||||
if (following.contains(Token::EPSILON)) {
|
||||
expected.add(EOF);
|
||||
expected.add(Token::EOF);
|
||||
}
|
||||
|
||||
return expected;
|
||||
|
|
|
@ -275,7 +275,7 @@ std::wstring ATNConfigSet::toString() {
|
|||
return ss.str();
|
||||
}
|
||||
|
||||
bool ATNConfigSet::remove(void */*o*/) {
|
||||
bool ATNConfigSet::remove(void * /*o*/) {
|
||||
throw UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -161,7 +161,7 @@ std::vector<size_t> 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<size_t> 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<size_t> 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<size_t> ATNSerializer::serialize() {
|
|||
case Transition::RANGE:
|
||||
arg1 = (static_cast<RangeTransition *>(t))->from;
|
||||
arg2 = (static_cast<RangeTransition *>(t))->to;
|
||||
if (arg1 == EOF) {
|
||||
if (arg1 == Token::EOF) {
|
||||
arg1 = 0;
|
||||
arg3 = 1;
|
||||
}
|
||||
|
@ -263,7 +263,7 @@ std::vector<size_t> ATNSerializer::serialize() {
|
|||
break;
|
||||
case Transition::ATOM:
|
||||
arg1 = (static_cast<AtomTransition *>(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++) {
|
||||
|
|
|
@ -46,7 +46,7 @@ ATNState::~ATNState() {
|
|||
for (auto transition : transitions) {
|
||||
delete transition;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
const std::vector<std::wstring> ATNState::serializationNames = {
|
||||
L"INVALID", L"BASIC", L"RULE_START", L"BLOCK_START",
|
||||
|
|
|
@ -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;
|
|
@ -107,7 +107,7 @@ void LL1Analyzer::_LOOK(ATNState *s, ATNState *stopState, Ref<PredictionContext>
|
|||
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<PredictionContext>
|
|||
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<PredictionContext>
|
|||
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<PredictionContext>
|
|||
}
|
||||
|
||||
Ref<PredictionContext> newContext = SingletonPredictionContext::create(ctx, (static_cast<RuleTransition*>(t))->followState->stateNumber);
|
||||
auto onExit = finally([&] {
|
||||
auto onExit = finally([t, &calledRuleStack] {
|
||||
calledRuleStack[(size_t)((static_cast<RuleTransition*>(t))->target->ruleIndex)] = false;
|
||||
});
|
||||
|
||||
|
|
|
@ -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<ATNConfigSet> 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, Ref<ATNConfigSe
|
|||
lexerActionExecutor = lexerActionExecutor->fixOffsetBeforeMatch((int)input->index() - _startIndex);
|
||||
}
|
||||
|
||||
bool treatEofAsEpsilon = t == EOF;
|
||||
bool treatEofAsEpsilon = t == Token::EOF;
|
||||
Ref<LexerATNConfig> config = std::make_shared<LexerATNConfig>(std::static_pointer_cast<LexerATNConfig>(c),
|
||||
target, lexerActionExecutor);
|
||||
|
||||
|
@ -483,7 +483,7 @@ Ref<LexerATNConfig> LexerATNSimulator::getEpsilonTarget(CharStream *input, Ref<L
|
|||
case Transition::RANGE:
|
||||
case Transition::SET:
|
||||
if (treatEofAsEpsilon) {
|
||||
if (t->matches(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<LexerATNConfig>(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);
|
||||
|
|
|
@ -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;
|
|
@ -54,7 +54,7 @@ bool LexerModeAction::isPositionDependent() const {
|
|||
}
|
||||
|
||||
void LexerModeAction::execute(Lexer *lexer) {
|
||||
lexer->mode(_mode);
|
||||
lexer->setMode(_mode);
|
||||
}
|
||||
|
||||
size_t LexerModeAction::hashCode() const {
|
||||
|
|
|
@ -104,7 +104,7 @@ int ParserATNSimulator::adaptivePredict(TokenStream *input, int decision, Ref<Pa
|
|||
|
||||
// Now we are certain to have a specific decision's DFA
|
||||
// But, do we still need an initial state?
|
||||
auto onExit = finally([&] {
|
||||
auto onExit = finally([this, input, index, m] {
|
||||
mergeCache.clear(); // wack cache after each prediction
|
||||
_dfa = nullptr;
|
||||
input->seek(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<ATNConfigSet> ParserATNSimulator::computeReachSet(Ref<ATNConfigSet> closure_
|
|||
if (is<RuleStopState *>(c->state)) {
|
||||
assert(c->context->isEmpty());
|
||||
|
||||
if (fullCtx || t == EOF) {
|
||||
if (fullCtx || t == Token::EOF) {
|
||||
skippedStopStates.push_back(c);
|
||||
}
|
||||
|
||||
|
@ -527,7 +527,7 @@ Ref<ATNConfigSet> ParserATNSimulator::computeReachSet(Ref<ATNConfigSet> 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<ATNConfigSet> ParserATNSimulator::computeReachSet(Ref<ATNConfigSet> closure_
|
|||
reach = std::make_shared<ATNConfigSet>(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<ATNConfig> ParserATNSimulator::getEpsilonTarget(Ref<ATNConfig> 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<ATNConfig>(config, t->target);
|
||||
}
|
||||
}
|
||||
|
@ -1135,7 +1135,7 @@ BitSet ParserATNSimulator::getConflictingAltsOrUniqueAlt(Ref<ATNConfigSet> 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<ATNConfigSet> configs) {
|
||||
if (debug || retry_debug) {
|
||||
misc::Interval interval = misc::Interval((int)startIndex, (int)stopIndex);
|
||||
|
|
|
@ -76,7 +76,7 @@ Ref<PredictionContext> PredictionContext::fromRuleContext(const ATN &atn, Ref<Ru
|
|||
|
||||
bool PredictionContext::operator != (const PredictionContext &o) const {
|
||||
return !(*this == o);
|
||||
};
|
||||
}
|
||||
|
||||
bool PredictionContext::isEmpty() const {
|
||||
return this == EMPTY.get();
|
||||
|
@ -109,7 +109,10 @@ size_t PredictionContext::calculateHashCode(const std::vector<std::weak_ptr<Pred
|
|||
size_t hash = MurmurHash::initialize(INITIAL_HASH);
|
||||
|
||||
for (auto parent : parents) {
|
||||
hash = MurmurHash::update(hash, parent.lock()->hashCode());
|
||||
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();
|
||||
}
|
||||
|
||||
|
|
|
@ -338,7 +338,7 @@ std::wstring SemanticContext::OR::toString() const {
|
|||
|
||||
const Ref<SemanticContext> SemanticContext::NONE = std::make_shared<Predicate>(-1, -1, false);
|
||||
|
||||
Ref<SemanticContext> SemanticContext::evalPrecedence(Recognizer */*parser*/, Ref<RuleContext> /*parserCallStack*/) {
|
||||
Ref<SemanticContext> SemanticContext::evalPrecedence(Recognizer * /*parser*/, Ref<RuleContext> /*parserCallStack*/) {
|
||||
return shared_from_this();
|
||||
}
|
||||
|
||||
|
|
|
@ -56,11 +56,13 @@ size_t SingletonPredictionContext::size() const {
|
|||
|
||||
std::weak_ptr<PredictionContext> 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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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"<EOF>";
|
||||
} else if (elemAreChar) {
|
||||
ss << L"'" << static_cast<wchar_t>(a) << L"'";
|
||||
|
@ -462,7 +462,7 @@ std::wstring IntervalSet::elementName(const std::vector<std::wstring> &tokenName
|
|||
}
|
||||
|
||||
std::wstring IntervalSet::elementName(Ref<dfa::Vocabulary> vocabulary, ssize_t a) const {
|
||||
if (a == EOF) {
|
||||
if (a == Token::EOF) {
|
||||
return L"<EOF>";
|
||||
} else if (a == Token::EPSILON) {
|
||||
return L"<EPSILON>";
|
||||
|
|
|
@ -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"
|
|
@ -88,7 +88,7 @@ namespace tree {
|
|||
/// The default implementation returns the result of
|
||||
/// <seealso cref="#defaultResult defaultResult"/>.
|
||||
/// </summary>
|
||||
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
|
||||
/// <seealso cref="#defaultResult defaultResult"/>.
|
||||
/// </summary>
|
||||
virtual T* visitErrorNode(ErrorNode *node) override {
|
||||
virtual T* visitErrorNode(/* ErrorNode *node */) override {
|
||||
return defaultResult();
|
||||
}
|
||||
|
||||
|
@ -135,7 +135,7 @@ namespace tree {
|
|||
/// a child node.
|
||||
/// </param>
|
||||
/// <returns> The updated aggregate result. </returns>
|
||||
virtual T* aggregateResult(T* aggregate, T* nextResult) {
|
||||
virtual T* aggregateResult(/* T* aggregate, */ T* nextResult) {
|
||||
return nextResult;
|
||||
}
|
||||
|
||||
|
@ -162,7 +162,7 @@ namespace tree {
|
|||
/// <returns> {@code true} to continue visiting children. Otherwise return
|
||||
/// {@code false} to stop visiting children and immediately return the
|
||||
/// current aggregate result from <seealso cref="#visitChildren"/>. </returns>
|
||||
virtual bool shouldVisitNextChild(RuleNode *node, T currentResult) {
|
||||
virtual bool shouldVisitNextChild(/*RuleNode *node, T currentResult*/) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
|
@ -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;
|
|
@ -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"<EOF>";
|
||||
}
|
||||
return symbol->getText();
|
||||
|
|
|
@ -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<Ref<Token>> ParseTreePatternMatcher::tokenize(const std::wstring &pa
|
|||
ANTLRInputStream input(textChunk.getText());
|
||||
_lexer->setInputStream(&input);
|
||||
Ref<Token> t = _lexer->nextToken();
|
||||
while (t->getType() != EOF) {
|
||||
while (t->getType() != Token::EOF) {
|
||||
tokens.push_back(t);
|
||||
t = _lexer->nextToken();
|
||||
}
|
||||
|
|
|
@ -41,30 +41,26 @@ cppTypeInitMap ::= [
|
|||
]
|
||||
|
||||
LexerHeader(lexer, atn, actionFuncs, sempredFuncs, superClass = {Lexer}) ::= <<
|
||||
<if (lexer.tokens)>
|
||||
class <lexer.name>Token {
|
||||
<namedActions.context>
|
||||
|
||||
class <lexer.name> : public <superClass> {
|
||||
public:
|
||||
<if (lexer.tokens)>
|
||||
enum {
|
||||
<lexer.tokens: {k | <k> = <lexer.tokens.(k)>}; separator=", ", wrap, anchor>
|
||||
};
|
||||
};
|
||||
<endif>
|
||||
|
||||
<if (lexer.modes)>
|
||||
class <lexer.name>Mode {
|
||||
public:
|
||||
enum {
|
||||
<lexer.modes: {m | <m> = <i>,}; separator="\n", anchor>
|
||||
};
|
||||
};
|
||||
<endif>
|
||||
|
||||
class <lexer.name> : public <if (superClass)><superClass><else>Lexer<endif> {
|
||||
public:
|
||||
<lexer.name>(CharStream *input);
|
||||
~<lexer.name>();
|
||||
|
||||
<namedActions.declarations>
|
||||
<namedActions.members>
|
||||
virtual std::wstring getGrammarFileName() const override;
|
||||
virtual const std::vector\<std::wstring>& getRuleNames() const override;
|
||||
|
||||
|
@ -94,7 +90,7 @@ private:
|
|||
static Ref\<dfa::Vocabulary> _vocabulary;
|
||||
<atn>
|
||||
|
||||
<namedActions.members>
|
||||
<namedActions.declarations>
|
||||
|
||||
// Individual action functions triggered by action() above.
|
||||
<actionFuncs.values; separator="\n">
|
||||
|
@ -110,7 +106,7 @@ private:
|
|||
>>
|
||||
|
||||
Lexer(lexer, atn, actionFuncs, sempredFuncs, superClass = {Lexer}) ::= <<
|
||||
<lexer.name>::<lexer.name>(CharStream *input) : <if (superClass)><superClass><else>Lexer<endif>(input) {
|
||||
<lexer.name>::<lexer.name>(CharStream *input) : <superClass>(input) {
|
||||
_interpreter = new atn::LexerATNSimulator(this, _atn, _decisionToDFA, _sharedContextCache);
|
||||
}
|
||||
|
||||
|
@ -245,7 +241,7 @@ bool <r.name>Sempred(Ref\<<r.ctxType>\> context, int predicateIndex);
|
|||
>>
|
||||
|
||||
RuleSempredFunction(r, actions) ::= <<
|
||||
bool <r.factory.grammar.name>::<r.name>Sempred(Ref\<<r.ctxType>\> context, int predicateIndex) {
|
||||
bool <r.factory.grammar.name>::<r.name>Sempred(Ref\<<r.ctxType>\> /*context*/, int predicateIndex) {
|
||||
switch (predicateIndex) {
|
||||
<actions: {index | case <index>: return <actions.(index)>;}; separator="\n">
|
||||
|
||||
|
@ -260,24 +256,22 @@ bool <r.factory.grammar.name>::<r.name>Sempred(Ref\<<r.ctxType>\> context, int p
|
|||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
ParserHeader(parser, funcs, atn, sempredFuncs, superClass = {Parser}) ::= <<
|
||||
<if (parser.tokens)>
|
||||
class <parser.name>Token {
|
||||
public:
|
||||
enum {
|
||||
<parser.tokens: {k | <k> = <parser.tokens.(k)>}; separator=", ", wrap, anchor>
|
||||
};
|
||||
};
|
||||
<endif>
|
||||
|
||||
class <parser.name>Rule {
|
||||
public:
|
||||
enum {
|
||||
<parser.rules: {r | Rule<r.name; format="cap"> = <r.index>}; separator=", ", wrap, anchor>
|
||||
};
|
||||
};
|
||||
<namedActions.context>
|
||||
|
||||
class <parser.name> : public <superClass> {
|
||||
public:
|
||||
<if (parser.tokens)>
|
||||
enum {
|
||||
<parser.tokens: {k | <k> = <parser.tokens.(k)>}; separator=", ", wrap, anchor>
|
||||
};
|
||||
<endif>
|
||||
|
||||
<if (parser.tokens)>
|
||||
enum {
|
||||
<parser.rules: {r | Rule<r.name; format="cap"> = <r.index>}; separator=", ", wrap, anchor>
|
||||
};
|
||||
<endif>
|
||||
|
||||
<parser.name>(TokenStream *input);
|
||||
~<parser.name>();
|
||||
|
||||
|
@ -287,7 +281,7 @@ public:
|
|||
virtual const std::vector\<std::wstring>& getRuleNames() const override;
|
||||
virtual Ref\<dfa::Vocabulary> getVocabulary() const override;
|
||||
|
||||
<namedActions.declarations>
|
||||
<namedActions.members>
|
||||
|
||||
<parser.funcs: {f | class <f.name; format = "cap">Context;}; separator = "\n"> <! Forward declare context classes. !>
|
||||
|
||||
|
@ -309,7 +303,7 @@ private:
|
|||
static Ref\<dfa::Vocabulary> _vocabulary;
|
||||
<atn>
|
||||
|
||||
<namedActions.members>
|
||||
<namedActions.declarations>
|
||||
|
||||
struct Initializer {
|
||||
Initializer();
|
||||
|
@ -443,13 +437,13 @@ RuleFunction(currentRule, args, code, locals, ruleCtx, altLabelCtxs, namedAction
|
|||
<ruleCtx>
|
||||
<! TODO: untested !><altLabelCtxs: {l | <altLabelCtxs.(l)>}; separator = "\n">
|
||||
Ref\<<parser.name>::<currentRule.ctxType>\> <parser.name>::<currentRule.name>(<args; separator=",">) {
|
||||
Ref\<<currentRule.ctxType>\> result = std::make_shared\<<currentRule.ctxType>\>(_ctx, getState()<currentRule.args:{a | , <a.name>}>);
|
||||
enterRule(result, <currentRule.startState>, <parser.name>Rule::Rule<currentRule.name; format = "cap">);
|
||||
Ref\<<currentRule.ctxType>\> _localctx = std::make_shared\<<currentRule.ctxType>\>(_ctx, getState()<currentRule.args:{a | , <a.name>}>);
|
||||
enterRule(_localctx, <currentRule.startState>, <parser.name>::Rule<currentRule.name; format = "cap">);
|
||||
<namedActions.init>
|
||||
<! TODO: untested !> <locals; separator = "\n">
|
||||
<locals; separator = "\n">
|
||||
|
||||
auto onExit = finally([this] {
|
||||
<! TODO: untested !><if (finallyAction)><finallyAction><endif>
|
||||
auto onExit = finally([=] {
|
||||
<finallyAction>
|
||||
exitRule();
|
||||
});
|
||||
try {
|
||||
|
@ -464,13 +458,13 @@ Ref\<<parser.name>::<currentRule.ctxType>\> <parser.name>::<currentRule.name>(<a
|
|||
<exceptions; separator="\n">
|
||||
<else>
|
||||
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);
|
||||
}
|
||||
<endif>
|
||||
|
||||
return result;
|
||||
return _localctx;
|
||||
}
|
||||
>>
|
||||
|
||||
|
@ -492,15 +486,15 @@ Ref\<<parser.name>::<currentRule.ctxType>\> <parser.name>::<currentRule.name>(<c
|
|||
Ref\<<parser.name>::<currentRule.ctxType>\> <parser.name>::<currentRule.name>(int precedence<currentRule.args:{a | , <a>}>) {
|
||||
Ref\<ParserRuleContext> parentContext = _ctx;
|
||||
int parentState = getState();
|
||||
Ref\<<parser.name>::<currentRule.ctxType>\> result = std::make_shared\<<currentRule.ctxType>\>(_ctx, parentState<currentRule.args: {a | , <a.name>}>);
|
||||
Ref\<<parser.name>::<currentRule.ctxType>\> previousContext = result;
|
||||
Ref\<<parser.name>::<currentRule.ctxType>\> _localctx = std::make_shared\<<currentRule.ctxType>\>(_ctx, parentState<currentRule.args: {a | , <a.name>}>);
|
||||
Ref\<<parser.name>::<currentRule.ctxType>\> previousContext = _localctx;
|
||||
int startState = <currentRule.startState>;
|
||||
enterRecursionRule(result, <currentRule.startState>, <parser.name>Rule::Rule<currentRule.name; format = "cap">, precedence);
|
||||
enterRecursionRule(_localctx, <currentRule.startState>, <parser.name>::Rule<currentRule.name; format = "cap">, precedence);
|
||||
|
||||
<namedActions.init>
|
||||
<! TODO: untested !> <locals; separator = "\n">
|
||||
|
||||
auto onExit = finally([&] {
|
||||
auto onExit = finally([=] {
|
||||
<! TODO: untested !><if (finallyAction)><finallyAction><endif>
|
||||
unrollRecursionContexts(parentContext);
|
||||
});
|
||||
|
@ -511,11 +505,11 @@ Ref\<<parser.name>::<currentRule.ctxType>\> <parser.name>::<currentRule.name>(in
|
|||
<namedActions.after>
|
||||
}
|
||||
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
|
|||
<getters: {g | <g>}; separator = "\n">
|
||||
|
||||
ssize_t <parser.name>::<struct.name>::getRuleIndex() const {
|
||||
return (ssize_t)<parser.name>Rule::Rule<struct.derivedFromName; format = "cap">;
|
||||
return <parser.name>::Rule<struct.derivedFromName; format = "cap">;
|
||||
}
|
||||
|
||||
<if (struct.provideCopyFrom)>
|
||||
|
@ -598,9 +592,9 @@ AltLabelStructDecl(struct, attrs, getters, dispatchMethods) ::= <<
|
|||
CodeBlockForOuterMostAltHeader(currentOuterMostAltCodeBlock, locals, preamble, ops) ::= "<! Required to exist, but unused. !>"
|
||||
CodeBlockForOuterMostAlt(currentOuterMostAltCodeBlock, locals, preamble, ops) ::= <<
|
||||
<if (currentOuterMostAltCodeBlock.altLabel)>
|
||||
result = std::dynamic_pointer_cast\<<currentRule.ctxType>\>(std::make_shared\<<parser.name>::<currentOuterMostAltCodeBlock.altLabel; format = "cap">Context>(result));
|
||||
_localctx = std::dynamic_pointer_cast\<<currentRule.ctxType>\>(std::make_shared\<<parser.name>::<currentOuterMostAltCodeBlock.altLabel; format = "cap">Context>(_localctx));
|
||||
<endif>
|
||||
enterOuterAlt(result, <currentOuterMostAltCodeBlock.alt.altNum>);
|
||||
enterOuterAlt(_localctx, <currentOuterMostAltCodeBlock.alt.altNum>);
|
||||
<CodeBlockForAlt(currentAltCodeBlock = currentOuterMostAltCodeBlock, ...)>
|
||||
>>
|
||||
|
||||
|
@ -619,46 +613,46 @@ _errHandler->sync(this);
|
|||
<preamble; separator="\n">
|
||||
switch (_input->LA(1)) {
|
||||
<choice.altLook, alts: {look, alt | <cases(ttypes = look)>
|
||||
<alt>
|
||||
break;
|
||||
<alt>
|
||||
break;
|
||||
}; separator = "\n">
|
||||
default:
|
||||
<error>
|
||||
<error>
|
||||
}
|
||||
>>
|
||||
|
||||
LL1OptionalBlockHeader(choice, alts, error) ::= <<LL1OptionalBlockHeader(choice, alts, error)>>
|
||||
LL1OptionalBlock(choice, alts, error) ::= <<LL1OptionalBlock(choice, alts, error)
|
||||
setState(<choice.stateNumber>);YYY
|
||||
LL1OptionalBlockHeader(choice, alts, error) ::= "<! Required but unused. !>"
|
||||
LL1OptionalBlock(choice, alts, error) ::= <<
|
||||
setState(<choice.stateNumber>);
|
||||
switch (_input->LA(1)) {
|
||||
<choice.altLook,alts:{look,alt| <cases(ttypes=look)>
|
||||
<alt>
|
||||
break;}; separator="\n">
|
||||
<choice.altLook, alts: {look, alt | <cases(ttypes = look)>
|
||||
<alt>
|
||||
break;}; separator="\n">
|
||||
default:
|
||||
<error>
|
||||
<error>
|
||||
}
|
||||
>>
|
||||
|
||||
LL1OptionalBlockSingleAltHeader(choice, expr, alts, preamble, error, followExpr) ::= "<! Required to exist, but unused. !>"
|
||||
LL1OptionalBlockSingleAltHeader(choice, expr, alts, preamble, error, followExpr) ::= "<! Required but unused. !>"
|
||||
LL1OptionalBlockSingleAlt(choice, expr, alts, preamble, error, followExpr) ::= <<
|
||||
setState(<choice.stateNumber>);
|
||||
|
||||
<preamble; separator = "\n">
|
||||
if (<expr>) {
|
||||
<alts; separator = "\n">
|
||||
<alts; separator = "\n">
|
||||
}
|
||||
>>
|
||||
|
||||
LL1StarBlockSingleAltHeader(choice, loopExpr, alts, preamble, iteration) ::= "LL1StarBlockSingleAltHeader"
|
||||
LL1StarBlockSingleAltHeader(choice, loopExpr, alts, preamble, iteration) ::= "<! Required but unused. !>"
|
||||
LL1StarBlockSingleAlt(choice, loopExpr, alts, preamble, iteration) ::= <<
|
||||
setState(<choice.stateNumber>);
|
||||
_errHandler->sync(this);
|
||||
<preamble; separator="\n">
|
||||
while (<loopExpr>) {
|
||||
<alts; separator="\n">
|
||||
setState(<choice.loopBackStateNumber>);
|
||||
_errHandler->sync(this);
|
||||
<iteration>
|
||||
<alts; separator="\n">
|
||||
setState(<choice.loopBackStateNumber>);
|
||||
_errHandler->sync(this);
|
||||
<iteration>
|
||||
}
|
||||
>>
|
||||
|
||||
|
@ -668,10 +662,10 @@ setState(<choice.blockStartStateNumber>); <! alt block decision !>
|
|||
_errHandler->sync(this);
|
||||
<preamble; separator="\n">
|
||||
do {
|
||||
<alts; separator="\n">
|
||||
setState(<choice.stateNumber>); <! loopback/exit decision !>
|
||||
_errHandler->sync(this);
|
||||
<iteration>
|
||||
<alts; separator="\n">
|
||||
setState(<choice.stateNumber>); <! loopback/exit decision !>
|
||||
_errHandler->sync(this);
|
||||
<iteration>
|
||||
} while (<loopExpr>);
|
||||
>>
|
||||
|
||||
|
@ -685,8 +679,8 @@ _errHandler->sync(this);
|
|||
<! TODO: untested !><preamble; separator = "\n">
|
||||
switch (getInterpreter\<atn::ParserATNSimulator>()->adaptivePredict(_input, <choice.decision>, _ctx)) {
|
||||
<alts: {alt | case <i>:
|
||||
<alt>
|
||||
break;
|
||||
<alt>
|
||||
break;
|
||||
}; separator="\n">
|
||||
}
|
||||
>>
|
||||
|
@ -698,8 +692,8 @@ _errHandler->sync(this);
|
|||
|
||||
switch (getInterpreter\<atn::ParserATNSimulator>()->adaptivePredict(_input, <choice.decision>, _ctx)) {
|
||||
<alts: {alt | case <i><if (!choice.ast.greedy)>+1<endif>:
|
||||
<alt>
|
||||
break;
|
||||
<alt>
|
||||
break;
|
||||
}; separator = "\n">
|
||||
}
|
||||
>>
|
||||
|
@ -710,13 +704,13 @@ setState(<choice.stateNumber>);
|
|||
_errHandler->sync(this);
|
||||
alt = getInterpreter\<atn::ParserATNSimulator>()->adaptivePredict(_input, <choice.decision>, _ctx);
|
||||
while (alt != <choice.exitAlt> && alt != -1) {
|
||||
if ( alt == 1 <if(!choice.ast.greedy)>+ 1<endif>) {
|
||||
<iteration>
|
||||
<alts> <! should only be one !>
|
||||
}
|
||||
setState(<choice.loopBackStateNumber>);
|
||||
_errHandler->sync(this);
|
||||
alt = getInterpreter\<atn::ParserATNSimulator>()->adaptivePredict(_input, <choice.decision>, _ctx);
|
||||
if ( alt == 1 <if(!choice.ast.greedy)>+ 1<endif>) {
|
||||
<iteration>
|
||||
<alts> <! should only be one !>
|
||||
}
|
||||
setState(<choice.loopBackStateNumber>);
|
||||
_errHandler->sync(this);
|
||||
alt = getInterpreter\<atn::ParserATNSimulator>()->adaptivePredict(_input, <choice.decision>, _ctx);
|
||||
}
|
||||
>>
|
||||
|
||||
|
@ -726,17 +720,17 @@ setState(<choice.blockStartStateNumber>); <! alt block decision !>
|
|||
_errHandler->sync(this);
|
||||
alt = getInterpreter\<atn::ParserATNSimulator>()->adaptivePredict(_input, <choice.decision>, _ctx);
|
||||
do {
|
||||
switch (alt) {
|
||||
<alts: {alt | case <i><if (!choice.ast.greedy)> + 1<endif>:
|
||||
<alt>
|
||||
break;
|
||||
}; separator="\n">
|
||||
default:
|
||||
<error>
|
||||
}
|
||||
setState(<choice.loopBackStateNumber>); <! loopback/exit decision !>
|
||||
_errHandler->sync(this);
|
||||
alt = getInterpreter\<atn::ParserATNSimulator>()->adaptivePredict(_input, <choice.decision>, _ctx);
|
||||
switch (alt) {
|
||||
<alts: {alt | case <i><if (!choice.ast.greedy)> + 1<endif>:
|
||||
<alt>
|
||||
break;
|
||||
}; separator="\n">
|
||||
default:
|
||||
<error>
|
||||
}
|
||||
setState(<choice.loopBackStateNumber>); <! loopback/exit decision !>
|
||||
_errHandler->sync(this);
|
||||
alt = getInterpreter\<atn::ParserATNSimulator>()->adaptivePredict(_input, <choice.decision>, _ctx);
|
||||
} while (alt != <choice.exitAlt> && alt != -1);
|
||||
>>
|
||||
|
||||
|
@ -767,16 +761,16 @@ isZero ::= [
|
|||
]
|
||||
|
||||
offsetShift(shiftAmount, offset, prefix = false) ::= <%
|
||||
<if (!isZero.(offset))>(<if (prefix)><parser.name>Token::<endif><shiftAmount> - <offset>)<else><if (prefix)><parser.name>Token::<endif><shiftAmount><endif>
|
||||
<if (!isZero.(offset))>(<if (prefix)><parser.name>::<endif><shiftAmount> - <offset>)<else><if (prefix)><parser.name>::<endif><shiftAmount><endif>
|
||||
%>
|
||||
|
||||
// produces more efficient bytecode when bits.ttypes contains at most two items
|
||||
bitsetInlineComparison(s, bits) ::= <%
|
||||
<bits.ttypes: {ttype | <s.varName> == <parser.name>Token::<ttype>}; separator = " || ">
|
||||
<bits.ttypes: {ttype | <s.varName> == <parser.name>::<ttype>}; separator = " || ">
|
||||
%>
|
||||
|
||||
cases(ttypes) ::= <<
|
||||
<ttypes: {t | case <parser.name>Token::<t>:}; separator="\n">
|
||||
<ttypes: {t | case <parser.name>::<t>:}; separator="\n">
|
||||
>>
|
||||
|
||||
InvokeRuleHeader(r, argExprsChunks) ::= "InvokeRuleHeader"
|
||||
|
@ -789,7 +783,7 @@ setState(<r.stateNumber>);
|
|||
MatchTokenHeader(m) ::= "<! Required but unused. !>"
|
||||
MatchToken(m) ::= <<
|
||||
setState(<m.stateNumber>);
|
||||
<if (m.labels)><m.labels: {l | <labelref(l)> = }><endif>match(<parser.name>Token::<m.name>);
|
||||
<if (m.labels)><m.labels: {l | <labelref(l)> = }><endif>match(<parser.name>::<m.name>);
|
||||
>>
|
||||
|
||||
MatchSetHeader(m, expr, capture) ::= "<! Required but unused. !>"
|
||||
|
@ -833,7 +827,7 @@ if (!(<chunks>)) throw FailedPredicateException(this, <p.predicate><if (failChun
|
|||
ExceptionClauseHeader(e, catchArg, catchAction) ::= "<! Required but unused. !>"
|
||||
ExceptionClause(e, catchArg, catchAction) ::= <<
|
||||
catch (<catchArg>) {
|
||||
<catchAction>
|
||||
<catchAction>
|
||||
}
|
||||
>>
|
||||
|
||||
|
@ -843,9 +837,9 @@ LexerSkipCommand() ::= "skip();"
|
|||
LexerMoreCommand() ::= "more();"
|
||||
LexerPopModeCommand() ::= "popMode();"
|
||||
|
||||
LexerTypeCommand(arg, grammar) ::= "_type = <grammar.name>Token::<arg>;"
|
||||
LexerChannelCommand(arg, grammar) ::= "_channel = <arg>;"
|
||||
LexerModeCommand(arg, grammar) ::= "_mode = <grammar.name>Mode::<arg>;"
|
||||
LexerTypeCommand(arg, grammar) ::= "type = <grammar.name>::<arg>;"
|
||||
LexerChannelCommand(arg, grammar) ::= "channel = <arg>;"
|
||||
LexerModeCommand(arg, grammar) ::= "mode = <grammar.name>Mode::<arg>;"
|
||||
LexerPushModeCommand(arg, grammar) ::= "pushMode(<grammar.name>Mode::<arg>);"
|
||||
|
||||
// TODO: untested
|
||||
|
@ -855,9 +849,9 @@ ActionText(t) ::= "<t.text>"
|
|||
ActionTemplateHeader(t) ::= "<! Unused but must be present. !>"
|
||||
ActionTemplate(t) ::= "<t.st>"
|
||||
|
||||
ArgRef(a) ::= "ArgRef(a) result.<a.name>"
|
||||
LocalRef(a) ::= "LocalRef(a) result.<a.name>"
|
||||
RetValueRef(a) ::= "RetValueRef(a) result.<a.name>"
|
||||
ArgRef(a) ::= "ArgRef(a) _localctx.<a.name>"
|
||||
LocalRef(a) ::= "LocalRef(a) _localctx.<a.name>"
|
||||
RetValueRef(a) ::= "RetValueRef(a) _localctx.<a.name>"
|
||||
QRetValueRef(a) ::= "QRetValueRef(a) <ctx(a)>.<a.dict>.<a.name>"
|
||||
/** How to translate $tokenLabel */
|
||||
TokenRef(t) ::= "TokenRef(t) <ctx(t)>.<t.name>"
|
||||
|
@ -867,7 +861,9 @@ SetAttr(s,rhsChunks) ::= "SetAttr(s,rhsChunks) <ctx(s)>.<s.name> = <rhsChunks>;"
|
|||
|
||||
InputSymbolType() ::= "<file.InputSymbolType; null = {Token}> *"
|
||||
|
||||
TokenPropertyRef_text(t) ::= "TokenPropertyRef_text(t) (<ctx(t)>.<t.label> != nullptr ? <ctx(t)>.<t.label>.getText() : null)"
|
||||
TokenPropertyRef_textHeader(t) ::= "<! Required but unused. !>"
|
||||
TokenPropertyRef_text(t) ::= "(<ctx(t)>-><t.label> != nullptr ? <ctx(t)>-><t.label>->getText() : nullptr)"
|
||||
|
||||
TokenPropertyRef_type(t) ::= "TokenPropertyRef_type(t) (<ctx(t)>.<t.label> != nullptr ? <ctx(t)>.<t.label>.getType() : 0)"
|
||||
TokenPropertyRef_line(t) ::= "TokenPropertyRef_line(t) (<ctx(t)>.<t.label> != nullptr ? <ctx(t)>.<t.label>.getLine() : 0)"
|
||||
TokenPropertyRef_pos(t) ::= "TokenPropertyRef_pos(t) (<ctx(t)>.<t.label> != nullptr ? <ctx(t)>.<t.label>.getCharPositionInLine() : 0)"
|
||||
|
@ -880,14 +876,14 @@ RulePropertyRef_stop(r) ::= "RulePropertyRef_stop(r) (<ctx(r)>.<r.label> != n
|
|||
RulePropertyRef_text(r) ::= "RulePropertyRef_text(r) (<ctx(r)>.<r.label> != nullptr ? _input->getText(<ctx(r)>.<r.label>.start,<ctx(r)>.<r.label>.stop) : null)"
|
||||
RulePropertyRef_ctx(r) ::= "RulePropertyRef_ctx(r)<ctx(r)>.<r.label>"
|
||||
|
||||
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) ((<s.ruleName; format=\"cap\">Context)getInvokingContext(<s.ruleIndex>)).<s.name>"
|
||||
SetNonLocalAttr(s, rhsChunks) ::=
|
||||
"SetNonLocalAttr(s, rhsChunks) ((<s.ruleName; format=\"cap\">Context)getInvokingContext(<s.ruleIndex>)).<s.name> = <rhsChunks>;"
|
||||
"SetNonLocalAttr(s, rhsChunks) ((<s.ruleName; format=\"cap\">Context)getInvokingContext(<s.ruleIndex>)).<s.name> = <rhsChunks>;"
|
||||
|
||||
AddToLabelListHeader(a) ::= "<! Required but unused. !>"
|
||||
AddToLabelList(a) ::= <<
|
||||
|
@ -914,7 +910,7 @@ RuleContextListDecl(rdecl) ::= "<! Variable Declaration !>"
|
|||
ContextTokenGetterDeclHeader(t) ::= "Ref\<tree::TerminalNode> <t.name>();"
|
||||
ContextTokenGetterDecl(t) ::= <<
|
||||
Ref\<tree::TerminalNode> <parser.name>::<t.ctx.name>::<t.name>() {
|
||||
return getToken(<parser.name>Token::<t.name>, 0);
|
||||
return getToken(<parser.name>::<t.name>, 0);
|
||||
}
|
||||
|
||||
>>
|
||||
|
@ -922,7 +918,7 @@ Ref\<tree::TerminalNode> <parser.name>::<t.ctx.name>::<t.name>() {
|
|||
ContextTokenListGetterDeclHeader(t) ::= "std::vector\<Ref\<tree::TerminalNode>> <t.name>();"
|
||||
ContextTokenListGetterDecl(t) ::= <<
|
||||
std::vector\<Ref\<tree::TerminalNode>\> <parser.name>::<t.ctx.name>::<t.name>() {
|
||||
return getTokens(<parser.name>Token::<t.name>);
|
||||
return getTokens(<parser.name>::<t.name>);
|
||||
}
|
||||
|
||||
>>
|
||||
|
@ -930,7 +926,7 @@ std::vector\<Ref\<tree::TerminalNode>\> <parser.name>::<t.ctx.name>::<t.name>()
|
|||
ContextTokenListIndexedGetterDeclHeader(t) ::= "Ref\<tree::TerminalNode> <t.name>(int i);"
|
||||
ContextTokenListIndexedGetterDecl(t) ::= <<
|
||||
Ref\<tree::TerminalNode> <parser.name>::<t.ctx.name>::<t.name>(int i) {
|
||||
return getToken(<parser.name>Token::<t.name>, (size_t)i);
|
||||
return getToken(<parser.name>::<t.name>, (size_t)i);
|
||||
}
|
||||
|
||||
>>
|
||||
|
@ -1005,10 +1001,10 @@ AttributeDeclHeader(d) ::= "<d.type> <d.name><if(d.initValue)> = <d.initValue><e
|
|||
AttributeDecl(d) ::= "<d.type> <d.name>"
|
||||
|
||||
/** If we don't know location of label def x, use this template */
|
||||
labelref(x) ::= "<if (!x.isLocal)>result<endif>-><x.name>"
|
||||
labelref(x) ::= "<if (!x.isLocal)>_localctx<endif>-><x.name>"
|
||||
|
||||
/** For any action chunk, what is correctly-typed context struct ptr? */
|
||||
ctx(actionChunk) ::= "result"
|
||||
ctx(actionChunk) ::= "_localctx"
|
||||
|
||||
// used for left-recursive rules
|
||||
recRuleAltPredicate(ruleName,opPrec) ::= "precpred(_ctx, <opPrec>)"
|
||||
|
@ -1016,27 +1012,27 @@ recRuleSetReturnAction(src,name) ::= "recRuleSetReturnAction(src,name) $<name>=$
|
|||
recRuleSetStopToken() ::= "_ctx->stop = _input->LT(-1);"
|
||||
|
||||
recRuleAltStartAction(ruleName, ctxName, label) ::= <<
|
||||
result = std::make_shared\<<ctxName>Context>(parentContext, parentState);
|
||||
<if (label)>result-><label> = previousContext;<endif>
|
||||
pushNewRecursionContext(result, startState, <parser.name>Rule::Rule<ruleName; format = "cap">);
|
||||
_localctx = std::make_shared\<<ctxName>Context>(parentContext, parentState);
|
||||
<if (label)>_localctx-><label> = previousContext;<endif>
|
||||
pushNewRecursionContext(_localctx, startState, <parser.name>::Rule<ruleName; format = "cap">);
|
||||
>>
|
||||
|
||||
recRuleLabeledAltStartAction(ruleName, currentAltLabel, label) ::= <<recRuleLabeledAltStartAction
|
||||
result = std::make_shared\<<currentAltLabel; format = "cap">Context>(new <ruleName; format="cap">Context(_parentctx, _parentState));
|
||||
<if(label)>((<currentAltLabel; format="cap">Context*)result).<label> = previousContext;<endif>
|
||||
pushNewRecursionContext(result, _startState, RULE_<ruleName>);
|
||||
_localctx = std::make_shared\<<currentAltLabel; format = "cap">Context>(new <ruleName; format="cap">Context(_parentctx, _parentState));
|
||||
<if(label)>((<currentAltLabel; format="cap">Context*)_localctx).<label> = previousContext;<endif>
|
||||
pushNewRecursionContext(_localctx, _startState, RULE_<ruleName>);
|
||||
>>
|
||||
|
||||
recRuleReplaceContext(ctxName) ::= <<recRuleReplaceContext
|
||||
result = std::make_shared\<<ctxName>Context>(_localctx);
|
||||
ctx = result;
|
||||
previousContext = result;
|
||||
_localctx = std::make_shared\<<ctxName>Context>(_localctx);
|
||||
ctx = _localctx;
|
||||
previousContext = _localctx;
|
||||
>>
|
||||
|
||||
recRuleSetPrevCtx() ::= <<
|
||||
if (!_parseListeners.empty())
|
||||
triggerExitRuleEvent();
|
||||
previousContext = result;
|
||||
previousContext = _localctx;
|
||||
>>
|
||||
|
||||
/** Using a type to init value map, try to init a type; if not in table
|
||||
|
|
|
@ -49,8 +49,6 @@ LexerFileHeader(file, lexer, namedActions) ::= <<
|
|||
|
||||
<namedActions.postinclude>
|
||||
|
||||
// Have to use "using namespace" here, because some code parts which require different namespaces
|
||||
// are generated from the same template (e.g. see xxxSempred(.. *context) here and in the parser header.
|
||||
using namespace org::antlr::v4::runtime;
|
||||
|
||||
<if(file.genPackage)>namespace <file.genPackage> {<endif>
|
||||
|
@ -169,14 +167,14 @@ public:
|
|||
<namedActions.baselistenerdeclarations>
|
||||
|
||||
<file.listenerNames: {lname |
|
||||
void enter<lname; format="cap">(<file.parserName>::<lname; format = "cap">Context *ctx) { \}
|
||||
void exit<lname; format="cap">(<file.parserName>::<lname; format = "cap">Context *ctx) { \}
|
||||
void enter<lname; format="cap">(<file.parserName>::<lname; format = "cap">Context * /*ctx*/) { \}
|
||||
void exit<lname; format="cap">(<file.parserName>::<lname; format = "cap">Context * /*ctx*/) { \}
|
||||
}; separator="\n">
|
||||
|
||||
void enterEveryRule(Ref\<ParserRuleContext> ctx) { }
|
||||
void exitEveryRule(Ref\<ParserRuleContext> ctx) { }
|
||||
void visitTerminal(Ref\<tree::TerminalNode> node) { }
|
||||
void visitErrorNode(Ref\<tree::ErrorNode> node) { }
|
||||
void enterEveryRule(Ref\<ParserRuleContext> /*ctx*/) { }
|
||||
void exitEveryRule(Ref\<ParserRuleContext> /*ctx*/) { }
|
||||
void visitTerminal(Ref\<tree::TerminalNode> /*node*/) { }
|
||||
void visitErrorNode(Ref\<tree::ErrorNode> /*node*/) { }
|
||||
|
||||
<if (namedActions.baselistenermembers)>
|
||||
private:
|
||||
|
|
Loading…
Reference in New Issue