diff options
| author | Li Jin <dragon-fly@qq.com> | 2017-07-16 23:47:58 +0800 |
|---|---|---|
| committer | Li Jin <dragon-fly@qq.com> | 2017-07-16 23:47:58 +0800 |
| commit | 21328c2299eebc03c13478d7d214f9ed58d9688e (patch) | |
| tree | acf359dd833a4d0b5dfefaf4e2bed7b29dad4974 /MoonParser/main.cpp | |
| parent | 9e63302e5906d53d9f39f64c549b9aa7e806b669 (diff) | |
| download | yuescript-21328c2299eebc03c13478d7d214f9ed58d9688e.tar.gz yuescript-21328c2299eebc03c13478d7d214f9ed58d9688e.tar.bz2 yuescript-21328c2299eebc03c13478d7d214f9ed58d9688e.zip | |
remove uses of dynamic_cast.
Diffstat (limited to 'MoonParser/main.cpp')
| -rw-r--r-- | MoonParser/main.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/MoonParser/main.cpp b/MoonParser/main.cpp index 985fdcf..202a8df 100644 --- a/MoonParser/main.cpp +++ b/MoonParser/main.cpp | |||
| @@ -50,7 +50,7 @@ struct Data | |||
| 50 | rule Any = any(); | 50 | rule Any = any(); |
| 51 | rule plain_space = *set(" \t"); | 51 | rule plain_space = *set(" \t"); |
| 52 | rule Break = nl(-expr('\r') >> '\n'); | 52 | rule Break = nl(-expr('\r') >> '\n'); |
| 53 | rule White = *(set(" \t\r") | Break); | 53 | rule White = *(set(" \t") | Break); |
| 54 | rule Stop = Break | eof(); | 54 | rule Stop = Break | eof(); |
| 55 | rule Comment = "--" >> *(not_(set("\r\n")) >> Any) >> and_(Stop); | 55 | rule Comment = "--" >> *(not_(set("\r\n")) >> Any) >> and_(Stop); |
| 56 | rule Indent = *set(" \t"); | 56 | rule Indent = *set(" \t"); |
| @@ -556,12 +556,14 @@ rule BlockEnd = Block >> eof(); | |||
| 556 | #define AST_LEAF(type) \ | 556 | #define AST_LEAF(type) \ |
| 557 | class type##_t : public ast_node \ | 557 | class type##_t : public ast_node \ |
| 558 | { \ | 558 | { \ |
| 559 | public: | 559 | public: \ |
| 560 | virtual int get_type() override { return ast_type<type##_t>(); } | ||
| 560 | 561 | ||
| 561 | #define AST_NODE(type) \ | 562 | #define AST_NODE(type) \ |
| 562 | class type##_t : public ast_container \ | 563 | class type##_t : public ast_container \ |
| 563 | { \ | 564 | { \ |
| 564 | public: | 565 | public: \ |
| 566 | virtual int get_type() override { return ast_type<type##_t>(); } | ||
| 565 | 567 | ||
| 566 | #define AST_END(type) \ | 568 | #define AST_END(type) \ |
| 567 | }; \ | 569 | }; \ |
| @@ -577,7 +579,6 @@ AST_LEAF(Num) | |||
| 577 | stream << static_cast<char>(*it); | 579 | stream << static_cast<char>(*it); |
| 578 | } | 580 | } |
| 579 | stream >> value; | 581 | stream >> value; |
| 580 | cout << value << '\n'; | ||
| 581 | } | 582 | } |
| 582 | AST_END(Num) | 583 | AST_END(Num) |
| 583 | 584 | ||
