Evaluator base class.
More...
#include <parsnip_evaluate.h>
|
|
using | StringType = std::string |
| |
|
using | CommandId = int |
| |
|
| static void | construct (EvaluatorRef &evaluator, const ArgvCursor &cursor, CommandId id, Parser *parent_parser) |
| | Construct token handler from the token in a parsing definition.
|
| |
|
| static void | set_name (EvaluatorRef &target, const std::string &name) |
| | Assign a name by which to store values for value evaluators.
|
| |
|
|
CommandId | command_id {NoCommand} |
| | If this completes a command, the command ID.
|
| |
|
std::string | name |
| | If not empty, the name by which this value shall be accessed.
|
| |
|
|
class | ValueEvaluator |
| |
|
class | KeywordEvaluator |
| |
|
class | RemainingValuesEvaluator |
| |
|
class | RemainderEvaluator |
| |
|
class | OptionEvaluator |
| |
|
class | OptionParser |
| |
|
class | Schema |
| |
|
class | SchemaSet |
| |
◆ Evaluator()
| Parsnip::Evaluator::Evaluator |
( |
Evaluator * |
original | ) |
|
Upgrade an evaluator.
The original must be a TerminatorEvaluator; other type should never be upgraded. Herein we initialize the new evaluator with the relevant bits.
◆ construct()
| void Parsnip::Evaluator::construct |
( |
EvaluatorRef & |
parser, |
|
|
const ArgvCursor & |
cursor, |
|
|
CommandId |
id, |
|
|
Parser * |
parent_parser |
|
) |
| |
|
static |
Construct token handler from the token in a parsing definition.
- Parameters
-
| parser | The parser to update or construct with new definitions. |
| cursor | Points to the token defining what to construct. |
| id | The command ID to use for completed commands of this definition. |
| parent_parser | Passed through; see ValueEvaluator::construct. |
◆ constructSchema()
| virtual void Parsnip::Evaluator::constructSchema |
( |
const DictionarySchema & |
schema, |
|
|
const Schema::OptionSchemas & |
option_schemas, |
|
|
const SchemaIntegratorCallback & |
integrator |
|
) |
| const |
|
protectedpure virtual |
Construct a schema from an evaluator tree.
This function depth-first searches the evaluation tree, calling the integrator function at leaf nodes and other valid statement endpoints.
- Parameters
-
| schema | The schema, as constructed from the parse tree root. |
| option_schemas | Schemas for option parsers that may be needed. |
| integrator | An integrator that merges various statement patterns into a complete schema. |
- Exceptions
-
| NoSuchKey | A necessary option schema was not found. |
| SchemaConflict | Statement definitions generate schema inconsistencies. |
Implemented in Parsnip::ValueEvaluator, Parsnip::KeywordEvaluator, Parsnip::RemainingValuesEvaluator, and Parsnip::OptionEvaluator.
◆ convertToOptionEvaluator()
| virtual void Parsnip::Evaluator::convertToOptionEvaluator |
( |
| ) |
|
|
protectedpure virtual |
◆ evaluate()
Evaluate a token in the command line, and recurse if there is more to go.
- Parameters
-
| cursor | Provides the command line tokens. |
| result_dict | Dictionary into which to put values. |
- Returns
- ID code of command selected.
◆ evaluateToken()
◆ getNextEvaluator()
| virtual Evaluator * Parsnip::Evaluator::getNextEvaluator |
( |
const StringType & |
token | ) |
const |
|
protectedpure virtual |
◆ operator==()
| bool Parsnip::Evaluator::operator== |
( |
const Evaluator & |
other | ) |
const |
|
virtual |
◆ set_name()
| void Parsnip::Evaluator::set_name |
( |
EvaluatorRef & |
target, |
|
|
const std::string & |
nam |
|
) |
| |
|
staticprotected |
Assign a name by which to store values for value evaluators.
There must be no prior name, or the same as the prior name.
- Parameters
-
| target | The evalutor whose name to set. If necessary, the target is instantiated. |
| nam | The name. If empty the assignment is ignored. |
◆ setCommandId()
| void Parsnip::Evaluator::setCommandId |
( |
CommandId |
id | ) |
|
|
protected |
Set the command ID in an evaluator.
The ID must not be redefined/changed.
- Parameters
-
The documentation for this class was generated from the following files: