parsing library
Data Structures | Public Types | Public Member Functions | Friends
Parsnip::Parser Class Reference

A class for parsing command lines. More...

#include <parsnip_command.h>

Data Structures

struct  Definition
struct  Result

Public Types

using CommandId = int
using StringType = std::string
using Definitions = std::vector< Definition >

Public Member Functions

 Parser (const Definitions &defs)
 Construct a parser and initialize it with some statements. More...
void addOptionParser (const std::string &name, const OptionParserRef &add)
 Register an options parser for use. More...
void addStatements (const Definitions &defs)
 Add statements to the parser. More...
Result evaluate (const StringType &command) const
 Evaluate a command. More...
bool operator== (const Parser &) const
 Check if a parser is identical to another parser.
bool operator!= (const Parser &other) const


class OptionEvaluator
class SchemaSet

Detailed Description

A class for parsing command lines.

Constructor & Destructor Documentation

◆ Parser()

Parsnip::Parser::Parser ( const Definitions &  defs)

Construct a parser and initialize it with some statements.

defsThe statement definitions.

Member Function Documentation

◆ addOptionParser()

void Parsnip::Parser::addOptionParser ( const std::string &  name,
const OptionParserRef &  add 

Register an options parser for use.

nameThe option parser's name.
addThe option parser to register.

◆ addStatements()

void Parsnip::Parser::addStatements ( const Definitions &  defs)

Add statements to the parser.

defsThe statement definitions.

◆ evaluate()

Parser::Result Parsnip::Parser::evaluate ( const StringType &  command) const

Evaluate a command.

commandthe command.
A result, which contains the command ID and extracted parameters.
Exceptionsrepresenting various command errors.

The documentation for this class was generated from the following files: