Project

General

Profile

Statistics
| Branch: | Revision:

cool / src / lib / GMLMIP-0.1 / parser / mlf-driver.cpp @ 7c4d2eb4

History | View | Annotate | Download (1.11 KB)

1 e034e268 Thorsten WiƟmann
#include "mlf-driver.h"
2
#include "mlf-parser.tab.h"
3
4
mlf_driver::mlf_driver() : trace_scanning (false), trace_parsing (false){
5
        formula = NULL;
6
}
7
8
int mlf_driver::parse (const std::string &f){
9
        file = f;
10
        scan_begin ();
11
        yy::mlf_parser parser (*this);
12
        parser.set_debug_level (trace_parsing);
13
        int res = parser.parse ();
14
        scan_end ();
15
        return res;
16
}
17
18
void mlf_driver::error (const yy::location& l, const std::string& m){
19
        std::cerr << l << ": " << m << std::endl;
20
}
21
22
void mlf_driver::error (const std::string& m){
23
        std::cerr << m << std::endl;
24
}
25
26
bdd mlf_driver::variable(int n){
27
        if(!formula){
28
                cout << "driver.formula was null!" << endl;
29
                exit(1);
30
        }
31
        return formula->variable(n);
32
}
33
34
bdd mlf_driver::modal(bdd *b, int n, int m){
35
        if(!formula){
36
                cout << "driver.formula was null!" << endl;
37
                exit(1);
38
        }
39
        return formula->modal(b, n, m);
40
}
41
42
43
void mlf_driver::set_formula_bdd(bdd b){
44
        if(!formula){
45
                cout << "driver.formula was null!" << endl;
46
                exit(1);
47
        }
48
        formula->set_bdd(b);
49
}
50
51
void mlf_driver::extract_formula(IFormula* &ptr){
52
        ptr = formula;
53
        formula = NULL;
54
}                
55
56
mlf_driver::~mlf_driver(){
57
        if(formula!=NULL)
58
                delete formula;
59
}