diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2012-05-10 11:09:13 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2012-05-10 11:09:13 +0200 |
commit | 4f9022f24c4591391637121c7274d9855b37bd93 (patch) | |
tree | 55d15cf4c092e28c588c31daf118cac7b4b5910a /cli/semantics | |
parent | 963eaef32dc1b35bd065de8b62d4c73a932208b2 (diff) |
Add support for options file inclusion
New include-path prefixes, c++: and cli:, are now recognized (e.g.,
include <cli:foo>;). Without a prefix, the include declarations is
considered to be c++-include unless the path ends with the .cli
extension.
The cli-included files are loaded and parsed. Currently, only inclusion
relative to the current file is supported. Duplicate inclusions are
detected and ignored based on the absolute filesystem path.
If a file cli-includes another file, then the runtime code is assumed
to come from the included file and is not generated.
Diffstat (limited to 'cli/semantics')
-rw-r--r-- | cli/semantics/unit.hxx | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/cli/semantics/unit.hxx b/cli/semantics/unit.hxx index 9aac2c3..f20ba82 100644 --- a/cli/semantics/unit.hxx +++ b/cli/semantics/unit.hxx @@ -24,21 +24,29 @@ namespace semantics class includes: public edge { public: + enum kind_type {quote, bracket}; + cli_unit& includer () const { return *includer_; } - string const& + kind_type + kind () const + { + return kind_; + } + + path const& file () const { return file_; } public: - includes (string const& file) - : file_ (file) + includes (kind_type kind, path const& file) + : kind_ (kind), file_ (file) { } @@ -49,7 +57,8 @@ namespace semantics } protected: - string file_; + kind_type kind_; + path file_; cli_unit* includer_; }; @@ -65,8 +74,8 @@ namespace semantics } public: - cli_includes (string const& file) - : includes (file) + cli_includes (kind_type kind, path const& file) + : includes (kind, file) { } @@ -92,8 +101,8 @@ namespace semantics } public: - cxx_includes (string const& file) - : includes (file) + cxx_includes (kind_type kind, path const& file) + : includes (kind, file) { } @@ -147,8 +156,8 @@ namespace semantics } public: - cli_unit (path const& file) - : node (file, 1, 1), graph_ (*this) + cli_unit (path const& file, size_t line, size_t column) + : node (file, line, column), graph_ (*this) { // Use a special edge to get this->name() return the global // namespace name (""). |