From d96b0d9199c75b5d61a10418e355ee0ce2bafc19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Tr=C3=A1vn=C3=AD=C4=8Dek?= <jan.travnicek@fit.cvut.cz> Date: Thu, 25 Nov 2021 10:26:47 +0100 Subject: [PATCH] Revert "str: tune the pair from string parsing" This reverts commit bc91e284da86b82f2e342f5aa5a5dfa81e83e603. Parser can't parse automata string inputs where a state containing a pair is also a final state. NFA a b c d ><<(InitialStateLabel), 0> <a, 1> <b, 2> <c, 3> - <<a, 1> <a, 1> - - - <b, 2> - <b, 2> <c, 3> - <c, 3> - - - <d, 4> <<d, 4> - - - - --- alib2str/src/container/ContainerFromStringLexer.cpp | 4 ++-- alib2str/src/container/string/ObjectsPair.h | 4 ++-- alib2str/test-src/object/ObjectTest.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/alib2str/src/container/ContainerFromStringLexer.cpp b/alib2str/src/container/ContainerFromStringLexer.cpp index 4740fd6ddd..31abfa4da2 100644 --- a/alib2str/src/container/ContainerFromStringLexer.cpp +++ b/alib2str/src/container/ContainerFromStringLexer.cpp @@ -37,12 +37,12 @@ L0: token.value += character; token.raw += character; return token; - } else if(character == '<') { + } else if(character == '(') { token.type = TokenType::PAIR_BEGIN; token.value += character; token.raw += character; return token; - } else if(character == '>') { + } else if(character == ')') { token.type = TokenType::PAIR_END; token.value += character; token.raw += character; diff --git a/alib2str/src/container/string/ObjectsPair.h b/alib2str/src/container/string/ObjectsPair.h index 054c391aa5..4fdd28084e 100644 --- a/alib2str/src/container/string/ObjectsPair.h +++ b/alib2str/src/container/string/ObjectsPair.h @@ -45,7 +45,7 @@ bool stringApi < std::pair < FirstType, SecondType > >::first ( ext::istream & i template<class FirstType, class SecondType > void stringApi < std::pair < FirstType, SecondType > >::compose ( ext::ostream & output, const std::pair < FirstType, SecondType > & container ) { - output << "<"; + output << "("; stringApi < FirstType >::compose ( output, container.first ); @@ -53,7 +53,7 @@ void stringApi < std::pair < FirstType, SecondType > >::compose ( ext::ostream & stringApi < SecondType >::compose ( output, container.second ); - output << ">"; + output << ")"; } template<class FirstType, class SecondType > diff --git a/alib2str/test-src/object/ObjectTest.cpp b/alib2str/test-src/object/ObjectTest.cpp index 75531d4342..2c1329f4b3 100644 --- a/alib2str/test-src/object/ObjectTest.cpp +++ b/alib2str/test-src/object/ObjectTest.cpp @@ -7,7 +7,7 @@ TEST_CASE ( "Object Test", "[unit][object][label]" ) { SECTION ( "Composing" ) { - std::string input = "<1, 2>'"; + std::string input = "(1, 2)'"; object::Object label = factory::StringDataFactory::fromString (input); std::string output = factory::StringDataFactory::toString(label); -- GitLab