From 2cd52ab17ee1b830bc53321b112411122dddc1c8 Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Tue, 6 Jan 2015 17:31:21 -0800 Subject: Use Spanned while parsing config --- src/io/span.cpp | 14 ++++++++++++++ src/io/span.hpp | 2 ++ 2 files changed, 16 insertions(+) (limited to 'src/io') diff --git a/src/io/span.cpp b/src/io/span.cpp index f4752f0..6d116c7 100644 --- a/src/io/span.cpp +++ b/src/io/span.cpp @@ -31,6 +31,20 @@ namespace tmwa { namespace io { + io::LineSpan Line::to_span() const + { + io::LineSpan rv; + rv.begin.text = this->text; + rv.begin.filename = this->filename; + rv.begin.line = this->line; + rv.begin.column = 1; + rv.end.text = this->text; + rv.end.filename = this->filename; + rv.end.line = this->line; + rv.end.column = this->text.size(); + return rv; + } + AString Line::message_str(ZString cat, ZString msg) const { MString out; diff --git a/src/io/span.hpp b/src/io/span.hpp index e474a7a..9962b7c 100644 --- a/src/io/span.hpp +++ b/src/io/span.hpp @@ -46,6 +46,8 @@ namespace io void note(ZString msg) const { message("note"_s, msg); } void warning(ZString msg) const { message("warning"_s, msg); } void error(ZString msg) const { message("error"_s, msg); } + + LineSpan to_span() const; }; // psst, don't tell anyone -- cgit v1.2.3-70-g09d2