From cb0ebffc5e3677a3d81082cdd35f884821b637fa Mon Sep 17 00:00:00 2001 From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz> Date: Wed, 2 Aug 2017 14:21:51 +0200 Subject: [PATCH] move params and statements to separate dirs --- .../src/ast/{ => params}/BindedFileParam.h | 0 .../BindedValueParam.h} | 10 ++--- .../ast/{ => params}/BindedVariableParam.h | 0 alib2cli/src/ast/{ => params}/CastParam.h | 0 .../src/ast/{ => params}/ImmediateFileParam.h | 0 .../src/ast/{ => params}/ImmediateParam.h | 0 .../ast/{ => params}/PreviousResultParam.h | 0 .../src/ast/{ => params}/StatementParam.h | 0 .../BindedFileResultStatement.h | 0 .../BindedVariableResultStatement.h | 0 .../src/ast/{ => statements}/CastStatement.h | 0 .../{ => statements}/FileResultStatement.h | 0 .../PreviousResultStatement.h | 0 .../{ => statements}/PrintResultStatement.h | 0 .../ast/{ => statements}/SingleStatement.h | 0 .../src/ast/{ => statements}/StatementList.h | 0 alib2cli/src/parser/Parser.cpp | 38 ++++++++++--------- alib2cli/src/parser/Parser.h | 2 +- 18 files changed, 27 insertions(+), 23 deletions(-) rename alib2cli/src/ast/{ => params}/BindedFileParam.h (100%) rename alib2cli/src/ast/{BindedParam.h => params/BindedValueParam.h} (68%) rename alib2cli/src/ast/{ => params}/BindedVariableParam.h (100%) rename alib2cli/src/ast/{ => params}/CastParam.h (100%) rename alib2cli/src/ast/{ => params}/ImmediateFileParam.h (100%) rename alib2cli/src/ast/{ => params}/ImmediateParam.h (100%) rename alib2cli/src/ast/{ => params}/PreviousResultParam.h (100%) rename alib2cli/src/ast/{ => params}/StatementParam.h (100%) rename alib2cli/src/ast/{ => statements}/BindedFileResultStatement.h (100%) rename alib2cli/src/ast/{ => statements}/BindedVariableResultStatement.h (100%) rename alib2cli/src/ast/{ => statements}/CastStatement.h (100%) rename alib2cli/src/ast/{ => statements}/FileResultStatement.h (100%) rename alib2cli/src/ast/{ => statements}/PreviousResultStatement.h (100%) rename alib2cli/src/ast/{ => statements}/PrintResultStatement.h (100%) rename alib2cli/src/ast/{ => statements}/SingleStatement.h (100%) rename alib2cli/src/ast/{ => statements}/StatementList.h (100%) 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 34b55dd469..f695465549 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 48f3be4d8e..3d38178c31 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 61ba5be85b..d03ba802d5 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> -- GitLab