From 1853e964e96c41e762ca0ab97259ee4e79d86ec7 Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Mon, 3 Nov 2014 13:35:54 -0800 Subject: Use the new ASTs --- src/ast/item.hpp | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'src/ast/item.hpp') diff --git a/src/ast/item.hpp b/src/ast/item.hpp index b54e55c..a8fe908 100644 --- a/src/ast/item.hpp +++ b/src/ast/item.hpp @@ -20,12 +20,12 @@ #include "fwd.hpp" -#include - #include "../compat/result.hpp" #include "../io/span.hpp" +#include "../sexpr/variant.hpp" + #include "../mmo/clif.t.hpp" #include "../mmo/ids.hpp" #include "../mmo/strs.hpp" @@ -41,17 +41,11 @@ namespace item { using io::Spanned; - struct ItemOrComment - { - io::LineSpan span; - - virtual ~ItemOrComment(); - }; - struct Comment : ItemOrComment + struct Comment { RString comment; }; - struct Item : ItemOrComment + struct Item { Spanned id; Spanned name; @@ -74,7 +68,15 @@ namespace item ast::script::ScriptBody equip_script; }; - Result> parse_item(io::LineCharReader& lr); + using ItemOrCommentBase = Variant; + struct ItemOrComment : ItemOrCommentBase + { + ItemOrComment(Comment o) : ItemOrCommentBase(std::move(o)) {} + ItemOrComment(Item o) : ItemOrCommentBase(std::move(o)) {} + io::LineSpan span; + }; + + Option> parse_item(io::LineCharReader& lr); } // namespace item } // namespace ast } // namespace tmwa -- cgit v1.2.3-70-g09d2