From fa1025cc198a75982ff6e1583a4d506c28ff2883 Mon Sep 17 00:00:00 2001
From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz>
Date: Mon, 17 Sep 2018 15:30:33 +0200
Subject: [PATCH] prepare grammar normalize for generalized templating of
 grammars

---
 .../src/grammar/common/GrammarNormalize.h     | 64 +++++++++----------
 1 file changed, 32 insertions(+), 32 deletions(-)

diff --git a/alib2data/src/grammar/common/GrammarNormalize.h b/alib2data/src/grammar/common/GrammarNormalize.h
index 0f08f4e20d..04a0bdeada 100644
--- a/alib2data/src/grammar/common/GrammarNormalize.h
+++ b/alib2data/src/grammar/common/GrammarNormalize.h
@@ -22,64 +22,64 @@ namespace grammar {
  */
 class GrammarNormalize {
 public:
-	template < class SymbolType >
-	static ext::pair < DefaultSymbolType, ext::vector < DefaultSymbolType > > normalizeRHS ( ext::pair < SymbolType, ext::vector < SymbolType > > && symbol );
+	template < class FirstSymbolType, class SecondSymbolType >
+	static ext::pair < DefaultSymbolType, ext::vector < DefaultSymbolType > > normalizeRHS ( ext::pair < FirstSymbolType, ext::vector < SecondSymbolType > > && symbol );
 
-	template < class SymbolType >
-	static ext::variant < DefaultSymbolType, ext::pair < DefaultSymbolType, DefaultSymbolType > > normalizeRHS ( ext::variant < SymbolType, ext::pair < SymbolType, SymbolType > > && symbol );
+	template < class FirstSymbolType, class SecondSymbolType, class ThirdSymbolType >
+	static ext::variant < DefaultSymbolType, ext::pair < DefaultSymbolType, DefaultSymbolType > > normalizeRHS ( ext::variant < FirstSymbolType, ext::pair < SecondSymbolType, ThirdSymbolType > > && symbol );
 
-	template < class SymbolType >
-	static ext::variant < ext::vector < DefaultSymbolType >, ext::pair < DefaultSymbolType, ext::vector < DefaultSymbolType > > > normalizeRHS ( ext::variant < ext::vector < SymbolType >, ext::pair < SymbolType, ext::vector < SymbolType > > > && symbol );
+	template < class FirstSymbolType, class SecondSymbolType, class ThirdSymbolType >
+	static ext::variant < ext::vector < DefaultSymbolType >, ext::pair < DefaultSymbolType, ext::vector < DefaultSymbolType > > > normalizeRHS ( ext::variant < ext::vector < FirstSymbolType >, ext::pair < SecondSymbolType, ext::vector < ThirdSymbolType > > > && symbol );
 
-	template < class SymbolType >
-	static ext::variant < ext::vector < DefaultSymbolType >, ext::pair < ext::vector < DefaultSymbolType >, DefaultSymbolType > > normalizeRHS ( ext::variant < ext::vector < SymbolType >, ext::pair < ext::vector < SymbolType >, SymbolType > > && symbol );
+	template < class FirstSymbolType, class SecondSymbolType, class ThirdSymbolType >
+	static ext::variant < ext::vector < DefaultSymbolType >, ext::pair < ext::vector < DefaultSymbolType >, DefaultSymbolType > > normalizeRHS ( ext::variant < ext::vector < FirstSymbolType >, ext::pair < ext::vector < SecondSymbolType >, ThirdSymbolType > > && symbol );
 
-	template < class SymbolType >
-	static ext::variant < ext::vector < DefaultSymbolType >, ext::tuple < ext::vector < DefaultSymbolType >, DefaultSymbolType, ext::vector < DefaultSymbolType > > > normalizeRHS ( ext::variant < ext::vector < SymbolType >, ext::tuple < ext::vector < SymbolType >, SymbolType, ext::vector < SymbolType > > > && symbols );
+	template < class FirstSymbolType, class SecondSymbolType, class ThirdSymbolType, class FourthSymbolType >
+	static ext::variant < ext::vector < DefaultSymbolType >, ext::tuple < ext::vector < DefaultSymbolType >, DefaultSymbolType, ext::vector < DefaultSymbolType > > > normalizeRHS ( ext::variant < ext::vector < FirstSymbolType >, ext::tuple < ext::vector < SecondSymbolType >, ThirdSymbolType, ext::vector < FourthSymbolType > > > && symbols );
 
 };
 
-template < class SymbolType >
-ext::pair < DefaultSymbolType, ext::vector < DefaultSymbolType > > GrammarNormalize::normalizeRHS ( ext::pair < SymbolType, ext::vector < SymbolType > > && symbol ) {
+template < class FirstSymbolType, class SecondSymbolType >
+ext::pair < DefaultSymbolType, ext::vector < DefaultSymbolType > > GrammarNormalize::normalizeRHS ( ext::pair < FirstSymbolType, ext::vector < SecondSymbolType > > && symbol ) {
 	return ext::make_pair ( alphabet::SymbolNormalize::normalizeSymbol ( std::move ( symbol.first ) ), alphabet::SymbolNormalize::normalizeSymbols ( std::move ( symbol.second ) ) );
 }
 
-template < class SymbolType >
-ext::variant < DefaultSymbolType, ext::pair < DefaultSymbolType, DefaultSymbolType > > GrammarNormalize::normalizeRHS ( ext::variant < SymbolType, ext::pair < SymbolType, SymbolType > > && symbol ) {
-	if ( symbol.template is < SymbolType > ( ) ) {
-		return ext::variant < DefaultSymbolType, ext::pair < DefaultSymbolType, DefaultSymbolType > > ( alphabet::SymbolNormalize::normalizeSymbol ( std::move ( symbol.template get < SymbolType > ( ) ) ) );
+template < class FirstSymbolType, class SecondSymbolType, class ThirdSymbolType >
+ext::variant < DefaultSymbolType, ext::pair < DefaultSymbolType, DefaultSymbolType > > GrammarNormalize::normalizeRHS ( ext::variant < FirstSymbolType, ext::pair < SecondSymbolType, ThirdSymbolType > > && symbol ) {
+	if ( symbol.template is < FirstSymbolType > ( ) ) {
+		return ext::variant < DefaultSymbolType, ext::pair < DefaultSymbolType, DefaultSymbolType > > ( alphabet::SymbolNormalize::normalizeSymbol ( std::move ( symbol.template get < FirstSymbolType > ( ) ) ) );
 	} else {
-		ext::pair < SymbolType, SymbolType > & inner = symbol.template get < ext::pair < SymbolType, SymbolType > > ( );
+		ext::pair < SecondSymbolType, ThirdSymbolType > & inner = symbol.template get < ext::pair < SecondSymbolType, ThirdSymbolType > > ( );
 		return ext::variant < DefaultSymbolType, ext::pair < DefaultSymbolType, DefaultSymbolType > > ( ext::make_pair ( alphabet::SymbolNormalize::normalizeSymbol ( std::move ( inner.first ) ), alphabet::SymbolNormalize::normalizeSymbol ( std::move ( inner.second ) ) ) );
 	}
 }
 
-template < class SymbolType >
-ext::variant < ext::vector < DefaultSymbolType >, ext::pair < DefaultSymbolType, ext::vector < DefaultSymbolType > > > GrammarNormalize::normalizeRHS ( ext::variant < ext::vector < SymbolType >, ext::pair < SymbolType, ext::vector < SymbolType > > > && symbol ) {
-	if ( symbol.template is < ext::vector < SymbolType > > ( ) ) {
-		return ext::variant < ext::vector < DefaultSymbolType >, ext::pair < DefaultSymbolType, ext::vector < DefaultSymbolType > > > ( alphabet::SymbolNormalize::normalizeSymbols ( std::move ( symbol.template get < ext::vector < SymbolType > > ( ) ) ) );
+template < class FirstSymbolType, class SecondSymbolType, class ThirdSymbolType >
+ext::variant < ext::vector < DefaultSymbolType >, ext::pair < DefaultSymbolType, ext::vector < DefaultSymbolType > > > GrammarNormalize::normalizeRHS ( ext::variant < ext::vector < FirstSymbolType >, ext::pair < SecondSymbolType, ext::vector < ThirdSymbolType > > > && symbol ) {
+	if ( symbol.template is < ext::vector < FirstSymbolType > > ( ) ) {
+		return ext::variant < ext::vector < DefaultSymbolType >, ext::pair < DefaultSymbolType, ext::vector < DefaultSymbolType > > > ( alphabet::SymbolNormalize::normalizeSymbols ( std::move ( symbol.template get < ext::vector < FirstSymbolType > > ( ) ) ) );
 	} else {
-		ext::pair < SymbolType, ext::vector < SymbolType > > & inner = symbol.template get < ext::pair < SymbolType, ext::vector < SymbolType > > > ( );
+		ext::pair < SecondSymbolType, ext::vector < ThirdSymbolType > > & inner = symbol.template get < ext::pair < SecondSymbolType, ext::vector < ThirdSymbolType > > > ( );
 		return ext::variant < ext::vector < DefaultSymbolType >, ext::pair < DefaultSymbolType, ext::vector < DefaultSymbolType > > > ( ext::make_pair ( alphabet::SymbolNormalize::normalizeSymbol ( std::move ( inner.first ) ), alphabet::SymbolNormalize::normalizeSymbols ( std::move ( inner.second ) ) ) );
 	}
 }
 
-template < class SymbolType >
-ext::variant < ext::vector < DefaultSymbolType >, ext::pair < ext::vector < DefaultSymbolType >, DefaultSymbolType > > GrammarNormalize::normalizeRHS ( ext::variant < ext::vector < SymbolType >, ext::pair < ext::vector < SymbolType >, SymbolType > > && symbol ) {
-	if ( symbol.template is < ext::vector < SymbolType > > ( ) ) {
-		return ext::variant < ext::vector < DefaultSymbolType >, ext::pair < ext::vector < DefaultSymbolType >, DefaultSymbolType > > ( alphabet::SymbolNormalize::normalizeSymbols ( std::move ( symbol.template get < ext::vector < SymbolType > > ( ) ) ) );
+template < class FirstSymbolType, class SecondSymbolType, class ThirdSymbolType >
+ext::variant < ext::vector < DefaultSymbolType >, ext::pair < ext::vector < DefaultSymbolType >, DefaultSymbolType > > GrammarNormalize::normalizeRHS ( ext::variant < ext::vector < FirstSymbolType >, ext::pair < ext::vector < SecondSymbolType >, ThirdSymbolType > > && symbol ) {
+	if ( symbol.template is < ext::vector < FirstSymbolType > > ( ) ) {
+		return ext::variant < ext::vector < DefaultSymbolType >, ext::pair < ext::vector < DefaultSymbolType >, DefaultSymbolType > > ( alphabet::SymbolNormalize::normalizeSymbols ( std::move ( symbol.template get < ext::vector < FirstSymbolType > > ( ) ) ) );
 	} else {
-		ext::pair < ext::vector < SymbolType >, SymbolType > & inner = symbol.template get < ext::pair < ext::vector < SymbolType >, SymbolType > > ( );
+		ext::pair < ext::vector < SecondSymbolType >, ThirdSymbolType > & inner = symbol.template get < ext::pair < ext::vector < SecondSymbolType >, ThirdSymbolType > > ( );
 		return ext::variant < ext::vector < DefaultSymbolType >, ext::pair < ext::vector < DefaultSymbolType >, DefaultSymbolType > > ( ext::make_pair ( alphabet::SymbolNormalize::normalizeSymbols ( std::move ( inner.first ) ), alphabet::SymbolNormalize::normalizeSymbol ( std::move ( inner.second ) ) ) );
 	}
 }
 
-template < class SymbolType >
-ext::variant < ext::vector < DefaultSymbolType >, ext::tuple < ext::vector < DefaultSymbolType >, DefaultSymbolType, ext::vector < DefaultSymbolType > > > GrammarNormalize::normalizeRHS ( ext::variant < ext::vector < SymbolType >, ext::tuple < ext::vector < SymbolType >, SymbolType, ext::vector < SymbolType > > > && symbols ) {
-	if ( symbols.template is < ext::vector < SymbolType > > ( ) ) {
-		return ext::variant < ext::vector < DefaultSymbolType >, ext::tuple < ext::vector < DefaultSymbolType >, DefaultSymbolType, ext::vector < DefaultSymbolType > > > ( alphabet::SymbolNormalize::normalizeSymbols ( std::move ( symbols.template get < ext::vector < SymbolType > > ( ) ) ) );
+template < class FirstSymbolType, class SecondSymbolType, class ThirdSymbolType, class FourthSymbolType >
+ext::variant < ext::vector < DefaultSymbolType >, ext::tuple < ext::vector < DefaultSymbolType >, DefaultSymbolType, ext::vector < DefaultSymbolType > > > GrammarNormalize::normalizeRHS ( ext::variant < ext::vector < FirstSymbolType >, ext::tuple < ext::vector < SecondSymbolType >, ThirdSymbolType, ext::vector < FourthSymbolType > > > && symbols ) {
+	if ( symbols.template is < ext::vector < FirstSymbolType > > ( ) ) {
+		return ext::variant < ext::vector < DefaultSymbolType >, ext::tuple < ext::vector < DefaultSymbolType >, DefaultSymbolType, ext::vector < DefaultSymbolType > > > ( alphabet::SymbolNormalize::normalizeSymbols ( std::move ( symbols.template get < ext::vector < FirstSymbolType > > ( ) ) ) );
 	} else {
-		ext::tuple < ext::vector < SymbolType >, SymbolType, ext::vector < SymbolType > > & inner = symbols.template get < ext::tuple < ext::vector < SymbolType >, SymbolType, ext::vector < SymbolType > > > ( );
+		ext::tuple < ext::vector < SecondSymbolType >, ThirdSymbolType, ext::vector < FourthSymbolType > > & inner = symbols.template get < ext::tuple < ext::vector < FirstSymbolType >, SecondSymbolType, ext::vector < ThirdSymbolType > > > ( );
 
 		ext::vector < DefaultSymbolType > first = alphabet::SymbolNormalize::normalizeSymbols ( std::move ( std::get < 0 > ( inner ) ) );
 		DefaultSymbolType second = alphabet::SymbolNormalize::normalizeSymbol ( std::move ( std::get < 1 > ( inner ) ) );
-- 
GitLab