From 4f9022f24c4591391637121c7274d9855b37bd93 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 10 May 2012 11:09:13 +0200 Subject: Add support for options file inclusion New include-path prefixes, c++: and cli:, are now recognized (e.g., include ;). 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. --- cli/semantics/unit.hxx | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) (limited to 'cli/semantics/unit.hxx') 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 (""). -- cgit v1.1