From dbb5e63fe24eaabec284a70f4fedb58fef462dff Mon Sep 17 00:00:00 2001
From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz>
Date: Fri, 8 Sep 2017 12:19:28 +0200
Subject: [PATCH] simplification

---
 aarbology2/src/aarbology.cpp                  |  4 +-
 aintrospection2/src/aintrospection.cpp        |  1 +
 alib2cli/src/ast/Option.h                     | 11 ---
 alib2cli/src/ast/options/CategoryOption.h     | 15 +---
 alib2cli/src/ast/options/HL3Option.h          | 29 -------
 alib2cli/src/ast/options/TypeOption.h         | 16 +---
 .../ast/statements/ContainerFileStatement.cpp | 11 +--
 .../ast/statements/ContainerFileStatement.h   |  9 +--
 .../src/ast/statements/ContainerStatement.cpp | 11 +--
 .../src/ast/statements/ContainerStatement.h   |  9 +--
 alib2cli/src/ast/statements/FileStatement.cpp | 13 +---
 alib2cli/src/ast/statements/FileStatement.h   |  9 +--
 .../src/ast/statements/SingleStatement.cpp    | 16 ++--
 alib2cli/src/ast/statements/SingleStatement.h | 10 +--
 alib2cli/src/command/HelpCommand.h            | 37 ++++-----
 alib2cli/src/parser/Parser.cpp                | 77 ++++---------------
 alib2cli/src/parser/Parser.h                  |  8 +-
 alib2cli/test-src/cli/CliTest.cpp             |  6 +-
 18 files changed, 72 insertions(+), 220 deletions(-)
 delete mode 100644 alib2cli/src/ast/options/HL3Option.h

diff --git a/aarbology2/src/aarbology.cpp b/aarbology2/src/aarbology.cpp
index 1ee609ca39..cedbd20e50 100644
--- a/aarbology2/src/aarbology.cpp
+++ b/aarbology2/src/aarbology.cpp
@@ -140,7 +140,7 @@ int main ( int argc, char * argv[] ) {
 				input = subtreeWildcardInput.getValue ( );
 
 			environment.setBinding ( "inputSubtreeWildcard", input );
-			cli::Parser parser ( cli::Lexer ( "execute <:type ranked_symbol #inputSubtreeWildcard > $subtreeWildcard" ) );
+			cli::Parser parser ( cli::Lexer ( "execute <:ranked_symbol #inputSubtreeWildcard > $subtreeWildcard" ) );
 			parser.parse ( )->run ( environment );
 		}
 
@@ -152,7 +152,7 @@ int main ( int argc, char * argv[] ) {
 				input = nonlinearVariablesInput.getValue ( );
 
 			environment.setBinding ( "inputNonlinearVariables", input );
-			cli::Parser parser ( cli::Lexer ( "execute <{:type ranked_symbol}#inputNonlinearVariables > $nonlinearVariables" ) );
+			cli::Parser parser ( cli::Lexer ( "execute <{:ranked_symbol} #inputNonlinearVariables > $nonlinearVariables" ) );
 			parser.parse ( )->run ( environment );
 		}
 
diff --git a/aintrospection2/src/aintrospection.cpp b/aintrospection2/src/aintrospection.cpp
index 38e1c38177..2011614521 100644
--- a/aintrospection2/src/aintrospection.cpp
+++ b/aintrospection2/src/aintrospection.cpp
@@ -13,6 +13,7 @@
 #include <lexer/Lexer.h>
 #include <parser/Parser.h>
 #include <factory/XmlDataFactory.hpp>
+#include <abstraction/Registry.h>
 
 int main ( int argc, char * argv[] ) {
 	try {
diff --git a/alib2cli/src/ast/Option.h b/alib2cli/src/ast/Option.h
index 32b9916620..48a1f21691 100644
--- a/alib2cli/src/ast/Option.h
+++ b/alib2cli/src/ast/Option.h
@@ -1,23 +1,12 @@
 #ifndef _CLI_OPTION_H_
 #define _CLI_OPTION_H_
 
-#include <ast/Ast.h>
-#include <ast/statements/SingleStatement.h>
-#include <ast/statements/ContainerStatement.h>
-#include <ast/statements/ContainerFileStatement.h>
-#include <ast/statements/FileStatement.h>
-
 namespace cli {
 
 class Option {
 public:
 	virtual ~Option ( ) noexcept {
 	}
-
-	virtual void eval ( SingleStatement & statement ) const = 0;
-	virtual void eval ( ContainerStatement & statement ) const = 0;
-	virtual void eval ( ContainerFileStatement & statement ) const = 0;
-	virtual void eval ( FileStatement & statement ) const = 0;
 };
 
 } /* namespace cli */
diff --git a/alib2cli/src/ast/options/CategoryOption.h b/alib2cli/src/ast/options/CategoryOption.h
index 85d8bf3dbe..98437f9fbc 100644
--- a/alib2cli/src/ast/options/CategoryOption.h
+++ b/alib2cli/src/ast/options/CategoryOption.h
@@ -14,21 +14,10 @@ public:
 	CategoryOption ( std::string key ) : m_key ( std::move ( key ) ) {
 	}
 
-	virtual void eval ( SingleStatement & statement ) const override {
-		statement.setCategory ( abstraction::AlgorithmCategories::algorithmCategory ( m_key ) );
+	abstraction::AlgorithmCategories::AlgorithmCategory getCategory ( ) const {
+		return abstraction::AlgorithmCategories::algorithmCategory ( m_key );
 	}
 
-	virtual void eval ( ContainerStatement & ) const override {
-		throw exception::CommonException ( "ContainerStatement cannot be categorized." );
-	}
-
-	virtual void eval ( ContainerFileStatement & ) const override {
-		throw exception::CommonException ( "ContainerFileStatement cannot be categorized." );
-	}
-
-	virtual void eval ( FileStatement & ) const override {
-		throw exception::CommonException ( "FileStatement cannot be categorized." );
-	}
 };
 
 } /* namespace cli */
diff --git a/alib2cli/src/ast/options/HL3Option.h b/alib2cli/src/ast/options/HL3Option.h
deleted file mode 100644
index 6dba5a8131..0000000000
--- a/alib2cli/src/ast/options/HL3Option.h
+++ /dev/null
@@ -1,29 +0,0 @@
-#ifndef _CLI_HL3_OPTION_H_
-#define _CLI_HL3_OPTION_H_
-
-#include <ast/Option.h>
-
-namespace cli {
-
-class HL3Option final : public Option {
-public:
-	virtual void eval ( SingleStatement & ) const override {
-		std::cout << "The cake is a lie, as well as the release date of HL3. GLaDOS told me." << std::endl;
-	}
-
-	virtual void eval ( ContainerStatement & ) const override {
-		std::cout << "The cake is a lie, as well as the release date of HL3. GLaDOS told me." << std::endl;
-	}
-
-	virtual void eval ( ContainerFileStatement & ) const override {
-		std::cout << "The cake is a lie, as well as the release date of HL3. GLaDOS told me." << std::endl;
-	}
-
-	virtual void eval ( FileStatement & ) const override {
-		std::cout << "The cake is a lie, as well as the release date of HL3. GLaDOS told me." << std::endl;
-	}
-};
-
-} /* namespace cli */
-
-#endif /* _CLI_HL3_OPTION_H_ */
diff --git a/alib2cli/src/ast/options/TypeOption.h b/alib2cli/src/ast/options/TypeOption.h
index f70d309500..e8e91101fd 100644
--- a/alib2cli/src/ast/options/TypeOption.h
+++ b/alib2cli/src/ast/options/TypeOption.h
@@ -13,20 +13,8 @@ public:
 	TypeOption ( std::string type ) : m_type ( std::move ( type ) ) {
 	}
 
-	virtual void eval ( SingleStatement & ) const override {
-		throw exception::CommonException ( "Single statement cannot be parametrized with type." );
-	}
-
-	virtual void eval ( ContainerStatement & statement ) const override {
-		statement.setType ( m_type );
-	}
-
-	virtual void eval ( ContainerFileStatement & statement ) const override {
-		statement.setType ( m_type );
-	}
-
-	virtual void eval ( FileStatement & statement ) const override {
-		statement.setType ( m_type );
+	const std::string & getType ( ) const {
+		return m_type;
 	}
 };
 
diff --git a/alib2cli/src/ast/statements/ContainerFileStatement.cpp b/alib2cli/src/ast/statements/ContainerFileStatement.cpp
index ffc54259ae..601899fbc9 100644
--- a/alib2cli/src/ast/statements/ContainerFileStatement.cpp
+++ b/alib2cli/src/ast/statements/ContainerFileStatement.cpp
@@ -6,18 +6,11 @@
 
 namespace cli {
 
-ContainerFileStatement::ContainerFileStatement ( std::string container, ext::vector < std::unique_ptr < Option > > options, std::unique_ptr < Arg > file ) : m_file ( std::move ( file ) ), m_container ( std::move ( container ) ), m_options ( std::move ( options ) ) {
-	for ( const std::unique_ptr < Option > & option : m_options ) {
-		option->eval ( * this );
-	}
+ContainerFileStatement::ContainerFileStatement ( std::string container, std::unique_ptr < TypeOption > type, std::unique_ptr < Arg > file ) : m_file ( std::move ( file ) ), m_container ( std::move ( container ) ), m_type ( std::move ( type ) ) {
 }
 
 std::shared_ptr < abstraction::OperationAbstraction > ContainerFileStatement::translateAndEval ( const std::shared_ptr < abstraction::OperationAbstraction > &, Environment & environment ) const {
-	return abstraction::Registry::getContainerAbstraction ( m_container, m_type, m_file->eval ( environment ) );
-}
-
-void ContainerFileStatement::setType ( std::string type ) {
-	m_type = std::move ( type );
+	return abstraction::Registry::getContainerAbstraction ( m_container, m_type->getType ( ), m_file->eval ( environment ) );
 }
 
 } /* namespace cli */
diff --git a/alib2cli/src/ast/statements/ContainerFileStatement.h b/alib2cli/src/ast/statements/ContainerFileStatement.h
index e2e2d88c31..d216cf844d 100644
--- a/alib2cli/src/ast/statements/ContainerFileStatement.h
+++ b/alib2cli/src/ast/statements/ContainerFileStatement.h
@@ -2,22 +2,19 @@
 #define _CLI_CONTAINER_FILE_STATEMENT_H_
 
 #include <ast/Statement.h>
+#include <ast/options/TypeOption.h>
 
 namespace cli {
 
 class ContainerFileStatement final : public Statement {
 	std::unique_ptr < cli::Arg > m_file;
 	std::string m_container;
-	ext::vector < std::unique_ptr < Option > > m_options;
-
-	std::string m_type;
+	std::unique_ptr < TypeOption > m_type;
 
 public:
-	ContainerFileStatement ( std::string container, ext::vector < std::unique_ptr < Option > > options, std::unique_ptr < Arg > file );
+	ContainerFileStatement ( std::string container, std::unique_ptr < TypeOption > type, std::unique_ptr < Arg > file );
 
 	virtual std::shared_ptr < abstraction::OperationAbstraction > translateAndEval ( const std::shared_ptr < abstraction::OperationAbstraction > &, Environment & environment ) const override;
-
-	void setType ( std::string type );
 };
 
 } /* namespace cli */
diff --git a/alib2cli/src/ast/statements/ContainerStatement.cpp b/alib2cli/src/ast/statements/ContainerStatement.cpp
index 9751550f2a..55be167c41 100644
--- a/alib2cli/src/ast/statements/ContainerStatement.cpp
+++ b/alib2cli/src/ast/statements/ContainerStatement.cpp
@@ -8,10 +8,7 @@
 
 namespace cli {
 
-ContainerStatement::ContainerStatement ( std::string container, ext::vector < std::unique_ptr < Param > > params, ext::vector < std::unique_ptr < Option > > options ) : m_container ( std::move ( container ) ), m_params ( std::move ( params ) ), m_options ( std::move ( options ) ) {
-	for ( const std::unique_ptr < Option > & option : m_options ) {
-		option->eval ( * this );
-	}
+ContainerStatement::ContainerStatement ( std::string container, ext::vector < std::unique_ptr < Param > > params, std::unique_ptr < TypeOption > type ) : m_container ( std::move ( container ) ), m_params ( std::move ( params ) ), m_type ( std::move ( type ) ) {
 }
 
 std::shared_ptr < abstraction::OperationAbstraction > ContainerStatement::translateAndEval ( const std::shared_ptr < abstraction::OperationAbstraction > & prev, Environment & environment ) const {
@@ -25,7 +22,7 @@ std::shared_ptr < abstraction::OperationAbstraction > ContainerStatement::transl
 		moves.push_back ( param->getMove ( ) );
 	}
 
-	std::shared_ptr < abstraction::OperationAbstraction > algo = abstraction::Registry::getContainerAbstraction ( m_container, m_type );
+	std::shared_ptr < abstraction::OperationAbstraction > algo = abstraction::Registry::getContainerAbstraction ( m_container, m_type->getType ( ) );
 
 	unsigned i = 0;
 	ext::vector < std::shared_ptr < abstraction::OperationAbstraction > > casted_params;
@@ -52,8 +49,4 @@ std::shared_ptr < abstraction::OperationAbstraction > ContainerStatement::transl
 	return algo;
 }
 
-void ContainerStatement::setType ( std::string type ) {
-	m_type = std::move ( type );
-}
-
 } /* namespace cli */
diff --git a/alib2cli/src/ast/statements/ContainerStatement.h b/alib2cli/src/ast/statements/ContainerStatement.h
index 35b97849d3..efbcd246f0 100644
--- a/alib2cli/src/ast/statements/ContainerStatement.h
+++ b/alib2cli/src/ast/statements/ContainerStatement.h
@@ -2,22 +2,19 @@
 #define _CLI_CONTAINER_STATEMENT_H_
 
 #include <ast/Statement.h>
+#include <ast/options/TypeOption.h>
 
 namespace cli {
 
 class ContainerStatement final : public Statement {
 	std::string m_container;
 	ext::vector < std::unique_ptr < Param > > m_params;
-	ext::vector < std::unique_ptr < Option > > m_options;
-
-	std::string m_type;
+	std::unique_ptr < TypeOption > m_type;
 
 public:
-	ContainerStatement ( std::string container, ext::vector < std::unique_ptr < Param > > params, ext::vector < std::unique_ptr < Option > > options );
+	ContainerStatement ( std::string container, ext::vector < std::unique_ptr < Param > > params, std::unique_ptr < TypeOption > type );
 
 	virtual std::shared_ptr < abstraction::OperationAbstraction > translateAndEval ( const std::shared_ptr < abstraction::OperationAbstraction > & prev, Environment & environment ) const override;
-
-	void setType ( std::string type );
 };
 
 } /* namespace cli */
diff --git a/alib2cli/src/ast/statements/FileStatement.cpp b/alib2cli/src/ast/statements/FileStatement.cpp
index 9b8768ab8d..98a0ad940d 100644
--- a/alib2cli/src/ast/statements/FileStatement.cpp
+++ b/alib2cli/src/ast/statements/FileStatement.cpp
@@ -6,24 +6,19 @@
 
 namespace cli {
 
-FileStatement::FileStatement ( ext::vector < std::unique_ptr < Option > > options, std::unique_ptr < Arg > file ) : m_file ( std::move ( file ) ), m_options ( std::move ( options ) ) {
-	for ( const std::unique_ptr < Option > & option : m_options ) {
-		option->eval ( * this );
-	}
+FileStatement::FileStatement ( std::unique_ptr < TypeOption > type, std::unique_ptr < Arg > file ) : m_file ( std::move ( file ) ), m_type ( std::move ( type ) ) {
 }
 
 std::shared_ptr < abstraction::OperationAbstraction > FileStatement::translateAndEval ( const std::shared_ptr < abstraction::OperationAbstraction > &, Environment & environment ) const {
 	ext::deque < sax::Token > tokens = sax::FromXMLParserHelper::parseInput ( m_file->eval ( environment ) );
 
-	std::string type = m_type;
+	std::string type = "";
+	if ( m_type )
+		type = m_type->getType ( );
 	if ( type == "" )
 		type = tokens [ 0 ].getData ( );
 
 	return abstraction::Registry::getXmlParserAbstraction ( type, tokens );
 }
 
-void FileStatement::setType ( std::string type ) {
-	m_type = std::move ( type );
-}
-
 } /* namespace cli */
diff --git a/alib2cli/src/ast/statements/FileStatement.h b/alib2cli/src/ast/statements/FileStatement.h
index cc3828577e..41c47fc8b1 100644
--- a/alib2cli/src/ast/statements/FileStatement.h
+++ b/alib2cli/src/ast/statements/FileStatement.h
@@ -2,21 +2,18 @@
 #define _CLI_FILE_STATEMENT_H_
 
 #include <ast/Statement.h>
+#include <ast/options/TypeOption.h>
 
 namespace cli {
 
 class FileStatement final : public Statement {
 	std::unique_ptr < cli::Arg > m_file;
-	ext::vector < std::unique_ptr < Option > > m_options;
-
-	std::string m_type;
+	std::unique_ptr < TypeOption > m_type;
 
 public:
-	FileStatement ( ext::vector < std::unique_ptr < Option > > options, std::unique_ptr < Arg > file );
+	FileStatement ( std::unique_ptr < TypeOption > type, std::unique_ptr < Arg > file );
 
 	virtual std::shared_ptr < abstraction::OperationAbstraction > translateAndEval ( const std::shared_ptr < abstraction::OperationAbstraction > &, Environment & environment ) const override;
-
-	void setType ( std::string type );
 };
 
 } /* namespace cli */
diff --git a/alib2cli/src/ast/statements/SingleStatement.cpp b/alib2cli/src/ast/statements/SingleStatement.cpp
index 832b24924f..3b35b1afe2 100644
--- a/alib2cli/src/ast/statements/SingleStatement.cpp
+++ b/alib2cli/src/ast/statements/SingleStatement.cpp
@@ -1,15 +1,12 @@
 #include <ast/statements/SingleStatement.h>
-#include <ast/Option.h>
 #include <ast/Param.h>
 #include <ast/Arg.h>
 #include <abstraction/common/AlgorithmHelper.h>
+#include <abstraction/common/AlgorithmCategories.hpp>
 
 namespace cli {
 
-SingleStatement::SingleStatement ( std::unique_ptr < Arg > name, ext::vector < std::unique_ptr < Param > > params, ext::vector < std::unique_ptr < Option > > options ) : m_name ( std::move ( name ) ), m_params ( std::move ( params ) ), m_options ( std::move ( options ) ), m_category ( abstraction::AlgorithmCategories::AlgorithmCategory::NONE ) {
-	for ( const std::unique_ptr < Option > & option : m_options ) {
-		option->eval ( * this );
-	}
+SingleStatement::SingleStatement ( std::unique_ptr < Arg > name, ext::vector < std::unique_ptr < Param > > params, std::unique_ptr < CategoryOption > category ) : m_name ( std::move ( name ) ), m_params ( std::move ( params ) ), m_category ( std::move ( category ) ) {
 }
 
 std::shared_ptr < abstraction::OperationAbstraction > SingleStatement::translateAndEval ( const std::shared_ptr < abstraction::OperationAbstraction > & prev, Environment & environment ) const {
@@ -24,12 +21,11 @@ std::shared_ptr < abstraction::OperationAbstraction > SingleStatement::translate
 	}
 
 	std::string name = m_name->eval ( environment );
+	abstraction::AlgorithmCategories::AlgorithmCategory category = abstraction::AlgorithmCategories::AlgorithmCategory::NONE;
+	if ( m_category )
+		category = m_category->getCategory ( );
 
-	return abstraction::AlgorithmHelper::eval ( name, params, moves, m_category );
-}
-
-void SingleStatement::setCategory ( abstraction::AlgorithmCategories::AlgorithmCategory category ) {
-	m_category = category;
+	return abstraction::AlgorithmHelper::eval ( name, params, moves, category );
 }
 
 } /* namespace cli */
diff --git a/alib2cli/src/ast/statements/SingleStatement.h b/alib2cli/src/ast/statements/SingleStatement.h
index 87ab9f9213..40bd08980f 100644
--- a/alib2cli/src/ast/statements/SingleStatement.h
+++ b/alib2cli/src/ast/statements/SingleStatement.h
@@ -5,23 +5,19 @@
 #include <abstraction/Registry.h>
 #include <exception/CommonException.h>
 #include <iostream>
-#include <abstraction/common/AlgorithmCategories.hpp>
+#include <ast/options/CategoryOption.h>
 
 namespace cli {
 
 class SingleStatement final : public Statement {
 	std::unique_ptr < cli::Arg > m_name;
 	ext::vector < std::unique_ptr < Param > > m_params;
-	ext::vector < std::unique_ptr < Option > > m_options;
-
-	abstraction::AlgorithmCategories::AlgorithmCategory m_category;
+	std::unique_ptr < CategoryOption > m_category;
 
 public:
-	SingleStatement ( std::unique_ptr < cli::Arg > name, ext::vector < std::unique_ptr < Param > > params, ext::vector < std::unique_ptr < Option > > options );
+	SingleStatement ( std::unique_ptr < cli::Arg > name, ext::vector < std::unique_ptr < Param > > params, std::unique_ptr < CategoryOption > options );
 
 	virtual std::shared_ptr < abstraction::OperationAbstraction > translateAndEval ( const std::shared_ptr < abstraction::OperationAbstraction > & prev, Environment & environment ) const override;
-
-	void setCategory ( abstraction::AlgorithmCategories::AlgorithmCategory category );
 };
 
 } /* namespace cli */
diff --git a/alib2cli/src/command/HelpCommand.h b/alib2cli/src/command/HelpCommand.h
index bd03d53d77..491cf8026c 100644
--- a/alib2cli/src/command/HelpCommand.h
+++ b/alib2cli/src/command/HelpCommand.h
@@ -26,41 +26,38 @@ public:
 			std::cout << "statement_list:" << std::endl;
 			std::cout << "statement ( | statement )* - at least one statement followed by a pipe separated sequence of other statements" << std::endl;
 			std::cout << "" << std::endl;
+			std::cout << "arg:" << std::endl;
+			std::cout << "value  - immediate string value" << std::endl;
+			std::cout << "#value - string value from environmet variable" << std::endl;
+			std::cout << "" << std::endl;
 			std::cout << "param:" << std::endl;
 			std::cout << "[^] -                   - a value from the previous result (PreviousResultParam)" << std::endl;
 			std::cout << "[^] <( statement_list ) - a statement list serving as a param (StatementParam)" << std::endl;
-			std::cout << "[^] ( type ) param      - a casted parameter, type is an immediate value (CastParam)" << std::endl;
-			std::cout << "[^] ( #type ) param     - a casted parameter, type identified by an environment variable (CastParam)" << std::endl;
+			std::cout << "[^] ( arg ) param       - a casted parameter, type is given by arg value (CastParam)" << std::endl;
 			std::cout << "" << std::endl;
-			std::cout << "identifier       - a string param - the value is a immediate string (ImmediateParam)" << std::endl;
-			std::cout << "number           - a number param - the value is a immediate integer (ImmediateParam)" << std::endl;
-			std::cout << "#identifier      - a string param - identified by an environment variable (ValueParam)" << std::endl;
-			std::cout << "[^] $identifier  - a value from a variable, identifier is an immediate value (VariableParam)" << std::endl;
-			std::cout << "[^] $#identifier - a value from a variable, identified by an environment variable (VariableParam)" << std::endl;
+			std::cout << "identifier  - a string param - the value is a immediate string (ImmediateParam)" << std::endl;
+			std::cout << "number      - a number param - the value is a immediate integer (ImmediateParam)" << std::endl;
+			std::cout << "#identifier - a string param - identified by an environment variable (ValueParam)" << std::endl;
+			std::cout << "[^] $arg    - a value from a variable, name is given by arg value (VariableParam)" << std::endl;
 			std::cout << "" << std::endl;
-			std::cout << "<identifier      - a value from a xml file, identifier is an immediate value (FileParam)" << std::endl;
-			std::cout << "<#identifier     - a value from a xml file, identified by an  environment variable (FileParam)" << std::endl;
+			std::cout << "<arg        - a value from a xml file, filename is given by arg value (FileParam)" << std::endl;
 			std::cout << "" << std::endl;
 			std::cout << "statement:" << std::endl;
 			std::cout << "name ( param )* output_spec - a statement with params, name is an immediate value (SingleStatement)" << std::endl;
-			std::cout << "( type ) [^] statement      - the result of a statement is casted, type is an immediate value (CastedStatement)" << std::endl;
-			std::cout << "( #type ) [^] statement     - the result of a statement is casted, type indentified by an environment variable (CastedStatement)" << std::endl;
-			std::cout << "{ :type param ( param ) * } - creates a set of type given by param with values from individual statements" << std::endl;
+			std::cout << "( type ) [^] statement      - the result of a statement is casted, type is given by value (CastedStatement)" << std::endl;
+			std::cout << "{ :type ( statement ) * }   - creates a set of type given by arg value with content values from individual statements" << std::endl;
 			std::cout << "" << std::endl;
 			std::cout << "#identifier   - an immediate value from an environment (ValueStatement)" << std::endl;
 			std::cout << "$identifier   - a value from a variable, identifier is an immediate value (VariableStatement)" << std::endl;
 			std::cout << "$#identifier  - a value from a variable, identified by an environment variable (VariableStatement)" << std::endl;
 			std::cout << "" << std::endl;
-			std::cout << "<identifier   - a value from a xml file, identifier is immediate value (FileStatement)" << std::endl;
-			std::cout << "<#identifier  - a value from a xml file, identified by an environment variable (FileStatement)" << std::endl;
+			std::cout << "< [:type] arg - a value from a xml file, identifier is given by arg value, type of the value can be hinted with optional parameter (FileStatement)" << std::endl;
 			std::cout << "" << std::endl;
 			std::cout << "output_spec:" << std::endl;
-			std::cout << ">identifier   - a value to a xml file, identifier is an immediate value (ResultFileStatement)" << std::endl;
-			std::cout << ">#identifier  - a value to a xml file, identified by an environment variable (ResultFileStatement)" << std::endl;
-			std::cout << ">$identifier  - a value to a variable, identifier is an immediate value  (ResultVariableStatement)" << std::endl;
-			std::cout << ">$#identifier - a value to a variable, identified by an environment variable (ResultVariableStatement)" << std::endl;
-			std::cout << ">             - a value is discarded" << std::endl;
-			std::cout << "              - an empty output specifier prints the result to the stdout (ResultPrintStatement)" << std::endl;
+			std::cout << ">arg     - a value to a xml file, identifier is given by arg value (ResultFileStatement)" << std::endl;
+			std::cout << ">$arg    - a value to a variable, identifier is given by arg value  (ResultVariableStatement)" << std::endl;
+			std::cout << ">        - a value is discarded" << std::endl;
+			std::cout << "         - an empty output specifier prints the result to the stdout (ResultPrintStatement)" << std::endl;
 		} else if ( command == "" ) {
 			std::cout << "Simple help for the query language" << std::endl;
 			std::cout << "" << std::endl;
diff --git a/alib2cli/src/parser/Parser.cpp b/alib2cli/src/parser/Parser.cpp
index b153b061ca..e2be02264a 100644
--- a/alib2cli/src/parser/Parser.cpp
+++ b/alib2cli/src/parser/Parser.cpp
@@ -32,17 +32,14 @@
 #include <command/CastsIntrospectionCommand.h>
 #include <command/SetCommand.h>
 
-#include <ast/options/HL3Option.h>
-#include <ast/options/TypeOption.h>
-#include <ast/options/CategoryOption.h>
-
 #include <primitive/Integer.h>
 #include <primitive/String.h>
 
 namespace cli {
 
-std::unique_ptr < Option > Parser::category_option ( ) {
-	if ( check_nonreserved_kw ( "default", "test", "efficient", "student" ) ) {
+std::unique_ptr < CategoryOption > Parser::category_option ( ) {
+	if ( check ( cli::Lexer::TokenType::COLON_SIGN ) ) {
+		match ( cli::Lexer::TokenType::COLON_SIGN );
 		std::string value = getTokenValue ( );
 		match ( cli::Lexer::TokenType::INTEGER, cli::Lexer::TokenType::IDENTIFIER );
 		return std::make_unique < CategoryOption > ( value );
@@ -51,9 +48,9 @@ std::unique_ptr < Option > Parser::category_option ( ) {
 	}
 }
 
-std::unique_ptr < Option > Parser::type_option ( ) {
-	if ( check_nonreserved_kw ( "type" ) ) {
-		match_nonreserved_kw ( "type" );
+std::unique_ptr < TypeOption > Parser::type_option ( ) {
+	if ( check ( cli::Lexer::TokenType::COLON_SIGN ) ) {
+		match ( cli::Lexer::TokenType::COLON_SIGN );
 		std::string value = getTokenValue ( );
 		match ( cli::Lexer::TokenType::INTEGER, cli::Lexer::TokenType::IDENTIFIER );
 		return std::make_unique < TypeOption > ( std::move ( value ) );
@@ -62,15 +59,6 @@ std::unique_ptr < Option > Parser::type_option ( ) {
 	}
 }
 
-std::unique_ptr < Option > Parser::option ( ) {
-	if ( check_nonreserved_kw ( "hl3" ) ) {
-		match_nonreserved_kw ( "hl3" );
-		return std::make_unique < HL3Option > ( );
-	} else {
-		return nullptr;
-	}
-}
-
 std::unique_ptr < Arg > Parser::arg ( ) {
 	if ( check ( cli::Lexer::TokenType::HASH_SIGN ) ) {
 		match ( cli::Lexer::TokenType::HASH_SIGN );
@@ -185,34 +173,15 @@ std::unique_ptr < Param > Parser::value_param ( ) {
 std::shared_ptr < Statement > Parser::in_redirect_statement ( ) {
 	if ( check ( cli::Lexer::TokenType::LEFT_BRACE ) ) {
 		match ( cli::Lexer::TokenType::LEFT_BRACE );
-		ext::vector < std::unique_ptr < Option > > options;
-		while ( check ( cli::Lexer::TokenType::COLON_SIGN ) ) {
-			match ( cli::Lexer::TokenType::COLON_SIGN );
-			std::unique_ptr < Option > res = type_option ( );
-			if ( ! res )
-				res = option ( );
-			if ( ! res )
-				throw exception::CommonException ( "Option not recognised" );
-			options.emplace_back ( std::move ( res ) );
-		}
-
+		std::unique_ptr < TypeOption > type = type_option ( );
 		match ( cli::Lexer::TokenType::RIGHT_BRACE );
 		std::unique_ptr < Arg > file = arg ( );
-		return std::make_shared < ContainerFileStatement > ( "Set", std::move ( options ), std::move ( file ) );
+		return std::make_shared < ContainerFileStatement > ( "Set", std::move ( type ), std::move ( file ) );
 	} else {
 		ext::vector < std::unique_ptr < Option > > options;
-		while ( check ( cli::Lexer::TokenType::COLON_SIGN ) ) {
-			match ( cli::Lexer::TokenType::COLON_SIGN );
-			std::unique_ptr < Option > res = type_option ( );
-			if ( ! res )
-				res = option ( );
-			if ( ! res )
-				throw exception::CommonException ( "Option not recognised" );
-			options.emplace_back ( std::move ( res ) );
-		}
-
+		std::unique_ptr < TypeOption > type = type_option ( );
 		std::unique_ptr < Arg > file = arg ( );
-		return std::make_shared < FileStatement > ( std::move ( options ), std::move ( file ) );
+		return std::make_shared < FileStatement > ( std::move ( type ), std::move ( file ) );
 	}
 }
 
@@ -233,41 +202,23 @@ std::shared_ptr < Statement > Parser::single_statement ( ) {
 		return std::make_shared < CastStatement > ( std::move ( type ), casted_statement, move );
 	} else if ( check ( cli::Lexer::TokenType::IDENTIFIER ) ) {
 		std::unique_ptr < Arg > name = std::make_unique < ImmediateArg > ( matchIdentifier ( ) );
-		ext::vector < std::unique_ptr < Option > > options;
-		while ( check ( cli::Lexer::TokenType::COLON_SIGN ) ) {
-			match ( cli::Lexer::TokenType::COLON_SIGN );
-			std::unique_ptr < Option > res = category_option ( );
-			if ( ! res )
-				res = option ( );
-			if ( ! res )
-				throw exception::CommonException ( "Option not recognised" );
-			options.emplace_back ( std::move ( res ) );
-		}
+		std::unique_ptr < CategoryOption > category = category_option ( );
 		ext::vector < std::unique_ptr < Param > > params;
 		while ( ! check ( cli::Lexer::TokenType::OUT_REDIRECT ) && ! check ( cli::Lexer::TokenType::PIPE_SIGN ) && ! check ( cli::Lexer::TokenType::END ) && ! check ( cli::Lexer::TokenType::RIGHT_PAREN ) ) {
 			params.emplace_back ( param ( ) );
 		}
 
-		return std::make_shared < SingleStatement > ( std::move ( name ), std::move ( params ), std::move ( options ) );
+		return std::make_shared < SingleStatement > ( std::move ( name ), std::move ( params ), std::move ( category ) );
 	} else if ( check ( cli::Lexer::TokenType::LEFT_BRACE ) ) {
 		match ( cli::Lexer::TokenType::LEFT_BRACE );
-		ext::vector < std::unique_ptr < Option > > options;
-		while ( check ( cli::Lexer::TokenType::COLON_SIGN ) ) {
-			match ( cli::Lexer::TokenType::COLON_SIGN );
-			std::unique_ptr < Option > res = type_option ( );
-			if ( ! res )
-				res = option ( );
-			if ( ! res )
-				throw exception::CommonException ( "Option not recognised" );
-			options.emplace_back ( std::move ( res ) );
-		}
+		std::unique_ptr < TypeOption > type = type_option ( );
 
 		ext::vector < std::unique_ptr < Param > > params;
 		while ( ! check ( cli::Lexer::TokenType::RIGHT_BRACE ) ) {
 			params.emplace_back ( param ( ) );
 		}
 
-		std::shared_ptr < Statement > res = std::make_shared < ContainerStatement > ( "Set", std::move ( params ), std::move ( options ) );
+		std::shared_ptr < Statement > res = std::make_shared < ContainerStatement > ( "Set", std::move ( params ), std::move ( type ) );
 		match ( cli::Lexer::TokenType::RIGHT_BRACE );
 		return res;
 	} else if ( check ( cli::Lexer::TokenType::HASH_SIGN ) ) {
diff --git a/alib2cli/src/parser/Parser.h b/alib2cli/src/parser/Parser.h
index 4057552d7d..483ea520a0 100644
--- a/alib2cli/src/parser/Parser.h
+++ b/alib2cli/src/parser/Parser.h
@@ -6,6 +6,9 @@
 #include <ast/Option.h>
 #include <ast/Arg.h>
 
+#include <ast/options/TypeOption.h>
+#include <ast/options/CategoryOption.h>
+
 #include <command/Command.h>
 
 #include <ast/statements/StatementList.h>
@@ -80,9 +83,8 @@ public:
 		return m_current.m_value;
 	}
 
-	std::unique_ptr < Option > category_option ( );
-	std::unique_ptr < Option > type_option ( );
-	std::unique_ptr < Option > option ( );
+	std::unique_ptr < CategoryOption > category_option ( );
+	std::unique_ptr < TypeOption > type_option ( );
 
 	std::unique_ptr < Arg > arg ( );
 
diff --git a/alib2cli/test-src/cli/CliTest.cpp b/alib2cli/test-src/cli/CliTest.cpp
index 7aac735909..dad46d5e42 100644
--- a/alib2cli/test-src/cli/CliTest.cpp
+++ b/alib2cli/test-src/cli/CliTest.cpp
@@ -96,7 +96,7 @@ void CliTest::testCreateUnique ( ) {
 	parser = cli::Parser ( cli::Lexer ( "execute One | Add <( Add (int) <#2 <(One) ) - | Neg (double) - | Divide (double) - <(One | (double) Add <(One) - )" ) );
 	parser.parse ( )->run ( environment );
 
-	parser = cli::Parser ( cli::Lexer ( "execute <:type int #2" ) );
+	parser = cli::Parser ( cli::Lexer ( "execute <:int #2" ) );
 	parser.parse ( )->run ( environment );
 
 	parser = cli::Parser ( cli::Lexer ( "execute One > $res" ) );
@@ -255,7 +255,7 @@ void CliTest::testSetConstruction ( ) {
 	abstraction::AlgorithmRegistry::registerAlgorithm < Print > ( Print::print, abstraction::AlgorithmCategories::AlgorithmCategory::DEFAULT, false, false, std::array < std::string, 1 > ( ) );
 
 	cli::Environment environment;
-	cli::Parser parser ( cli::Lexer ( "execute { :type int 1 2 3 } > $set" ) );
+	cli::Parser parser ( cli::Lexer ( "execute { :int 1 2 3 } > $set" ) );
 	parser.parse ( )->run ( environment );
 	std::cout << environment.getVariable ( "set" )->getReturnType ( ) << std::endl;
 	parser = cli::Parser ( cli::Lexer ( "execute $set | Print -" ) );
@@ -264,7 +264,7 @@ void CliTest::testSetConstruction ( ) {
 	parser = cli::Parser ( cli::Lexer ( "execute $set >local/yyy.xml" ) );
 	parser.parse ( )->run ( environment );
 
-	parser = cli::Parser ( cli::Lexer ( "execute <{ :type int }local/yyy.xml > $set2" ) );
+	parser = cli::Parser ( cli::Lexer ( "execute <{ :int }local/yyy.xml > $set2" ) );
 	parser.parse ( )->run ( environment );
 	std::cout << environment.getVariable ( "set2" )->getReturnType ( ) << std::endl;
 	parser = cli::Parser ( cli::Lexer ( "execute $set2 | Print -" ) );
-- 
GitLab