Loading...
Searching...
No Matches
expressionParser.h
Go to the documentation of this file.
// -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
#ifndef BALL_KERNEL_EXPRESSIONPARSER_H
#define BALL_KERNEL_EXPRESSIONPARSER_H
#ifndef BALL_KERNEL_EXPRESSION_TREE_H
# include <BALL/KERNEL/expressionTree.h>
#endif
namespace BALL
{
class BALL_EXPORT ExpressionParser
{
public:
class BALL_EXPORT SyntaxTree
{
public:
typedef list<SyntaxTree*>::iterator Iterator;
typedef list<SyntaxTree*>::const_iterator ConstIterator;
SyntaxTree();
SyntaxTree(const char* predicate_name, const char* args);
SyntaxTree(SyntaxTree* left, SyntaxTree* right, ExpressionTree::Type type);
virtual ~SyntaxTree();
virtual void clear();
Iterator begin();
Iterator end();
ConstIterator begin() const;
ConstIterator end() const;
void dump(std::ostream& is = std::cout, Size depth = 0) const;
String expression;
String predicate;
String argument;
bool evaluated;
bool negate;
ExpressionTree::Type type;
list<SyntaxTree*> children;
};
ExpressionParser();
ExpressionParser(const ExpressionParser& parser);
~ExpressionParser();
void parse(const String& s);
const SyntaxTree& getSyntaxTree() const;
struct State
{
Size char_count;
ExpressionParser* current_parser;
const char* buffer;
SyntaxTree* tree;
};
static State state;
protected:
SyntaxTree* syntax_tree_;
static ExpressionParser* current_parser_;
};
} // namespace BALL
#endif // BALL_KERNEL_EXPRESSIONPARSER_H
BALL_EXPORT
#define BALL_EXPORT
Definition COMMON/global.h:50
BALL::ExpressionParser::SyntaxTree
Definition expressionParser.h:32
BALL::ExpressionParser::SyntaxTree::children
list< SyntaxTree * > children
Definition expressionParser.h:137
BALL::ExpressionParser::SyntaxTree::argument
String argument
Definition expressionParser.h:121
BALL::ExpressionParser::SyntaxTree::type
ExpressionTree::Type type
Definition expressionParser.h:133
BALL::ExpressionParser::SyntaxTree::evaluated
bool evaluated
Definition expressionParser.h:125
BALL::ExpressionParser::SyntaxTree::SyntaxTree
SyntaxTree()
BALL::ExpressionParser::SyntaxTree::SyntaxTree
SyntaxTree(SyntaxTree *left, SyntaxTree *right, ExpressionTree::Type type)
BALL::ExpressionParser::SyntaxTree::dump
void dump(std::ostream &is=std::cout, Size depth=0) const
BALL::ExpressionParser::SyntaxTree::begin
Iterator begin()
BALL::ExpressionParser::SyntaxTree::predicate
String predicate
Definition expressionParser.h:117
BALL::ExpressionParser::SyntaxTree::clear
virtual void clear()
BALL::ExpressionParser::SyntaxTree::expression
String expression
Definition expressionParser.h:113
BALL::ExpressionParser::SyntaxTree::negate
bool negate
Definition expressionParser.h:129
BALL::ExpressionParser::SyntaxTree::Iterator
list< SyntaxTree * >::iterator Iterator
An iterator for the children of a given node.
Definition expressionParser.h:40
BALL::ExpressionParser::SyntaxTree::begin
ConstIterator begin() const
BALL::ExpressionParser::SyntaxTree::ConstIterator
list< SyntaxTree * >::const_iterator ConstIterator
A const iterator for the children of a given node.
Definition expressionParser.h:43
BALL::ExpressionParser::SyntaxTree::end
Iterator end()
BALL::ExpressionParser::SyntaxTree::end
ConstIterator end() const
BALL::ExpressionParser::SyntaxTree::~SyntaxTree
virtual ~SyntaxTree()
BALL::ExpressionParser::SyntaxTree::SyntaxTree
SyntaxTree(const char *predicate_name, const char *args)
BALL::ExpressionParser::syntax_tree_
SyntaxTree * syntax_tree_
Definition expressionParser.h:183
BALL::ExpressionParser::ExpressionParser
ExpressionParser(const ExpressionParser &parser)
BALL::ExpressionParser::getSyntaxTree
const SyntaxTree & getSyntaxTree() const
BALL::ExpressionParser::~ExpressionParser
~ExpressionParser()
BALL::ExpressionParser::current_parser_
static ExpressionParser * current_parser_
Definition expressionParser.h:184
BALL::ExpressionParser::ExpressionParser
ExpressionParser()
BALL::ExpressionParser::parse
void parse(const String &s)
BALL::ExpressionParser::state
static State state
Definition expressionParser.h:180
BALL::ExpressionTree::Type
Type
Definition expressionTree.h:39
BALL::String
Definition string.h:57
expressionTree.h
BALL
Definition constants.h:13
BALL::Size
BALL_SIZE_TYPE Size
Definition COMMON/global.h:114
BALL::ExpressionParser::State
Definition expressionParser.h:173
BALL::ExpressionParser::State::buffer
const char * buffer
Definition expressionParser.h:176
BALL::ExpressionParser::State::tree
SyntaxTree * tree
Definition expressionParser.h:177
BALL::ExpressionParser::State::current_parser
ExpressionParser * current_parser
Definition expressionParser.h:175
BALL::ExpressionParser::State::char_count
Size char_count
Definition expressionParser.h:174