interpreter_pattern::Variable

class Variable : public interpreter_pattern::Expression

Terminal expression representing a variable lookup.

Public Functions

inline explicit Variable(std::string n)

Construct a variable reference.

Parameters:

nVariable name to look up in the context.

inline virtual bool interpret(const Context &ctx) const override

Look up the variable in ctx and return its value.

Throws:

std::out_of_range – if the variable is not bound in ctx.