Line data Source code
1 : /*******************************************************************************
2 : * *
3 : * Cosmos:(C)oncept et (O)utils (S)tatistique pour les (Mo)deles *
4 : * (S)tochastiques *
5 : * *
6 : * Copyright (C) 2009-2012 LSV & LACL *
7 : * Authors: Paolo Ballarini & Hilal Djafri *
8 : * Website: http://www.lsv.ens-cachan.fr/Software/cosmos *
9 : * *
10 : * This program is free software; you can redistribute it and/or modify *
11 : * it under the terms of the GNU General Public License as published by *
12 : * the Free Software Foundation; either version 3 of the License, or *
13 : * (at your option) any later version. *
14 : * *
15 : * This program is distributed in the hope that it will be useful, *
16 : * but WITHOUT ANY WARRANTY; without even the implied warranty of *
17 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
18 : * GNU General Public License for more details. *
19 : * *
20 : * You should have received a copy of the GNU General Public License along *
21 : * with this program; if not, write to the Free Software Foundation, Inc., *
22 : * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
23 : *******************************************************************************
24 : */
25 :
26 : #include "Eval-parser.hh"
27 : #include "Eval.hpp"
28 :
29 : #include "string.h"
30 :
31 : #include <string>
32 : #include <sstream>
33 : #include <fstream>
34 : #include <set>
35 :
36 :
37 :
38 :
39 : using namespace std;
40 :
41 111 : Eval::Eval() {
42 111 : trace_scanning = false;
43 111 : trace_parsing = false;
44 :
45 111 : }
46 :
47 111 : Eval::~Eval() {
48 111 : }
49 :
50 528 : int Eval::parse(const string& expr) {
51 :
52 :
53 528 : scan_expression(expr);
54 :
55 1056 : eval::Eval_parser parser(*this);
56 :
57 528 : parser.set_debug_level(trace_parsing);
58 :
59 528 : int res = parser.parse();
60 528 : scan_end();
61 1056 : return res;
62 : }
63 :
64 10 : void Eval::error(const eval::location& l, const std::string& m) {
65 10 : std::cerr << l << ": " << m << std::endl;
66 10 : }
67 :
68 0 : void Eval::error(const std::string& m) {
69 0 : std::cerr << m << std::endl;
70 105 : }
71 :
|