mirror of
https://github.com/pantor/inja.git
synced 2026-11-21 07:02:40 +00:00
allow variables starting with $ and @
This commit is contained in:
1 parent
316567898e
commit
a3b0b41d48
4 files changed
+14
No files matched your search
@@ -2049,6 +2049,8 @@ class Lexer {
|
||||
minus_state = MinusState::Operator;
|
||||
return scan_number();
|
||||
case '_':
|
||||
case '@':
|
||||
case '$':
|
||||
minus_state = MinusState::Operator;
|
||||
return scan_id();
|
||||
default:
|
||||
@@ -3435,6 +3437,10 @@ class Renderer : public NodeVisitor {
|
||||
|
||||
template<bool throw_not_found=true>
|
||||
Arguments get_argument_vector(size_t N, const AstNode& node) {
|
||||
if (json_eval_stack.size() < N) {
|
||||
throw_renderer_error("function needs " + std::to_string(N) + " variables, but has only found " + std::to_string(json_eval_stack.size()), node);
|
||||
}
|
||||
|
||||
Arguments result {N};
|
||||
for (size_t i = 0; i < N; i += 1) {
|
||||
result[N - i - 1] = json_eval_stack.top();
|
||||
|
||||
Reference in new issue
Block a user