Limbo
3.5.4
Toggle main menu visibility
Loading...
Searching...
No Matches
limbo
parsers
lp
bison
LpDriver.h
Go to the documentation of this file.
1
7
8
#ifndef LPPARSER_DRIVER_H
9
#define LPPARSER_DRIVER_H
10
11
#include "
LpDataBase.h
"
12
16
namespace
LpParser
{
17
18
using
std::cout;
19
using
std::endl;
20
using
std::cerr;
21
using
std::string;
22
using
std::vector;
23
using
std::pair;
24
using
std::make_pair;
25
using
std::ostringstream;
26
35
class
Driver
36
{
37
public
:
40
Driver
(
LpDataBase
& db);
41
43
bool
trace_scanning
;
44
46
bool
trace_parsing
;
47
49
string
streamname
;
50
56
bool
parse_stream
(std::istream& in,
57
const
string
& sname =
"stream input"
);
58
64
bool
parse_string
(
const
string
& input,
65
const
string
& sname =
"string stream"
);
66
72
bool
parse_file
(
const
string
& filename);
73
74
// To demonstrate pure handling of parse errors, instead of
75
// simply dumping them on the standard error output, we will pass
76
// them to the driver using the following two member functions.
77
80
void
error
(
const
class
location& l,
const
string
& m);
81
84
void
error
(
const
string
& m);
85
88
class
Scanner*
lexer
;
89
92
LpDataBase
&
m_db
;
93
95
// coef*var
96
void
obj_cbk(
bool
minimize,
TermArray
const
& terms);
97
// sum coef*var compare_op constant
98
void
constraint_cbk(
TermArray
& terms,
char
compare,
double
constant);
99
// sum coef*var compare_op constant
100
void
constraint_cbk(
string
const
& name,
TermArray
& terms,
char
compare,
double
constant);
101
// var compare_op constant
102
void
bound_cbk(
string
const
& var,
char
compare,
double
constant);
103
// constant compare_op var
104
void
bound_cbk(
double
constant,
char
compare,
string
const
& var);
105
// constant1 compare_op1 var compare_op2 constant2
106
void
bound_cbk(
double
constant1,
char
compare1,
string
const
& var,
char
compare2,
double
constant2);
107
// generals type (integer)
108
void
generals_cbk(
StringArray
const
&);
109
// binary type
110
void
binary_cbk(
StringArray
const
&);
112
protected
:
113
};
114
119
bool
read
(
LpDataBase
& db,
const
string
& lpFile);
120
121
}
// namespace example
122
123
#endif
// EXAMPLE_DRIVER_H
LpDataBase.h
Database for Lp parser.
LpParser::Driver::Driver
Driver(LpDataBase &db)
LpParser::Driver::parse_file
bool parse_file(const string &filename)
LpParser::Driver::error
void error(const class location &l, const string &m)
LpParser::Driver::lexer
class Scanner * lexer
Definition
LpDriver.h:88
LpParser::Driver::trace_scanning
bool trace_scanning
enable debug output in the flex scanner
Definition
LpDriver.h:43
LpParser::Driver::trace_parsing
bool trace_parsing
enable debug output in the bison parser
Definition
LpDriver.h:46
LpParser::Driver::streamname
string streamname
stream name (file or input stream) used for error messages.
Definition
LpDriver.h:49
LpParser::Driver::m_db
LpDataBase & m_db
Definition
LpDriver.h:92
LpParser::Driver::parse_stream
bool parse_stream(std::istream &in, const string &sname="stream input")
LpParser::Driver::parse_string
bool parse_string(const string &input, const string &sname="string stream")
LpParser::Driver::error
void error(const string &m)
LpParser::LpDataBase
Base class for lp database. Only pure virtual functions are defined. User needs to inheritate this ...
Definition
LpDataBase.h:115
LpParser
namespace for LpParser
Definition
LpDataBase.h:21
LpParser::StringArray
std::vector< std::string > StringArray
string array
Definition
LpDataBase.h:40
LpParser::TermArray
std::vector< Term > TermArray
array of terms
Definition
LpDataBase.h:105
LpParser::read
bool read(LpDataBase &db, const string &lpFile)
API for LpParser. Read LP file and initialize database by calling user-defined callback functions.
Generated on
for Limbo by
1.17.0