libstx-exparser/ExpressionParser.cc File Reference

Implementation of the parser using a boost::spirit grammar and a different specializations of ParseNode. More...

#include "ExpressionParser.h"
#include <boost/spirit/core.hpp>
#include <boost/spirit/tree/ast.hpp>
#include <boost/spirit/tree/tree_to_xml.hpp>
#include <boost/spirit/utility/lists.hpp>
#include <boost/spirit/utility/distinct.hpp>
#include <boost/spirit/utility/escape_char.hpp>
#include <boost/spirit/utility/grammar_def.hpp>
#include <iostream>
#include <sstream>
#include <cmath>

Go to the source code of this file.

Namespaces

namespace  stx
namespace  stx::Grammar
namespace  boost::spirit

Classes

struct  stx::Grammar::ExpressionGrammar
 The boost::spirit expression parser grammar. More...
struct  stx::Grammar::ExpressionGrammar::definition< ScannerT >
 The boost::spirit expression parser grammar definition (for a specific scanner) with two entry points. More...
class  stx::Grammar::PNConstant
 Constant value nodes of the parse tree. More...
class  stx::Grammar::PNVariable
 Parse tree node representing a variable place-holder. More...
class  stx::Grammar::PNFunction
 Parse tree node representing a function place-holder. More...
class  stx::Grammar::PNUnaryArithmExpr
 Parse tree node representing an unary operator: '+', '-', '!' or "not". More...
class  stx::Grammar::PNBinaryArithmExpr
 Parse tree node representing a binary operators: +, -, * and / for numeric values. More...
class  stx::Grammar::PNCastExpr
 Parse tree node handling type conversions within the tree. More...
class  stx::Grammar::PNBinaryComparisonExpr
 Parse tree node representing a binary comparison operator: ==, =, !=, <, >, >=, <=, =>, =<. More...
class  stx::Grammar::PNBinaryLogicExpr
 Parse tree node representing a binary logic operator: and, or, &&, ||. More...

Typedefs

typedef std::string::const_iterator stx::Grammar::InputIterT
 Iterator type used by spirit's parsers.
typedef tree_match< InputIterT > stx::Grammar::ParseTreeMatchT
 Resulting match tree after parsing.
typedef ParseTreeMatchT::const_tree_iterator stx::Grammar::TreeIterT
 The iterator of the match tree used in build_expr().

Enumerations

enum  stx::Grammar::parser_ids {
  stx::Grammar::boolean_const_id = 1, stx::Grammar::integer_const_id, stx::Grammar::long_const_id, stx::Grammar::double_const_id,
  stx::Grammar::string_const_id, stx::Grammar::constant_id, stx::Grammar::function_call_id, stx::Grammar::function_identifier_id,
  stx::Grammar::varname_id, stx::Grammar::atom_expr_id, stx::Grammar::unary_expr_id, stx::Grammar::mul_expr_id,
  stx::Grammar::add_expr_id, stx::Grammar::cast_expr_id, stx::Grammar::cast_spec_id, stx::Grammar::comp_expr_id,
  stx::Grammar::and_expr_id, stx::Grammar::or_expr_id, stx::Grammar::expr_id, stx::Grammar::exprlist_id
}
 This enum specifies ids for the parse tree nodes created for each rule. More...

Functions

distinct_parser stx::Grammar::keyword_p ("a-zA-Z0-9_")
 Keyword parser used for matching words with () and spaces as separators.
static ParseNode * stx::Grammar::build_expr (TreeIterT const &i)
 Build_expr is the constructor method to create a parse tree from the AST-tree returned by the spirit parser.
ParseTreeList stx::Grammar::build_exprlist (TreeIterT const &i)
 build_exprlist constructs the vector holding the ParseNode parse tree for each parse tree.
static void stx::Grammar::tree_dump_xml (std::ostream &os, const std::string &input, const tree_parse_info< InputIterT > &info)
 Uses boost::spirit function to convert the parse tree into a XML document.
const ParseTree stx::parseExpression (const std::string &input)
 Parse the given input expression into a parse tree.
std::string stx::parseExpressionXML (const std::string &input)
 Parse the given input expression into a parse tree.
ParseTreeList stx::parseExpressionList (const std::string &input)
 Parse the given input as an expression list "expr1, expr2, ..." into a vector of parse trees.


Detailed Description

Implementation of the parser using a boost::spirit grammar and a different specializations of ParseNode.

Definition in file ExpressionParser.cc.


Generated on Tue Jul 17 16:51:58 2007 for STX Expression Parser by  doxygen 1.5.2