summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2012-05-10 11:09:13 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2012-05-10 11:09:13 +0200
commit4f9022f24c4591391637121c7274d9855b37bd93 (patch)
tree55d15cf4c092e28c588c31daf118cac7b4b5910a /tests
parent963eaef32dc1b35bd065de8b62d4c73a932208b2 (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 'tests')
-rw-r--r--tests/lexer/driver.cxx9
-rw-r--r--tests/lexer/test-004.cli3
-rw-r--r--tests/lexer/test-004.std12
-rw-r--r--tests/parser/base.cli0
-rw-r--r--tests/parser/common.cli1
-rw-r--r--tests/parser/test-001.cli2
6 files changed, 23 insertions, 4 deletions
diff --git a/tests/lexer/driver.cxx b/tests/lexer/driver.cxx
index c16d92b..20dbf9d 100644
--- a/tests/lexer/driver.cxx
+++ b/tests/lexer/driver.cxx
@@ -71,9 +71,14 @@ main (int argc, char* argv[])
cout << punctuation[t.punctuation ()] << endl;
break;
}
- case token::t_path_lit:
+ case token::t_cxx_path_lit:
{
- cout << "path: " << t.literal () << endl;
+ cout << "c++ path: " << t.literal () << endl;
+ break;
+ }
+ case token::t_cli_path_lit:
+ {
+ cout << "cli path: " << t.literal () << endl;
break;
}
case token::t_string_lit:
diff --git a/tests/lexer/test-004.cli b/tests/lexer/test-004.cli
index bb6ccea..db95a81 100644
--- a/tests/lexer/test-004.cli
+++ b/tests/lexer/test-004.cli
@@ -1,2 +1,5 @@
include "foo/abc.hxx";
include <vector>;
+include "c++:map";
+include <cli:map>;
+include "map.cli"
diff --git a/tests/lexer/test-004.std b/tests/lexer/test-004.std
index e031891..4216cd1 100644
--- a/tests/lexer/test-004.std
+++ b/tests/lexer/test-004.std
@@ -1,7 +1,15 @@
keyword: include
-path: "foo/abc.hxx"
+c++ path: "foo/abc.hxx"
;
keyword: include
-path: <vector>
+c++ path: <vector>
;
+keyword: include
+c++ path: "map"
+;
+keyword: include
+cli path: <map>
+;
+keyword: include
+cli path: "map.cli"
<EOS>
diff --git a/tests/parser/base.cli b/tests/parser/base.cli
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/parser/base.cli
diff --git a/tests/parser/common.cli b/tests/parser/common.cli
new file mode 100644
index 0000000..c0c7262
--- /dev/null
+++ b/tests/parser/common.cli
@@ -0,0 +1 @@
+include "base.cli";
diff --git a/tests/parser/test-001.cli b/tests/parser/test-001.cli
index 80233ff..473a238 100644
--- a/tests/parser/test-001.cli
+++ b/tests/parser/test-001.cli
@@ -2,3 +2,5 @@
//
include <string>;
include "types.hxx";
+include "common.cli";
+include "../parser/base.cli";