diff --git a/src/File.cc b/src/File.cc index 0be87cf..1f4387d 100644 --- a/src/File.cc +++ b/src/File.cc @@ -209,7 +209,7 @@ void File::parse(const std::filesystem::path& filename) { throw Exception("invalid token"); } } catch (Exception& ex) { - std::cerr << tokenizer.file_name() << ":" << tokenizer.current_line_number() << ": " << ex.what() << std::endl; + std::cerr << tokenizer.file_name().string() << ":" << tokenizer.current_line_number() << ": " << ex.what() << std::endl; throw Exception(); } } diff --git a/src/Tokenizer.h b/src/Tokenizer.h index 6c9e396..ed3dd30 100644 --- a/src/Tokenizer.h +++ b/src/Tokenizer.h @@ -101,7 +101,7 @@ class Tokenizer { void skip_whitespace(); void unget(const Token& token); [[nodiscard]] int current_line_number() const {return line_number;} - [[nodiscard]] const std::string&file_name() const {return filename;} + [[nodiscard]] const std::filesystem::path& file_name() const {return filename;} private: static CharacterType type(int c); @@ -121,7 +121,7 @@ class Tokenizer { static std::unordered_map keywords; static std::unordered_map special_characters; - std::string filename; + std::filesystem::path filename; std::ifstream source; std::optional ungot; bool beggining_of_line = true;