Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Concepts
EvalCommand.h
Go to the documentation of this file.
1
6#pragma once
7
8#include <ast/Command.h>
10
12#include <iostream>
13
14namespace cli {
15
16class EvalCommand : public Command {
17 std::string m_code;
18
19public:
20 EvalCommand ( std::string code ) : m_code ( std::move ( code ) ) {
21 }
22
23 CommandResult run ( Environment & environment ) const override {
24 CommandResult state = environment.execute ( std::make_shared < cli::StringLineInterface > ( cli::StringLineInterface ( m_code ) ) );
25
26 if ( state != cli::CommandResult::QUIT )
28
29 return state;
30 }
31};
32
33} /* namespace cli */
34
Definition: Command.h:14
Definition: Environment.h:29
cli::CommandResult execute(const std::shared_ptr< cli::LineInterface > &lineInterface)
Definition: Environment.cpp:49
Definition: EvalCommand.h:16
EvalCommand(std::string code)
Definition: EvalCommand.h:20
CommandResult run(Environment &environment) const override
Definition: EvalCommand.h:23
Definition: StringLineInterface.h:15
Definition: Arg.h:11
CommandResult
Definition: CommandResult.h:10
Definition: FordFulkerson.hpp:16