|
pianod2
multisource multiuser scriptable networked music player
|
#include <parsnip_evaluate.h>

Public Types | |
| using | StringType = std::string |
| using | CommandId = int |
Public Member Functions | |
| Evaluator (Evaluator *original) | |
| Upgrade an evaluator. More... | |
| virtual | ~Evaluator ()=default |
| int | evaluate (ArgvCursor *cursor, Parsnip::Data &result_dict) |
| Evaluate a token in the command line, and recurse if there is more to go. More... | |
| virtual bool | operator== (const Evaluator &) const |
| Check if two evaluators are the same. More... | |
| bool | operator!= (const Evaluator &other) const |
Static Public Member Functions | |
| static void | construct (EvaluatorRef &evaluator, const ArgvCursor &cursor, CommandId id, Parser *parent_parser) |
| Construct token handler from the token in a parsing definition. More... | |
Protected Member Functions | |
| Evaluator ()=default | |
| void | setCommandId (CommandId id) |
| Set the command ID in an evaluator. More... | |
| virtual Evaluator * | getNextEvaluator (const StringType &token) const =0 |
| Determine if and how to evaluate additional command line tokens. More... | |
| virtual Parsnip::Data | evaluateToken (class ArgvCursor *cursor) const =0 |
| Evaluate command line tokens. More... | |
| virtual void | convertToOptionEvaluator ()=0 |
| Make any changes to the parse tree to convert it to an options evaluator. More... | |
| virtual void | constructSchema (const DictionarySchema &schema, const Schema::OptionSchemas &option_schemas, const SchemaIntegratorCallback &integrator) const =0 |
| Construct a schema from an evaluator tree. More... | |
Static Protected Member Functions | |
| static void | set_name (EvaluatorRef &target, const std::string &name) |
| Assign a name by which to store values for value evaluators. More... | |
Protected Attributes | |
| CommandId | command_id {NoCommand} |
| If this completes a command, the command ID. More... | |
| std::string | name |
| If not empty, the name by which this value shall be accessed. More... | |
Static Private Attributes | |
| static const CommandId | NoCommand = -1 |
| static const CommandId | EndOfOption = -2 |
Friends | |
| class | ValueEvaluator |
| class | KeywordEvaluator |
| class | RemainingValuesEvaluator |
| class | RemainderEvaluator |
| class | OptionEvaluator |
| class | OptionParser |
| class | Schema |
| class | SchemaSet |
Evaluator base class.
| using Parsnip::Evaluator::CommandId = int |
| using Parsnip::Evaluator::StringType = std::string |
|
protecteddefault |
| 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.

|
virtualdefault |
|
static |
Construct token handler from the token in a parsing definition.
| 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. |


|
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.
| 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. |
| NoSuchKey | A necessary option schema was not found. |
| SchemaConflict | Statement definitions generate schema inconsistencies. |
Implemented in Parsnip::OptionEvaluator, Parsnip::RemainingValuesEvaluator, Parsnip::KeywordEvaluator, Parsnip::ValueEvaluator, Parsnip::EndOfOptionEvaluator, and Parsnip::TerminatorEvaluator.
|
protectedpure virtual |
Make any changes to the parse tree to convert it to an options evaluator.
Implemented in Parsnip::RemainderEvaluator, Parsnip::KeywordEvaluator, Parsnip::ValueEvaluator, Parsnip::EndOfOptionEvaluator, and Parsnip::TerminatorEvaluator.
| int Parsnip::Evaluator::evaluate | ( | ArgvCursor * | cursor, |
| Parsnip::Data & | result_dict | ||
| ) |
Evaluate a token in the command line, and recurse if there is more to go.
| cursor | Provides the command line tokens. |
| result_dict | Dictionary into which to put values. |


|
protectedpure virtual |
Evaluate command line tokens.
| cursor | Provides tokens from the command line. Must be bumped forward as they are processed. |
Implemented in Parsnip::OptionEvaluator, Parsnip::RemainingValuesEvaluator, Parsnip::KeywordEvaluator, Parsnip::RealEvaluator, Parsnip::IntegerEvaluator, Parsnip::RawRemainderEvaluator, Parsnip::RegExEvaluator, Parsnip::StringEvaluator, Parsnip::EndOfOptionEvaluator, and Parsnip::TerminatorEvaluator.

|
protectedpure virtual |
Determine if and how to evaluate additional command line tokens.
| token | The current token being evaluated. |
Implemented in Parsnip::RemainderEvaluator, Parsnip::ValueEvaluator, Parsnip::EndOfOptionEvaluator, Parsnip::TerminatorEvaluator, and Parsnip::KeywordEvaluator.

|
inline |
|
virtual |
Check if two evaluators are the same.
Subclasses should override this to check their details.
| other | Another evaluator to which to compare. |
Reimplemented in Parsnip::RemainderEvaluator, Parsnip::KeywordEvaluator, Parsnip::RealEvaluator, Parsnip::IntegerEvaluator, Parsnip::RegExEvaluator, Parsnip::ValueEvaluator, and Parsnip::OptionEvaluator.
|
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.
| target | The evalutor whose name to set. If necessary, the target is instantiated. |
| nam | The name. If empty the assignment is ignored. |

|
protected |
Set the command ID in an evaluator.
The ID must not be redefined/changed.
| id | The ID being set. |

|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
If this completes a command, the command ID.
|
staticprivate |
|
protected |
If not empty, the name by which this value shall be accessed.
|
staticprivate |