From d369ff33faa4bf5654db3f1eb105141fccf2270d Mon Sep 17 00:00:00 2001 From: Andreas Stöckel Date: Sat, 11 Apr 2015 16:51:38 +0200 Subject: Reimplement closeToken handling Idea: Only start unrolling anything on the parser stack if an element that matches the given close token is found. This requires the endToken method in DocumentChildHandler to search for the given descriptor that might be ended. While performing this search, only a specified number of "explicit" structures/fields opened by the Stack class may be skipped (those with implicit default fields). Added an integration test ("python_code") which requires this new (hopefully sane) behaviour. --- test/core/parser/stack/StackTest.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/core/parser/stack/StackTest.cpp b/test/core/parser/stack/StackTest.cpp index af2b8e8..e23cde7 100644 --- a/test/core/parser/stack/StackTest.cpp +++ b/test/core/parser/stack/StackTest.cpp @@ -66,7 +66,7 @@ struct Tracker { bool startCommandResult; bool startAnnotationResult; bool startTokenResult; - Handler::EndTokenResult endTokenResult; + EndTokenResult endTokenResult; bool fieldStartResult; bool dataResult; @@ -96,7 +96,7 @@ struct Tracker { startCommandResult = true; startAnnotationResult = true; startTokenResult = true; - endTokenResult = Handler::EndTokenResult::ENDED_THIS; + endTokenResult = EndTokenResult(); fieldStartResult = true; dataResult = true; @@ -157,7 +157,7 @@ public: return tracker.startTokenResult; } - EndTokenResult endToken(const Token &token, Handle node) override + EndTokenResult endToken(Handle node, size_t maxStackDepth) override { tracker.endTokenCount++; return tracker.endTokenResult; -- cgit v1.2.3