From 381f872a76f6ad8fc5caee172e903f08dd652547 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 29 Oct 2015 12:40:46 +0200 Subject: Add parsing support for scope-level documentation --- cli/semantics/doc.cxx | 28 ++++++++++++++++++++++++++++ cli/semantics/doc.hxx | 23 +++++++++++++++++++++++ cli/semantics/elements.hxx | 3 +++ cli/semantics/option.hxx | 11 ++++------- 4 files changed, 58 insertions(+), 7 deletions(-) create mode 100644 cli/semantics/doc.cxx create mode 100644 cli/semantics/doc.hxx (limited to 'cli/semantics') diff --git a/cli/semantics/doc.cxx b/cli/semantics/doc.cxx new file mode 100644 index 0000000..4b2f9b4 --- /dev/null +++ b/cli/semantics/doc.cxx @@ -0,0 +1,28 @@ +// file : cli/semantics/doc.cxx +// author : Boris Kolpackov +// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC +// license : MIT; see accompanying LICENSE file + +#include + +#include + +namespace semantics +{ + // type info + // + namespace + { + struct init + { + init () + { + using compiler::type_info; + + type_info ti (typeid (doc)); + ti.add_base (typeid (nameable)); + insert (ti); + } + } init_; + } +} diff --git a/cli/semantics/doc.hxx b/cli/semantics/doc.hxx new file mode 100644 index 0000000..4fca4e8 --- /dev/null +++ b/cli/semantics/doc.hxx @@ -0,0 +1,23 @@ +// file : cli/semantics/doc.hxx +// author : Boris Kolpackov +// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC +// license : MIT; see accompanying LICENSE file + +#ifndef CLI_SEMANTICS_DOC_HXX +#define CLI_SEMANTICS_DOC_HXX + +#include + +namespace semantics +{ + // Scope-level documentation node. + // + class doc: public nameable, public doc_strings + { + public: + doc (path const& file, size_t line, size_t column) + : node (file, line, column) {} + }; +} + +#endif // CLI_SEMANTICS_DOC_HXX diff --git a/cli/semantics/elements.hxx b/cli/semantics/elements.hxx index e650f37..a0adce0 100644 --- a/cli/semantics/elements.hxx +++ b/cli/semantics/elements.hxx @@ -40,6 +40,9 @@ namespace semantics using fs::path; using fs::invalid_path; + // + // + typedef std::vector doc_strings; // // diff --git a/cli/semantics/option.hxx b/cli/semantics/option.hxx index 20e40c5..90a462a 100644 --- a/cli/semantics/option.hxx +++ b/cli/semantics/option.hxx @@ -6,8 +6,6 @@ #ifndef CLI_SEMANTICS_OPTION_HXX #define CLI_SEMANTICS_OPTION_HXX -#include - #include namespace semantics @@ -138,8 +136,7 @@ namespace semantics } public: - typedef std::vector doc_list; - typedef doc_list::const_iterator doc_iterator; + typedef doc_strings::const_iterator doc_iterator; doc_iterator doc_begin () const @@ -153,13 +150,13 @@ namespace semantics return doc_.end (); } - doc_list const& + doc_strings const& doc () const { return doc_; } - doc_list& + doc_strings& doc () { return doc_; @@ -186,7 +183,7 @@ namespace semantics private: belongs_type* belongs_; initialized_type* initialized_; - doc_list doc_; + doc_strings doc_; }; } -- cgit v1.1