Skip to content

Commit adbba69

Browse files
committed
again
1 parent cc79f16 commit adbba69

File tree

6 files changed

+16
-66
lines changed

6 files changed

+16
-66
lines changed

src/prologue/prologue_scan.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
namespace hk {
66

77

8-
std::vector<std::unique_ptr<ast::module_node>> prologue_scan_repository(std::filesystem::path const& path)
8+
[[nodiscard]] std::vector<std::unique_ptr<ast::module_node>> prologue_scan_repository(std::filesystem::path const& path)
99
{
1010
auto r = std::vector<std::unique_ptr<ast::module_node>>{};
1111

@@ -39,7 +39,16 @@ std::vector<std::unique_ptr<ast::module_node>> prologue_scan_repository(std::fil
3939
continue;
4040
}
4141

42-
r.push_back(parse_module(entry.path(), ast::module_node::state_type::prologue));
42+
auto cursor = file_cursor(entry.path());
43+
if (auto node = parse_module(cursor, errors, true)) {
44+
45+
r.push_back(std::move(node()).value());
46+
} else if (node.is_error()) {
47+
48+
49+
} else {
50+
51+
}
4352
}
4453

4554
return r;

src/prologue/prologue_scan.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ struct repository {
7979
*
8080
* @param path The path to the repository to scan.
8181
*/
82-
std::vector<std::unique_ptr<ast::module_node>> prologue_scan_repository(std::filesystem::path const& path);
82+
[[nodiscard]] std::vector<std::unique_ptr<ast::module_node>> prologue_scan_repository(std::filesystem::path const& path);
8383

8484

8585
}

src/tokenizer/tokenizer.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ send_error(hk::file_cursor& c, tokenize_delegate& delegate, unsigned int advance
2525
delegate.on_token(std::move(r));
2626
}
2727

28-
static void simple_tokenize(hk::file_cursor& c, tokenize_delegate& delegate, tokenizer_context& context)
28+
static void simple_tokenize(hk::file_cursor& c, tokenize_delegate& delegate)
2929
{
3030
enum class state_type {
3131
normal,
@@ -273,10 +273,10 @@ struct tokenize_delegate_helper : tokenize_delegate {
273273
}
274274
};
275275

276-
void tokenize(hk::file_cursor& c, tokenize_delegate& delegate, tokenizer_context &context)
276+
void tokenize(hk::file_cursor& c, tokenize_delegate& delegate)
277277
{
278278
auto simple_delegate = tokenize_delegate_helper{delegate};
279-
return simple_tokenize(c, simple_delegate, context);
279+
return simple_tokenize(c, simple_delegate);
280280
}
281281

282282
} // namespace hk

src/tokenizer/tokenizer.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#pragma once
33

44
#include "token.hpp"
5-
#include "tokenizer_context.hpp"
65
#include "utility/file_cursor.hpp"
76
#include "utility/char_category.hpp"
87
#include "utility/module.hpp"
@@ -42,7 +41,7 @@ struct tokenize_delegate {
4241
* @param file_cursor The file cursor pointing to the text to tokenize.
4342
* @param delegate The delegate to call for each token produced.
4443
*/
45-
void tokenize(hk::file_cursor &file_cursor, tokenize_delegate &delegate, tokenizer_context &context);
44+
void tokenize(hk::file_cursor &file_cursor, tokenize_delegate &delegate);
4645

4746

4847
} // namespace hk

src/tokenizer/tokenizer_context.hpp

Lines changed: 0 additions & 52 deletions
This file was deleted.

src/utility/path.hpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,5 @@ namespace hk {
2828
[[nodiscard]] std::expected<std::filesystem::path, std::error_code> absolute_to(
2929
std::filesystem::path const& path, std::filesystem::path const& base);
3030

31-
/** A unique identifier for a filesystem path.
32-
*
33-
* This class is used to intern filesystem paths, allowing for efficient
34-
* comparison and storage of paths in a way that avoids duplication.
35-
*/
36-
using path_id = interned<std::filesystem::path>;
3731

3832
}

0 commit comments

Comments
 (0)