Bridge++
Ver. 1.1.x
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
evalexpr.h
Go to the documentation of this file.
1
13
#ifndef EVALEXPR_INCLUDED
14
#define EVALEXPR_INCLUDED
15
16
#include <map>
17
#include <string>
18
#include <cstring>
19
20
#include "
evalexpr_parser.h
"
21
#include "
evalexpr_symbol.h
"
22
23
#include "
bridgeIO.h
"
24
using
Bridge::vout
;
25
27
38
class
EvalExpr
39
{
40
public
:
41
42
typedef
yy::parser::semantic_type
semantic_type
;
43
typedef
yy::parser::token
token
;
44
45
EvalExpr
(
const
std::string& line,
bool
debug =
false
)
46
:
m_src
(line),
m_pos
(0),
m_result
(0),
47
m_trace
(debug) {}
48
49
// lexer
50
int
next_token
(
semantic_type
& yylval);
51
52
// parse
53
// bool parse(double& result);
54
double
parse
();
55
56
// symbol_table manipulation
57
double
get_symbol_value
(
char
const
*name);
58
function_t
get_symbol_function
(
char
const
*name);
59
60
// parser interface
61
void
set_result
(
double
result);
62
63
void
error
(
const
std::string& msg);
64
65
private
:
66
67
const
std::string
m_src
;
68
unsigned
int
m_pos
;
69
double
m_result
;
70
71
bool
m_trace
;
72
73
static
SymbolTable
global_symbol_table
;
74
};
75
76
77
// lexer interface for parser
78
int
yylex
(
EvalExpr::semantic_type
*yylval,
EvalExpr
& driver);
79
#endif
src
Tools
evalexpr.h
Generated on Tue Jul 23 2013 10:48:50 for Bridge++ by
1.8.3.1