Mercurial > hg > Members > nobuyasu > SampleSource
comparison Bison-Flex/CALC/Bison-Flex/calc-driver.h @ 0:db40c85cad7a default tip
upload sample source
author | nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 09 May 2011 03:11:59 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:db40c85cad7a |
---|---|
1 #ifndef __CALC_DRIVER_H__ | |
2 #define __CALC_DRIVER_H__ | |
3 | |
4 #include "calc-parser.hh" | |
5 #include "node.h" | |
6 | |
7 // Forward declarations. | |
8 class calc_driver; | |
9 | |
10 #define YY_DECL \ | |
11 yy::calc_parser::token_type \ | |
12 yylex(yy::calc_parser::semantic_type* yylval, \ | |
13 calc_driver& driver) | |
14 | |
15 YY_DECL; | |
16 | |
17 class calc_driver { | |
18 public: | |
19 calc_driver(); | |
20 virtual ~calc_driver(); | |
21 | |
22 std::string &get_filename() { return file; } | |
23 bool calc(const std::string &f); | |
24 | |
25 int value(const std::string *name) | |
26 { | |
27 return values[*name]; | |
28 } | |
29 void assign(const std::string *value, cnode *node); | |
30 void print(cnode *node); | |
31 void list(); | |
32 | |
33 // Error handling. | |
34 void error(const std::string& m); | |
35 | |
36 private: | |
37 void scan_begin(); | |
38 void scan_end(); | |
39 | |
40 private: | |
41 std::map<std::string, int> values; // 変数テーブル | |
42 | |
43 std::string file; | |
44 } ; | |
45 | |
46 #endif |