From bea927e9b685b3365e9b1eb6096c027161fd85af Mon Sep 17 00:00:00 2001 From: Kevin Date: Wed, 22 May 2024 13:19:25 -0400 Subject: [PATCH] Supprt simple inline set statements --- grammar/jinja.ohm | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/grammar/jinja.ohm b/grammar/jinja.ohm index a0ff4ba4..dc209cfb 100644 --- a/grammar/jinja.ohm +++ b/grammar/jinja.ohm @@ -39,6 +39,7 @@ Jinja { | statement_from | statement_import | statement_include + | statement_setInline statement_block = statementId_block sp identifier (sp contextModifier_scoped)? (sp contextModifier_required)? @@ -78,6 +79,15 @@ Jinja { | listLiteral | variableName + statement_setInline + = statementId_set sp variableName sp? equals sp? statementSet_value + + statementSet_value + = stringLiteral + | variableName + | listLiteral + | explicitTupleLiteral + statement_setBlock = statementId_set sp variableName (sp verticalBar sp filterExpression)* @@ -134,12 +144,19 @@ Jinja { listLiteral_values = sp? (listLiteral_value sp? comma sp?)* listLiteral_value sp? listLiteral_value = stringLiteral + | explicitTupleLiteral | variableName stringLiteral = stringLiteral_single | stringLiteral_double stringLiteral_single = quote_single (~quote_single any)* quote_single stringLiteral_double = quote_double (~quote_double any)* quote_double + + explicitTupleLiteral = parenthesis_left sp? tupleLiteral_values sp? parenthesis_right + + tupleLiteral_values = (sp? tupleLiteral_value sp? comma sp?)* tupleLiteral_value + tupleLiteral_value + = stringLiteral quote_single = "'" quote_double = "\"" -- 2.47.2