From 21328c2299eebc03c13478d7d214f9ed58d9688e Mon Sep 17 00:00:00 2001 From: Li Jin Date: Sun, 16 Jul 2017 23:47:58 +0800 Subject: remove uses of dynamic_cast. --- MoonParser/main.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'MoonParser/main.cpp') 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 rule Any = any(); rule plain_space = *set(" \t"); rule Break = nl(-expr('\r') >> '\n'); -rule White = *(set(" \t\r") | Break); +rule White = *(set(" \t") | Break); rule Stop = Break | eof(); rule Comment = "--" >> *(not_(set("\r\n")) >> Any) >> and_(Stop); rule Indent = *set(" \t"); @@ -556,12 +556,14 @@ rule BlockEnd = Block >> eof(); #define AST_LEAF(type) \ class type##_t : public ast_node \ { \ -public: +public: \ + virtual int get_type() override { return ast_type(); } #define AST_NODE(type) \ class type##_t : public ast_container \ { \ -public: +public: \ + virtual int get_type() override { return ast_type(); } #define AST_END(type) \ }; \ @@ -577,7 +579,6 @@ AST_LEAF(Num) stream << static_cast(*it); } stream >> value; - cout << value << '\n'; } AST_END(Num) -- cgit v1.2.3-55-g6feb