diff --git a/alib2cli/src/ast/BindedFileParam.h b/alib2cli/src/ast/params/BindedFileParam.h similarity index 100% rename from alib2cli/src/ast/BindedFileParam.h rename to alib2cli/src/ast/params/BindedFileParam.h diff --git a/alib2cli/src/ast/BindedParam.h b/alib2cli/src/ast/params/BindedValueParam.h similarity index 68% rename from alib2cli/src/ast/BindedParam.h rename to alib2cli/src/ast/params/BindedValueParam.h index 34b55dd469f86d016991cc44f402af8b0cfbaaf4..f695465549883df79c132c2d29bf2ec53fd7cdab 100644 --- a/alib2cli/src/ast/BindedParam.h +++ b/alib2cli/src/ast/params/BindedValueParam.h @@ -1,16 +1,16 @@ -#ifndef _CLI_BINDED_PARAM_H_ -#define _CLI_BINDED_PARAM_H_ +#ifndef _CLI_BINDED_VALUE_PARAM_H_ +#define _CLI_BINDED_VALUE_PARAM_H_ #include <ast/Param.h> #include <abstraction/Registry.h> namespace cli { -class BindedParam : public Param { +class BindedValueParam : public Param { std::string m_bind; public: - BindedParam ( std::string bind ) : m_bind ( bind ) { + BindedValueParam ( std::string bind ) : m_bind ( bind ) { } virtual std::shared_ptr < abstraction::OperationAbstraction > translateAndEval ( const std::shared_ptr < abstraction::OperationAbstraction > &, Environment & environment ) const override { @@ -20,4 +20,4 @@ public: } /* namespace cli */ -#endif /* _CLI_BINDED_PARAM_H_ */ +#endif /* _CLI_BINDED_VALUE_PARAM_H_ */ diff --git a/alib2cli/src/ast/BindedVariableParam.h b/alib2cli/src/ast/params/BindedVariableParam.h similarity index 100% rename from alib2cli/src/ast/BindedVariableParam.h rename to alib2cli/src/ast/params/BindedVariableParam.h diff --git a/alib2cli/src/ast/CastParam.h b/alib2cli/src/ast/params/CastParam.h similarity index 100% rename from alib2cli/src/ast/CastParam.h rename to alib2cli/src/ast/params/CastParam.h diff --git a/alib2cli/src/ast/ImmediateFileParam.h b/alib2cli/src/ast/params/ImmediateFileParam.h similarity index 100% rename from alib2cli/src/ast/ImmediateFileParam.h rename to alib2cli/src/ast/params/ImmediateFileParam.h diff --git a/alib2cli/src/ast/ImmediateParam.h b/alib2cli/src/ast/params/ImmediateParam.h similarity index 100% rename from alib2cli/src/ast/ImmediateParam.h rename to alib2cli/src/ast/params/ImmediateParam.h diff --git a/alib2cli/src/ast/PreviousResultParam.h b/alib2cli/src/ast/params/PreviousResultParam.h similarity index 100% rename from alib2cli/src/ast/PreviousResultParam.h rename to alib2cli/src/ast/params/PreviousResultParam.h diff --git a/alib2cli/src/ast/StatementParam.h b/alib2cli/src/ast/params/StatementParam.h similarity index 100% rename from alib2cli/src/ast/StatementParam.h rename to alib2cli/src/ast/params/StatementParam.h diff --git a/alib2cli/src/ast/BindedFileResultStatement.h b/alib2cli/src/ast/statements/BindedFileResultStatement.h similarity index 100% rename from alib2cli/src/ast/BindedFileResultStatement.h rename to alib2cli/src/ast/statements/BindedFileResultStatement.h diff --git a/alib2cli/src/ast/BindedVariableResultStatement.h b/alib2cli/src/ast/statements/BindedVariableResultStatement.h similarity index 100% rename from alib2cli/src/ast/BindedVariableResultStatement.h rename to alib2cli/src/ast/statements/BindedVariableResultStatement.h diff --git a/alib2cli/src/ast/CastStatement.h b/alib2cli/src/ast/statements/CastStatement.h similarity index 100% rename from alib2cli/src/ast/CastStatement.h rename to alib2cli/src/ast/statements/CastStatement.h diff --git a/alib2cli/src/ast/FileResultStatement.h b/alib2cli/src/ast/statements/FileResultStatement.h similarity index 100% rename from alib2cli/src/ast/FileResultStatement.h rename to alib2cli/src/ast/statements/FileResultStatement.h diff --git a/alib2cli/src/ast/PreviousResultStatement.h b/alib2cli/src/ast/statements/PreviousResultStatement.h similarity index 100% rename from alib2cli/src/ast/PreviousResultStatement.h rename to alib2cli/src/ast/statements/PreviousResultStatement.h diff --git a/alib2cli/src/ast/PrintResultStatement.h b/alib2cli/src/ast/statements/PrintResultStatement.h similarity index 100% rename from alib2cli/src/ast/PrintResultStatement.h rename to alib2cli/src/ast/statements/PrintResultStatement.h diff --git a/alib2cli/src/ast/SingleStatement.h b/alib2cli/src/ast/statements/SingleStatement.h similarity index 100% rename from alib2cli/src/ast/SingleStatement.h rename to alib2cli/src/ast/statements/SingleStatement.h diff --git a/alib2cli/src/ast/StatementList.h b/alib2cli/src/ast/statements/StatementList.h similarity index 100% rename from alib2cli/src/ast/StatementList.h rename to alib2cli/src/ast/statements/StatementList.h diff --git a/alib2cli/src/parser/Parser.cpp b/alib2cli/src/parser/Parser.cpp index 48f3be4d8e1828b9b3154d6206cf7f297573ae5d..3d38178c31ecf416a46a2b68ff15602a4e6b75e7 100644 --- a/alib2cli/src/parser/Parser.cpp +++ b/alib2cli/src/parser/Parser.cpp @@ -1,21 +1,21 @@ #include <parser/Parser.h> -#include <ast/CastStatement.h> -#include <ast/SingleStatement.h> -#include <ast/FileResultStatement.h> -#include <ast/BindedFileResultStatement.h> -#include <ast/BindedVariableResultStatement.h> -#include <ast/PrintResultStatement.h> -#include <ast/PreviousResultStatement.h> - -#include <ast/StatementParam.h> -#include <ast/ImmediateFileParam.h> -#include <ast/BindedFileParam.h> -#include <ast/PreviousResultParam.h> -#include <ast/ImmediateParam.h> -#include <ast/BindedParam.h> -#include <ast/BindedVariableParam.h> -#include <ast/CastParam.h> +#include <ast/statements/CastStatement.h> +#include <ast/statements/SingleStatement.h> +#include <ast/statements/FileResultStatement.h> +#include <ast/statements/BindedFileResultStatement.h> +#include <ast/statements/BindedVariableResultStatement.h> +#include <ast/statements/PrintResultStatement.h> +#include <ast/statements/PreviousResultStatement.h> + +#include <ast/params/StatementParam.h> +#include <ast/params/ImmediateFileParam.h> +#include <ast/params/BindedFileParam.h> +#include <ast/params/PreviousResultParam.h> +#include <ast/params/ImmediateParam.h> +#include <ast/params/BindedValueParam.h> +#include <ast/params/BindedVariableParam.h> +#include <ast/params/CastParam.h> #include <command/ExecuteCommand.h> #include <command/QuitCommand.h> @@ -66,7 +66,7 @@ std::unique_ptr < Param > Parser::param ( ) { match ( cli::Lexer::TokenType::COLON_SIGN ); std::string name = getTokenValue ( ); match ( cli::Lexer::TokenType::INTEGER, cli::Lexer::TokenType::IDENTIFIER ); - return std::make_unique < BindedParam > ( std::move ( name ) ); + return std::make_unique < BindedValueParam > ( std::move ( name ) ); } else if ( check ( cli::Lexer::TokenType::DOLAR_SIGN ) ) { match ( cli::Lexer::TokenType::DOLAR_SIGN ); std::string name = getTokenValue ( ); @@ -82,6 +82,10 @@ std::shared_ptr < Statement > Parser::first_statement ( ) { match ( cli::Lexer::TokenType::DOLAR_SIGN ); std::string name = matchIdentifier ( ); return std::make_shared < PreviousResultStatement > ( std::move ( name ) ); + } else if ( check ( cli::Lexer::TokenType::COLON_SIGN ) ) { + match ( cli::Lexer::TokenType::COLON_SIGN ); + std::string name = matchIdentifier ( ); + return std::make_shared < PreviousResultStatement > ( std::move ( name ) ); } else { return single_statement ( ); } diff --git a/alib2cli/src/parser/Parser.h b/alib2cli/src/parser/Parser.h index 61ba5be85bb6ced3dc22d90549b991836efdfb33..d03ba802d5427a3087769becab08543fe1c7ac1c 100644 --- a/alib2cli/src/parser/Parser.h +++ b/alib2cli/src/parser/Parser.h @@ -3,7 +3,7 @@ #include <ast/Param.h> #include <ast/Statement.h> -#include <ast/StatementList.h> +#include <ast/statements/StatementList.h> #include <command/Command.h>