Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
ReturnCommand.h
Go to the documentation of this file.
1
6#pragma once
7
8#include <ast/Command.h>
10#include <ast/Expression.h>
11
12namespace cli {
13
14class ReturnCommand : public Command {
15 std::unique_ptr < Expression > m_command;
16
17public:
18 ReturnCommand ( std::unique_ptr < Expression > command ) : m_command ( std::move ( command ) ) {
19 }
20
21 CommandResult run ( Environment & environment ) const override {
22 if ( m_command )
23 environment.setResult ( m_command->translateAndEval ( environment ) );
24
26 }
27};
28
29} /* namespace cli */
30
Definition: Command.h:14
Definition: Environment.h:29
void setResult(std::shared_ptr< abstraction::Value > value)
Definition: Environment.h:101
Definition: ReturnCommand.h:14
ReturnCommand(std::unique_ptr< Expression > command)
Definition: ReturnCommand.h:18
CommandResult run(Environment &environment) const override
Definition: ReturnCommand.h:21
Definition: Arg.h:11
CommandResult
Definition: CommandResult.h:10
Definition: FordFulkerson.hpp:16