Skip to content

Commit

Permalink
Merge branch 'master' of github.com:pantor/inja
Browse files Browse the repository at this point in the history
  • Loading branch information
pantor committed Jul 10, 2022
2 parents 9f923b3 + 17a59c0 commit edc1779
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions include/inja/parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ class Parser {
}
}

std::string parse_filename(const Token& tok) const {
std::string parse_filename() const {
if (tok.kind != Token::Kind::String) {
throw_parser_error("expected string, got '" + tok.describe() + "'");
}
Expand Down Expand Up @@ -516,7 +516,7 @@ class Parser {
} else if (tok.text == static_cast<decltype(tok.text)>("include")) {
get_next_token();

std::string template_name = parse_filename(tok);
std::string template_name = parse_filename();
add_to_template_storage(path, template_name);

current_block->nodes.emplace_back(std::make_shared<IncludeStatementNode>(template_name, tok.text.data() - tmpl.content.c_str()));
Expand All @@ -525,7 +525,7 @@ class Parser {
} else if (tok.text == static_cast<decltype(tok.text)>("extends")) {
get_next_token();

std::string template_name = parse_filename(tok);
std::string template_name = parse_filename();
add_to_template_storage(path, template_name);

current_block->nodes.emplace_back(std::make_shared<ExtendsStatementNode>(template_name, tok.text.data() - tmpl.content.c_str()));
Expand Down
4 changes: 2 additions & 2 deletions include/inja/renderer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ class Renderer : public NodeVisitor {
} break;
case Op::Lower: {
auto result = get_arguments<1>(node)[0]->get<json::string_t>();
std::transform(result.begin(), result.end(), result.begin(), ::tolower);
std::transform(result.begin(), result.end(), result.begin(), [](char c) { return static_cast<char>(::tolower(c)); });
make_result(std::move(result));
} break;
case Op::Max: {
Expand Down Expand Up @@ -391,7 +391,7 @@ class Renderer : public NodeVisitor {
} break;
case Op::Upper: {
auto result = get_arguments<1>(node)[0]->get<json::string_t>();
std::transform(result.begin(), result.end(), result.begin(), ::toupper);
std::transform(result.begin(), result.end(), result.begin(), [](char c) { return static_cast<char>(::toupper(c)); });
make_result(std::move(result));
} break;
case Op::IsBoolean: {
Expand Down
10 changes: 5 additions & 5 deletions single_include/inja/inja.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1540,7 +1540,7 @@ class Parser {
}
}

std::string parse_filename(const Token& tok) const {
std::string parse_filename() const {
if (tok.kind != Token::Kind::String) {
throw_parser_error("expected string, got '" + tok.describe() + "'");
}
Expand Down Expand Up @@ -1930,7 +1930,7 @@ class Parser {
} else if (tok.text == static_cast<decltype(tok.text)>("include")) {
get_next_token();

std::string template_name = parse_filename(tok);
std::string template_name = parse_filename();
add_to_template_storage(path, template_name);

current_block->nodes.emplace_back(std::make_shared<IncludeStatementNode>(template_name, tok.text.data() - tmpl.content.c_str()));
Expand All @@ -1939,7 +1939,7 @@ class Parser {
} else if (tok.text == static_cast<decltype(tok.text)>("extends")) {
get_next_token();

std::string template_name = parse_filename(tok);
std::string template_name = parse_filename();
add_to_template_storage(path, template_name);

current_block->nodes.emplace_back(std::make_shared<ExtendsStatementNode>(template_name, tok.text.data() - tmpl.content.c_str()));
Expand Down Expand Up @@ -2432,7 +2432,7 @@ class Renderer : public NodeVisitor {
} break;
case Op::Lower: {
auto result = get_arguments<1>(node)[0]->get<json::string_t>();
std::transform(result.begin(), result.end(), result.begin(), ::tolower);
std::transform(result.begin(), result.end(), result.begin(), [](char c) { return static_cast<char>(::tolower(c)); });
make_result(std::move(result));
} break;
case Op::Max: {
Expand Down Expand Up @@ -2471,7 +2471,7 @@ class Renderer : public NodeVisitor {
} break;
case Op::Upper: {
auto result = get_arguments<1>(node)[0]->get<json::string_t>();
std::transform(result.begin(), result.end(), result.begin(), ::toupper);
std::transform(result.begin(), result.end(), result.begin(), [](char c) { return static_cast<char>(::toupper(c)); });
make_result(std::move(result));
} break;
case Op::IsBoolean: {
Expand Down

0 comments on commit edc1779

Please sign in to comment.