aoc24: day02b complete

This commit is contained in:
2024-12-08 22:35:49 +01:00
parent 5c692fe727
commit a1d5d359f2
14 changed files with 342 additions and 148 deletions

View File

@@ -3,8 +3,10 @@
#include <string>
#include <ranges>
#include <numeric>
#include <vector>
#include "aoc/aoc.hpp"
#include "aoc.hpp"
#include "aoc/utils.hpp"
#include "fmt/format.h"
#include "ctre.hpp"
@@ -157,8 +159,8 @@ private:
if (peek() == '\n') {
peek_consume();
m_line = m_line + 1;
m_col = 1;
str += "\\n";
m_col = 1;
auto const& type = token_type::invalid;
return token(str, type, token_type_category(type), m_line, col);
}
@@ -387,7 +389,7 @@ private:
};
}
auto aoc::entry([[maybe_unused]]std::vector<std::string_view> const& args) -> void {
auto aoc24::day03([[maybe_unused]]std::span<char const*> const& args) -> std::expected<void, aoc::error> {
npr::lexer lexer{"./dat/24/re/03.txt"};
npr::parser parser{};
auto const tokens = lexer.tokenize();
@@ -438,5 +440,6 @@ auto aoc::entry([[maybe_unused]]std::vector<std::string_view> const& args) -> vo
auto const sumb = std::accumulate(std::begin(opb), std::end(opb), 0);
fmt::print("Part B: {}\n", sumb);
return {};
}