xorp

Parser Class Reference

A lex/yacc wrapper which parses a configuration and returns nodes. More...

#include <parser.hh>

Inheritance diagram for Parser:
RibParser XrlRibParser

List of all members.

Public Types

typedef vector< Node * > Nodes

Public Member Functions

Nodes * parse (const Term::BLOCKS &block, const string &text)
string last_error ()
 This should be called if parse returns null.
int parse (const string &str) const
bool add_command (Command *command)
bool add_argtype (ArgumentParser *arg)

Private Member Functions

ArgumentParserget_argument_parser (const string &name) const
int split_into_words (const string &str, vector< string > &words) const

Private Attributes

string _last_error
char _separator
map< string, Command * > _templates
map< string, ArgumentParser * > _argtypes

Detailed Description

A lex/yacc wrapper which parses a configuration and returns nodes.

This class parses a raw user configuration and returns a vector of nodes.

Each node will normally relate to a single statement. The vector of nodes reflects all the statements present.


Member Function Documentation

string Parser::last_error ( )

This should be called if parse returns null.

If parse is successful, the value of last_error is undefined.

Returns:
the last error of the parse.
Parser::Nodes * Parser::parse ( const Term::BLOCKS &  block,
const string &  text 
)
Parameters:
blockthe term block which is being parsed [action/src/dest].
textConfiguration to parse.
Returns:
the parse-tree of the configuration. Null on error.

The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations