Evaluate a keyword in a command line.
More...
#include <parsnip_evaluate.h>
|
|
static bool | is_numeric (const std::string &value) |
| |
|
static std::string | tolower (std::string value) |
| |
| static void | construct (EvaluatorRef &parser, const ArgvCursor &cursor, CommandId id, Parser *parent_parser, const std::string &name, std::string keywords) |
| | Construct a keyword token handler.
|
| |
| static void | construct (EvaluatorRef &evaluator, const ArgvCursor &cursor, CommandId id, Parser *parent_parser) |
| | Construct token handler from the token in a parsing definition.
|
| |
|
|
class | ValueEvaluator |
| |
|
class | OptionEvaluator |
| |
|
|
using | StringType = std::string |
| |
|
using | CommandId = int |
| |
| void | setCommandId (CommandId id) |
| | Set the command ID in an evaluator.
|
| |
| 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.
|
| |
Evaluate a keyword in a command line.
◆ construct()
| void Parsnip::KeywordEvaluator::construct |
( |
EvaluatorRef & |
parser, |
|
|
const ArgvCursor & |
cursor, |
|
|
CommandId |
id, |
|
|
Parser * |
parent_parser, |
|
|
const std::string & |
name, |
|
|
std::string |
keywords |
|
) |
| |
|
static |
Construct a keyword token handler.
Construct token handler accepting a list of literal strings from the parsing definition.
- Parameters
-
◆ constructSchema()
| void Parsnip::KeywordEvaluator::constructSchema |
( |
const DictionarySchema & |
schema, |
|
|
const Schema::OptionSchemas & |
option_schemas, |
|
|
const SchemaIntegratorCallback & |
integrator |
|
) |
| const |
|
overridevirtual |
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. |
Implements Parsnip::Evaluator.
◆ convertToOptionEvaluator()
| void Parsnip::KeywordEvaluator::convertToOptionEvaluator |
( |
| ) |
|
|
overridevirtual |
Make any changes to the parse tree to convert it to an options evaluator.
Implements Parsnip::Evaluator.
◆ evaluateToken()
Store the current keyword as a string, if it's marked for recording.
Implements Parsnip::Evaluator.
◆ 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.
◆ getNextEvaluator()
| Evaluator * Parsnip::KeywordEvaluator::getNextEvaluator |
( |
const StringType & |
token | ) |
const |
|
overridevirtual |
Select an evaluator for the next element based on current token.
Implements Parsnip::Evaluator.
◆ operator==()
| bool Parsnip::KeywordEvaluator::operator== |
( |
const Evaluator & |
other | ) |
const |
|
overridevirtual |
Check if two evaluators are the same.
Subclasses should override this to check their details.
- Parameters
-
| other | Another evaluator to which to compare. |
Reimplemented from Parsnip::Evaluator.
The documentation for this class was generated from the following files: