summaryrefslogtreecommitdiff
path: root/cli/semantics
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-10-29 12:40:46 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-10-29 12:40:46 +0200
commit381f872a76f6ad8fc5caee172e903f08dd652547 (patch)
treee6eb9e81154eb33421da34af9fe66360d4119cab /cli/semantics
parent4c13393de7c54d3e2075ca89a0e3ade1415c59f8 (diff)
Add parsing support for scope-level documentation
Diffstat (limited to 'cli/semantics')
-rw-r--r--cli/semantics/doc.cxx28
-rw-r--r--cli/semantics/doc.hxx23
-rw-r--r--cli/semantics/elements.hxx3
-rw-r--r--cli/semantics/option.hxx11
4 files changed, 58 insertions, 7 deletions
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 <boris@codesynthesis.com>
+// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC
+// license : MIT; see accompanying LICENSE file
+
+#include <cutl/compiler/type-info.hxx>
+
+#include <semantics/doc.hxx>
+
+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 <boris@codesynthesis.com>
+// 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 <semantics/elements.hxx>
+
+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<string> 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 <vector>
-
#include <semantics/elements.hxx>
namespace semantics
@@ -138,8 +136,7 @@ namespace semantics
}
public:
- typedef std::vector<string> 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_;
};
}