From 6cb83136dbcb24606f519857a759f4c1ec1a070b Mon Sep 17 00:00:00 2001
From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz>
Date: Sun, 4 Nov 2018 17:01:42 +0100
Subject: [PATCH] windows newlines in automata parser again

---
 alib2str/src/automaton/string/FSM/DFA.h        |  3 ---
 alib2str/src/automaton/string/FSM/EpsilonNFA.h |  3 ---
 alib2str/src/automaton/string/FSM/NFA.h        |  3 ---
 alib2str/test-src/automaton/AutomatonTest.cpp  | 13 +++++++++----
 examples2/automaton/DFA3.txt                   | 18 ++++++++++++++++++
 5 files changed, 27 insertions(+), 13 deletions(-)
 create mode 100644 examples2/automaton/DFA3.txt

diff --git a/alib2str/src/automaton/string/FSM/DFA.h b/alib2str/src/automaton/string/FSM/DFA.h
index 0a7ac71448..cd81b2bddf 100644
--- a/alib2str/src/automaton/string/FSM/DFA.h
+++ b/alib2str/src/automaton/string/FSM/DFA.h
@@ -54,9 +54,6 @@ automaton::DFA < SymbolType, StateType > stringApi < automaton::DFA < SymbolType
 	ext::set<StateType> states;
 	ext::set<ext::tuple<StateType, SymbolType, StateType>> transitionFunction;
 
-	parseTransition(input, states, symbols, initialState, finalStates, transitionFunction);
-	token = automaton::AutomatonFromStringLexer::next(input);
-
 	while(token.type == automaton::AutomatonFromStringLexer::TokenType::NEW_LINE) {
 		token = automaton::AutomatonFromStringLexer::next(input);
 		if(token.type == automaton::AutomatonFromStringLexer::TokenType::TEOF)
diff --git a/alib2str/src/automaton/string/FSM/EpsilonNFA.h b/alib2str/src/automaton/string/FSM/EpsilonNFA.h
index 1d0d066e98..494c431e44 100644
--- a/alib2str/src/automaton/string/FSM/EpsilonNFA.h
+++ b/alib2str/src/automaton/string/FSM/EpsilonNFA.h
@@ -60,9 +60,6 @@ automaton::EpsilonNFA < SymbolType, EpsilonType, StateType > stringApi < automat
 	ext::set<StateType> states;
 	ext::set<ext::tuple<StateType, ext::variant<EpsilonType, SymbolType>, StateType>> transitionFunction;
 
-	parseTransition(input, states, symbols, initialState, finalStates, transitionFunction);
-	token = automaton::AutomatonFromStringLexer::next(input);
-
 	while(token.type == automaton::AutomatonFromStringLexer::TokenType::NEW_LINE) {
 		token = automaton::AutomatonFromStringLexer::next(input);
 		if(token.type == automaton::AutomatonFromStringLexer::TokenType::TEOF)
diff --git a/alib2str/src/automaton/string/FSM/NFA.h b/alib2str/src/automaton/string/FSM/NFA.h
index c72ed22b0b..d852ec6d0e 100644
--- a/alib2str/src/automaton/string/FSM/NFA.h
+++ b/alib2str/src/automaton/string/FSM/NFA.h
@@ -54,9 +54,6 @@ automaton::NFA < SymbolType, StateType > stringApi < automaton::NFA < SymbolType
 	ext::set < StateType> states;
 	ext::set<ext::tuple < StateType, SymbolType, StateType>> transitionFunction;
 
-	parseTransition(input, states, symbols, initialState, finalStates, transitionFunction);
-	token = automaton::AutomatonFromStringLexer::next(input);
-
 	while(token.type == automaton::AutomatonFromStringLexer::TokenType::NEW_LINE) {
 		token = automaton::AutomatonFromStringLexer::next(input);
 		if(token.type == automaton::AutomatonFromStringLexer::TokenType::TEOF)
diff --git a/alib2str/test-src/automaton/AutomatonTest.cpp b/alib2str/test-src/automaton/AutomatonTest.cpp
index 20bc1216ed..696b84ea4b 100644
--- a/alib2str/test-src/automaton/AutomatonTest.cpp
+++ b/alib2str/test-src/automaton/AutomatonTest.cpp
@@ -26,15 +26,20 @@ void AutomatonTest::tearDown() {
 
 void AutomatonTest::FSMStringParserTest() {
 	{
-		std::string input = 	"\n"
-					"ENFA a b c d #E\n"
-					">0 3|4 5 1|3|4 - 2\n"
+		std::string input = 	"\r\n"
+					"ENFA a b c d #E\n\r"
+					"\r"
+					">0 3|4 5 1|3|4 - 2\r"
+					"\r\n"
 					"1 2 - - - -\n"
+					"\n\r"
 					"2 3 - - - -\n"
 					"3 - - 4 - -\n"
 					"\n"
 					"<4 - 5 - - 5\n"
-					"<5 - - - - 3";
+					"\r"
+					"<5 - - - - 3"
+					"\r";
 		std::string input2 = 	"ENFA a b c d #E\n"
 					">0 3|4 5 1|3|4 - 2\n"
 					"1 2 - - - -\n"
diff --git a/examples2/automaton/DFA3.txt b/examples2/automaton/DFA3.txt
new file mode 100644
index 0000000000..aa3794825d
--- /dev/null
+++ b/examples2/automaton/DFA3.txt
@@ -0,0 +1,18 @@
+DFA 0 1 2
+>{A, B} {D, F, G} {E, H} {D, F}
+<{D, F, G} {B, D, F, G} {E, F} {D, F}
+{E, H} {E} {F, H} {A}
+<{D, F} {B, D, F, G} {E, F} {D, F}
+<{B, D, F, G} {B, D, F, G} {A, F} {D, F}
+<{E, F} {E, F} {E, H} {D}
+{E} {E} {H} -
+<{F, H} {F} {E, F} {A, D} 
+{A} {F, G} {H} {D, F}
+{D} {B, D, G} {F} {F}
+{H} - {F} {A}
+<{F} {F} {E} {D}
+{A, D} {B, D, F, G} {H, F} {D, F}
+<{F, G} {B, F} {E, F} {D}
+<{B, D, G} {B, D, G} {E, F} {F}
+<{A, F} {F, G} {E, H} {D, F}
+<{B, F} {D, F} {E} {D}
-- 
GitLab