Fix parsing of hex encoded escaped bytes

This commit is contained in:
Niels Mündler 2023-12-08 17:39:56 +01:00 committed by Lucas
parent 3ac35f4e00
commit 772e73ae48
2 changed files with 2 additions and 1 deletions

View File

@ -232,6 +232,7 @@ peg::parser! {
/ "\\\"" { '\"' } // double quote
/ "\\'" { '\'' } // single quote
/ "\\\\" { '\\' } // backslash
/ "\\x" i:character() i2:character() { hex::decode([i, i2].iter().collect::<String>()).unwrap()[0].into() }
/ [ ^ '"' ]
/ expected!("or any valid ascii character")

View File

@ -281,7 +281,7 @@ impl Constant {
.collect(),
)
.unwrap(),
)),
)) .append(RcDoc::text("\"")),
Constant::Unit => RcDoc::text("()"),
Constant::Bool(b) => RcDoc::text(if *b { "True" } else { "False" }),
Constant::ProtoList(_, items) => RcDoc::text("[")