diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2019-11-12 15:59:58 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2019-11-13 17:30:25 +0300 |
commit | 861555876837449fd8fc480845f642dab4a68b1e (patch) | |
tree | 737992e719b5b5bee5574d3cba18e21b2ecbd912 /libbuild2/cc/lexer.test.cxx | |
parent | 1dc4b29bb57b14bfd8f700be80224b6d865f0184 (diff) |
Use path_name in cc::lexer class
Diffstat (limited to 'libbuild2/cc/lexer.test.cxx')
-rw-r--r-- | libbuild2/cc/lexer.test.cxx | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/libbuild2/cc/lexer.test.cxx b/libbuild2/cc/lexer.test.cxx index 0aeadba..68bb152 100644 --- a/libbuild2/cc/lexer.test.cxx +++ b/libbuild2/cc/lexer.test.cxx @@ -23,7 +23,7 @@ namespace build2 main (int argc, char* argv[]) { bool loc (false); - const char* file (nullptr); + path file; for (int i (1); i != argc; ++i) { @@ -33,23 +33,28 @@ namespace build2 loc = true; else { - file = argv[i]; + file = path (argv[i]); break; } } try { + path_name in; ifdstream is; - if (file != nullptr) + + if (!file.empty ()) + { + in = path_name (file); is.open (file); + } else { - file = "stdin"; + in = path_name ("<stdin>"); is.open (fddup (stdin_fd ())); } - lexer l (is, path (file)); + lexer l (is, in); // No use printing eos since we will either get it or loop forever. // @@ -58,7 +63,7 @@ namespace build2 cout << t; if (loc) - cout << ' ' << t.file << ':' << t.line << ':' << t.column; + cout << ' ' << *t.file << ':' << t.line << ':' << t.column; cout << endl; } |