The result of an SCalc::Session::eval(). More...
#include <expression.hh>


Public Member Functions | |
| ParserResult (Session *s) | |
| Constructors/desctructors: | |
| Session * | session () |
| The SCalc::Session object used. | |
| virtual std::string | pretty_print ()=0 |
| Pretty printing of the result ? | |
| virtual int | can_delete () |
Conversion functions | |
ParserResult as such is not directly usable: you need to check its actual type and convert it to an appropriate subtype with these functions. | |
| virtual int | is_expression () |
| Is it a SCalc::Expression ? | |
| Expression * | to_expression () |
| Converts to SCalc::Expression. | |
| virtual int | is_syntax_error () |
| Is it a SCalc::SyntaxError ? | |
| SyntaxError * | to_syntax_error () |
| Converts to SCalc::SyntaxError. | |
| virtual int | is_func_def () |
| Is it a SCalc::FuncDef ? | |
| FuncDef * | to_func_def () |
| Converts to SCalc::FuncDef. | |
The result of an SCalc::Session::eval().
The base class for all the things the parser can return. As the parser can return quite a whole bunch of different things, it is not wise to use SCalc::Expression as the carrier for all. Instead, here comes this small wrapper that enables one to check the return type of everything. A ParserResult can be:
| virtual int SCalc::ParserResult::can_delete | ( | ) | [inline, virtual] |
Whether or not we can freely delete this result = nearly always yes, unless it is a named function
Reimplemented in SCalc::FuncDef.
| virtual int SCalc::ParserResult::is_expression | ( | ) | [inline, virtual] |
Is it a SCalc::Expression ?
Returns true if the object is a SCalc::Expression or one of its children.
Reimplemented in SCalc::Expression.
Referenced by to_expression().
| virtual int SCalc::ParserResult::is_func_def | ( | ) | [inline, virtual] |
Is it a SCalc::FuncDef ?
Returns true if the object is a SCalc::FuncDef or one of its children.
Reimplemented in SCalc::FuncDef.
Referenced by to_func_def().
| virtual int SCalc::ParserResult::is_syntax_error | ( | ) | [inline, virtual] |
Is it a SCalc::SyntaxError ?
Returns true if the object is a SCalc::SyntaxError or one of its children.
Reimplemented in SCalc::SyntaxError.
Referenced by to_syntax_error().
| Session* SCalc::ParserResult::session | ( | ) | [inline] |
The SCalc::Session object used.
Returns the SCalc::Session in which the expression was parsed.
Referenced by SCalc::Expression::evaluable().
| Expression* SCalc::ParserResult::to_expression | ( | ) | [inline] |
Converts to SCalc::Expression.
Returns a SCalc::Expression object or NULL if the object isn't an expression.
References is_expression().
| FuncDef* SCalc::ParserResult::to_func_def | ( | ) | [inline] |
Converts to SCalc::FuncDef.
Returns a SCalc::FuncDef object or NULL if the object doesn't represent a function definition.
References is_func_def().
| SyntaxError* SCalc::ParserResult::to_syntax_error | ( | ) | [inline] |
Converts to SCalc::SyntaxError.
Returns a SCalc::SyntaxError object or NULL if the object doesn't represent a syntax error.
References is_syntax_error().
1.7.1