aboutsummaryrefslogtreecommitdiffstats
path: root/askama_derive/src/generator.rs
diff options
context:
space:
mode:
Diffstat (limited to 'askama_derive/src/generator.rs')
-rw-r--r--askama_derive/src/generator.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs
index 81f6ac9..9f60847 100644
--- a/askama_derive/src/generator.rs
+++ b/askama_derive/src/generator.rs
@@ -885,6 +885,7 @@ impl<'a> Generator<'a> {
Expr::BoolLit(s) => self.visit_bool_lit(buf, s),
Expr::NumLit(s) => self.visit_num_lit(buf, s),
Expr::StrLit(s) => self.visit_str_lit(buf, s),
+ Expr::CharLit(s) => self.visit_char_lit(buf, s),
Expr::Var(s) => self.visit_var(buf, s),
Expr::Path(ref path) => self.visit_path(buf, path),
Expr::Array(ref elements) => self.visit_array(buf, elements),
@@ -918,6 +919,7 @@ impl<'a> Generator<'a> {
expr_buf.write("&");
self.visit_str_lit(&mut expr_buf, s)
}
+ MatchVariant::CharLit(s) => self.visit_char_lit(&mut expr_buf, s),
MatchVariant::NumLit(s) => self.visit_num_lit(&mut expr_buf, s),
MatchVariant::Name(s) => {
expr_buf.write(s);
@@ -937,6 +939,7 @@ impl<'a> Generator<'a> {
let wrapped = match *param {
MatchParameter::NumLit(s) => self.visit_num_lit(&mut expr_buf, s),
MatchParameter::StrLit(s) => self.visit_str_lit(&mut expr_buf, s),
+ MatchParameter::CharLit(s) => self.visit_char_lit(&mut expr_buf, s),
MatchParameter::Name(s) => {
expr_buf.write(s);
DisplayWrap::Unwrapped
@@ -1155,6 +1158,11 @@ impl<'a> Generator<'a> {
DisplayWrap::Unwrapped
}
+ fn visit_char_lit(&mut self, buf: &mut Buffer, s: &str) -> DisplayWrap {
+ buf.write(&format!("'{}'", s));
+ DisplayWrap::Unwrapped
+ }
+
fn visit_num_lit(&mut self, buf: &mut Buffer, s: &str) -> DisplayWrap {
buf.write(s);
DisplayWrap::Unwrapped