Skip to content

Commit

Permalink
Expressions: Since peg 0.8.0 [...] returns matched character
Browse files Browse the repository at this point in the history
  • Loading branch information
Mingun committed Sep 6, 2024
1 parent 797786b commit eb30135
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/parser/expressions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -473,12 +473,12 @@ peg::parser! {
rule EOS() = ![_];

rule string() -> String
= "'" s:$([x if x != '\'']*) "'" { s.to_owned() }
= "'" s:$([^ '\'']*) "'" { s.to_owned() }
/ "\"" v:(ch() / escaped())* "\"" { String::from_iter(v.into_iter()) }
;

/// Single non-escaped character in string
rule ch() -> char = ch:$[^ '"' | '\\'] { ch.chars().next().unwrap() };
rule ch() -> char = [^ '"' | '\\'];
/// One escaped character
rule escaped() -> char = "\\" r:(quoted_char() / quoted_oct() / quoted_hex()) { r };
/// Characters that can be escaped by backslash
Expand Down

0 comments on commit eb30135

Please sign in to comment.