template broken

v1
Brett 2024-05-10 01:53:50 -04:00
parent da82a40699
commit 4ef3fe7573
4 changed files with 10 additions and 3 deletions

View File

@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.20) cmake_minimum_required(VERSION 3.20)
include(cmake/color.cmake) include(cmake/color.cmake)
set(BLT_VERSION 0.16.25) set(BLT_VERSION 0.16.26)
set(BLT_TEST_VERSION 0.0.1) set(BLT_TEST_VERSION 0.0.1)
set(BLT_TARGET BLT) set(BLT_TARGET BLT)

View File

@ -27,6 +27,7 @@
#include <blt/std/hashmap.h> #include <blt/std/hashmap.h>
#include <blt/std/types.h> #include <blt/std/types.h>
#include <blt/std/expected.h> #include <blt/std/expected.h>
#include <blt/std/logging.h>
#include <variant> #include <variant>
namespace blt namespace blt
@ -320,13 +321,17 @@ namespace blt
auto next = consumer.consume(); auto next = consumer.consume();
if (next.type == template_token_t::STRING) if (next.type == template_token_t::STRING)
{ {
BLT_TRACE(next.token);
while (consumer.hasNext())
BLT_TRACE(consumer.consume().token);
if (!substitutions.contains(next.token)) if (!substitutions.contains(next.token))
return blt::unexpected(template_parser_failure_t::SUBSTITUTION_NOT_FOUND); return blt::unexpected(template_parser_failure_t::SUBSTITUTION_NOT_FOUND);
if (consumer.next().type == template_token_t::SEMI) if (consumer.next().type == template_token_t::SEMI || consumer.next().type == template_token_t::ELSE)
{ {
consumer.advance(); consumer.advance();
return substitutions[next.token]; return substitutions[next.token];
} }
if (consumer.next().type != template_token_t::ADD) if (consumer.next().type != template_token_t::ADD)
return blt::unexpected(template_parser_failure_t::STRING_EXPECTED_CONCAT); return blt::unexpected(template_parser_failure_t::STRING_EXPECTED_CONCAT);
consumer.advance(); consumer.advance();

@ -1 +1 @@
Subproject commit 10368163ab1f4367d2f0685b5928b1c973ebd1ec Subproject commit 7ef2e733416953b222851f9a360d7fc72d068ee5

View File

@ -232,6 +232,8 @@ namespace blt
} }
} }
BLT_TRACE(return_str);
return return_str; return return_str;
} }
} }