Skip to content

Commit 41e6df3

Browse files
committed
sync: minja
1 parent cd5e3b5 commit 41e6df3

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

vendor/minja/minja.hpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2205,7 +2205,7 @@ class Parser {
22052205

22062206
auto value = parseValue();
22072207

2208-
while (it != end && consumeSpaces() && peekSymbols({ "[", "." })) {
2208+
while (it != end && consumeSpaces() && peekSymbols({ "[", ".", "(" })) {
22092209
if (!consumeToken("[").empty()) {
22102210
std::shared_ptr<Expression> index;
22112211
auto slice_loc = get_location();
@@ -2250,15 +2250,13 @@ class Parser {
22502250
auto key = std::make_shared<LiteralExpr>(identifier->location, Value(identifier->get_name()));
22512251
value = std::make_shared<SubscriptExpr>(identifier->location, std::move(value), std::move(key));
22522252
}
2253+
} else if (peekSymbols({ "(" })) {
2254+
auto callParams = parseCallArgs();
2255+
value = std::make_shared<CallExpr>(get_location(), std::move(value), std::move(callParams));
22532256
}
22542257
consumeSpaces();
22552258
}
22562259

2257-
if (peekSymbols({ "(" })) {
2258-
auto location = get_location();
2259-
auto callParams = parseCallArgs();
2260-
value = std::make_shared<CallExpr>(location, std::move(value), std::move(callParams));
2261-
}
22622260
return value;
22632261
}
22642262

@@ -2738,7 +2736,7 @@ inline std::shared_ptr<Context> Context::builtins() {
27382736
globals.set("raise_exception", simple_function("raise_exception", { "message" }, [](const std::shared_ptr<Context> &, Value & args) -> Value {
27392737
throw std::runtime_error(args.at("message").get<std::string>());
27402738
}));
2741-
globals.set("tojson", simple_function("tojson", { "value", "indent" }, [](const std::shared_ptr<Context> &, Value & args) {
2739+
globals.set("tojson", simple_function("tojson", { "value", "indent", "ensure_ascii" }, [](const std::shared_ptr<Context> &, Value & args) {
27422740
return Value(args.at("value").dump(args.get<int64_t>("indent", -1), /* to_json= */ true));
27432741
}));
27442742
globals.set("items", simple_function("items", { "object" }, [](const std::shared_ptr<Context> &, Value & args) {

0 commit comments

Comments
 (0)