79 (*result)(stack, result);
84 return Result({
"Internal Error: Missing VariableManipulator."});
91 return std::string() +
92 "! -- write to the variable top element the value beneath it\n" +
93 "@ -- replace the top variable with its value";
98 if(0 == str.compare(
"!")) {
100 }
else if(0 == str.compare(
"@")) {
Collection of Result information for an operation.
Stack of values to process from.
VariableSet & getVariables()
void popAfter(StackIterator &iter)
Pop all items after iter on the Stack.
std::shared_ptr< StackItem > Ptr
Iterator over a Stack from top to bottom.
@ NO_DEREFERENCE_NEXT
Do not dereference the next read.
const Result & getResult() const
void addError(unsigned int position, const std::string &message)
Add error message at position.
std::shared_ptr< StackOperator > Ptr
std::shared_ptr< Variable > Ptr
virtual ~VariableManipulatorCreator()
virtual StackOperator::Ptr create(const std::string &str)
virtual std::string getHelp() const
virtual Result operator()(Stack &stack, StackOperator::Ptr ofThis)
Execute this operator on stack.
VariableManipulator(Operation op)
Create to perform operation.
Operation
Operations supported.
@ READ
Replace the top variable with its value.
@ WRITE
Write the value in next-to-top to variable in top.
static VariableManipulator::Ptr create(Operation op)
Create to perform operation.
std::shared_ptr< VariableManipulator > Ptr
void set(const std::string &name, std::shared_ptr< StackItem > value)
Set the value of name, overriding existing values.
std::shared_ptr< StackItem > get(const std::string &name) const
Get the value of name, if any.
const std::string Ok
Operation was successful.
const std::string VariableNotSet
Operation required a variable.
Container of Calculator resources.