Skip to content

Commit d84e62b

Browse files
committed
repository object
1 parent cf36e22 commit d84e62b

File tree

4 files changed

+21
-5
lines changed

4 files changed

+21
-5
lines changed

.github/workflows/build-on-windows.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ jobs:
9191
working-directory: ${{env.RELEASE_BUILD_DIR}}
9292
run: .\hktests-rel.exe --gtest_output=xml:hktests-rel.xml
9393

94-
- name: Publish Test Results
94+
- name: Publish Test Results to github
9595
uses: EnricoMi/publish-unit-test-result-action/windows@v2
9696
if: always() && github.event_name == 'push' && github.ref == 'refs/heads/main'
9797
with:
@@ -106,7 +106,7 @@ jobs:
106106
token: ${{secrets.CODECOV_TOKEN}}
107107
files: ${{env.DEBUG_BUILD_DIR}}\hktests-dbg.xml
108108

109-
- name: Generate CodeCoverage Report (Debug)
109+
- name: Generate CodeCoverage Report
110110
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
111111
run: |
112112
curl -L -O https://github.com/OpenCppCoverage/OpenCppCoverage/releases/download/release-0.9.9.0/OpenCppCoverageSetup-x64-0.9.9.0.exe
@@ -120,7 +120,7 @@ jobs:
120120
--working_dir=${{env.DEBUG_BUILD_DIR}} ^
121121
-- ${{env.DEBUG_BUILD_DIR}}\hktests-dbg
122122
123-
- name: Upload CodeCoverage Report to codecov.io (Debug)
123+
- name: Upload CodeCoverage Report to codecov
124124
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
125125
uses: codecov/codecov-action@v5
126126
with:

src/hkc/repository.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,12 @@ void repository::scan_prologues(bool force)
5959
}
6060

6161
auto cursor = file_cursor(module_path);
62-
m.ast = parse_module(cursor, true);
62+
auto it =
63+
64+
m.errors.clear();
65+
if (auto r = parse_module(cursor, m.errors, true)) {
66+
67+
}
6368
}
6469

6570
untouch(true);

src/hkc/repository.hpp

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

44
#include "ast/module_node.hpp"
5+
#include "error/error_list.hpp"
56
#include <filesystem>
67
#include <memory>
78
#include <chrono>
@@ -36,6 +37,8 @@ class repository {
3637
*/
3738
bool touched = false;
3839

40+
error_list errors;
41+
3942
module_type(std::filesystem::path path);
4043
};
4144

src/parser/parsers.hpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,16 @@ constexpr std::unexpected<error_code> tokens_did_not_match = std::unexpected{err
2525
[[nodiscard]] parse_result<fqname> parse_fqname(token_iterator& it, error_list& e);
2626
[[nodiscard]] parse_result_ptr<ast::node> parse(hk::file_cursor& c);
2727
[[nodiscard]] parse_result_ptr<ast::node> parse(token_iterator& it, error_list &errors);
28-
[[nodiscard]] parse_result_ptr<ast::module_node> parse_module(token_iterator& it, error_list &errors, bool only_prologue);
2928
[[nodiscard]] parse_result_ptr<ast::module_declaration_node> parse_module_declaration(token_iterator& it, error_list& e);
3029
[[nodiscard]] parse_result_ptr<ast::import_declaration_node> parse_import_declaration(token_iterator& it, error_list& e);
3130

31+
/** Parse a module.
32+
*
33+
* @param it A token iterator.
34+
* @param errors[out] error list output.
35+
* @param only_prologue When true only parses the prologue of a module.
36+
* @return A module node if successful.
37+
*/
38+
[[nodiscard]] parse_result_ptr<ast::module_node> parse_module(token_iterator& it, error_list &errors, bool only_prologue);
39+
3240
}

0 commit comments

Comments
 (0)