Add suport for line comments
This also switches comments to produce the same AST whether it is an inline comment or a line comment.
This commit is contained in:
parent
5799223303
commit
bcf99099b6
@ -17,6 +17,7 @@ expression
|
||||
| line_block_expression
|
||||
| variable_expression
|
||||
| comment_expression
|
||||
| line_comment_expression
|
||||
;
|
||||
|
||||
raw_block_expression
|
||||
@ -229,7 +230,7 @@ filter_parameters
|
||||
|
||||
comment_expression
|
||||
=
|
||||
comment_open comment_content comment_close
|
||||
comment_open comment:comment_content comment_close
|
||||
;
|
||||
|
||||
comment_open
|
||||
@ -247,6 +248,21 @@ comment_content
|
||||
{ !comment_close CHAR }*
|
||||
;
|
||||
|
||||
line_comment_expression
|
||||
=
|
||||
line_comment_open comment:line_comment_content &"\n"
|
||||
;
|
||||
|
||||
line_comment_open
|
||||
=
|
||||
"## "
|
||||
;
|
||||
|
||||
line_comment_content
|
||||
=
|
||||
{ !"\n" CHAR } *
|
||||
;
|
||||
|
||||
content
|
||||
=
|
||||
!(
|
||||
@ -254,6 +270,7 @@ content
|
||||
| block_open
|
||||
| variable_open
|
||||
| comment_open
|
||||
| line_comment_open
|
||||
) CHAR ;
|
||||
|
||||
LITERAL
|
||||
|
||||
@ -35,9 +35,10 @@ across lines #}
|
||||
<textarea name="{{ name }}" rows="{{ rows }}" cols="{{ cols
|
||||
}}">{{ value|e }}</textarea>
|
||||
{% endmacro %}
|
||||
{# comment contents
|
||||
across lines #}
|
||||
<ul>
|
||||
# for href, caption in [('index.html', 'Index'),
|
||||
('about.html', 'About')]:
|
||||
<li><a href="{{ href }}">{{ caption }}</a></li>
|
||||
# for item in seq:
|
||||
<li>{{ item }}</li> ## this comment is ignored
|
||||
# endfor
|
||||
</ul>
|
||||
Loading…
Reference in New Issue
Block a user