This maintains the expectation that tuple literals will always end
with a comma if there is a single item.
The example is the combined one from the Jinja docs but it does not
include the comma for the tuple assignment since the grammar does
not currently support that.
\r
LITERAL\r
=\r
- STRING_LITERAL | NUMBER_LITERAL | BOOLEAN_LITERAL | LIST_LITERAL\r
+ STRING_LITERAL | NUMBER_LITERAL | BOOLEAN_LITERAL | LIST_LITERAL | TUPLE_LITERAL\r
;\r
\r
LIST_LITERAL\r
| "[" {SP}* "]"\r
;\r
\r
+TUPLE_LITERAL\r
+ =\r
+ "(" {SP}* tuple+:LITERAL {SP}* { "," {SP}* tuple+:LITERAL {SP}* } ")"\r
+ | "(" {SP}* tuple+:LITERAL {SP}* "," {SP}* ")"\r
+ ;\r
+\r
INTEGER_LITERAL\r
=\r
/[\d_]*\d+/\r
{% if False %}\r
{{ '{{' }}\r
{% endif %}\r
-{% for item in ['1', 2, 3.14] %}{{ item }}{% endfor %}\r
+{% for href caption in [('index.html', 'Index'), ('about.html', 'About'),\r
+ ('downloads.html', 'Downloads')] %}\r
+ <li><a href="{{ href }}">{{ caption }}</a></li>\r
+{% endfor %}\r
{% trans user=user.username %}Hello, {{ user }}!{% endtrans %}
\ No newline at end of file