forked from jasder/antlr
Demo app on Windows is working now.
- Class ATN is currently leaking states (delete disabled in d-tor) until I have found a solution for the failing return value optimization from ATNDeserializer::deserialize(). - Added member init in BlockEndState.
This commit is contained in:
parent
77d0a6c32a
commit
5ab89e38bd
|
@ -14,6 +14,8 @@
|
|||
|
||||
#include "Strings.h"
|
||||
|
||||
#include <Windows.h>
|
||||
|
||||
using namespace antlrcpptest;
|
||||
using namespace org::antlr::v4::runtime;
|
||||
|
||||
|
@ -25,7 +27,8 @@ int main(int argc, const char * argv[]) {
|
|||
TParser parser(&tokens);
|
||||
std::shared_ptr<tree::ParseTree> tree = parser.main();
|
||||
|
||||
std::cout << antlrcpp::ws2s(tree->toStringTree(&parser)) << std::endl;
|
||||
std::wstring s = tree->toStringTree(&parser);
|
||||
OutputDebugString(s.data());
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ ATN::ATN() : ATN(ATNType::LEXER, 0) {
|
|||
/**
|
||||
* Required to be defined (even though not used) as we have an explicit move assignment operator.
|
||||
*/
|
||||
ATN::ATN(const ATN& other) {
|
||||
ATN::ATN(const ATN &other) {
|
||||
states = other.states;
|
||||
decisionToState = other.decisionToState;
|
||||
ruleToStartState = other.ruleToStartState;
|
||||
|
@ -69,7 +69,7 @@ ATN::ATN(ATNType grammarType, size_t maxTokenType) : grammarType(grammarType), m
|
|||
|
||||
ATN::~ATN() {
|
||||
for (ATNState *state : states) {
|
||||
delete state;
|
||||
//delete state;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -33,10 +33,12 @@
|
|||
|
||||
using namespace org::antlr::v4::runtime::atn;
|
||||
|
||||
ActionTransition::ActionTransition(ATNState *target, int ruleIndex) : Transition(target), ruleIndex(ruleIndex), actionIndex(0), isCtxDependent(false) {
|
||||
ActionTransition::ActionTransition(ATNState *target, int ruleIndex)
|
||||
: Transition(target), ruleIndex(ruleIndex), actionIndex(0), isCtxDependent(false) {
|
||||
}
|
||||
|
||||
ActionTransition::ActionTransition(ATNState *target, int ruleIndex, int actionIndex, bool isCtxDependent) : Transition(target), ruleIndex(ruleIndex), actionIndex(actionIndex), isCtxDependent(isCtxDependent) {
|
||||
ActionTransition::ActionTransition(ATNState *target, int ruleIndex, int actionIndex, bool isCtxDependent)
|
||||
: Transition(target), ruleIndex(ruleIndex), actionIndex(actionIndex), isCtxDependent(isCtxDependent) {
|
||||
}
|
||||
|
||||
int ActionTransition::getSerializationType() const {
|
||||
|
|
|
@ -33,6 +33,9 @@
|
|||
|
||||
using namespace org::antlr::v4::runtime::atn;
|
||||
|
||||
BlockEndState::BlockEndState() : startState(nullptr) {
|
||||
}
|
||||
|
||||
int BlockEndState::getStateType() {
|
||||
return BLOCK_END;
|
||||
}
|
||||
|
|
|
@ -45,6 +45,8 @@ namespace atn {
|
|||
public:
|
||||
BlockStartState *startState;
|
||||
|
||||
BlockEndState();
|
||||
|
||||
virtual int getStateType() override;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue