mirror of
https://github.com/TxtDot/dalet-rs.git
synced 2024-11-22 00:36:21 +03:00
fix: escaping in argument and multiline text
This commit is contained in:
parent
e4eca62e38
commit
6099dbd236
2 changed files with 5 additions and 5 deletions
|
@ -86,7 +86,7 @@ fn symbol<'src>() -> impl Parser<'src, &'src str, Token<'src>, extra::Err<Rich<'
|
||||||
fn argument<'src>() -> impl Parser<'src, &'src str, Token<'src>, extra::Err<Rich<'src, char, Span>>>
|
fn argument<'src>() -> impl Parser<'src, &'src str, Token<'src>, extra::Err<Rich<'src, char, Span>>>
|
||||||
{
|
{
|
||||||
let arg_escape = just('\\')
|
let arg_escape = just('\\')
|
||||||
.ignore_then(just('"'))
|
.ignore_then(choice((just('"'), just('\\'))))
|
||||||
.labelled("Escape sequence for argument");
|
.labelled("Escape sequence for argument");
|
||||||
|
|
||||||
let number = text::int(10)
|
let number = text::int(10)
|
||||||
|
@ -109,7 +109,7 @@ fn argument<'src>() -> impl Parser<'src, &'src str, Token<'src>, extra::Err<Rich
|
||||||
fn textual<'src>() -> impl Parser<'src, &'src str, Token<'src>, extra::Err<Rich<'src, char, Span>>>
|
fn textual<'src>() -> impl Parser<'src, &'src str, Token<'src>, extra::Err<Rich<'src, char, Span>>>
|
||||||
{
|
{
|
||||||
let escape = just('\\')
|
let escape = just('\\')
|
||||||
.ignore_then(just('}'))
|
.ignore_then(choice((just('}'), just('\\'))))
|
||||||
.labelled("Multi-line escape sequence");
|
.labelled("Multi-line escape sequence");
|
||||||
|
|
||||||
let text = none_of("\n")
|
let text = none_of("\n")
|
||||||
|
|
|
@ -31,9 +31,9 @@ pub fn tag<'tokens, 'src: 'tokens>(
|
||||||
|
|
||||||
let text_body = select! {
|
let text_body = select! {
|
||||||
Token::TextBody(t) => t.to_owned(),
|
Token::TextBody(t) => t.to_owned(),
|
||||||
Token::MLText(t) => trim_indent(t).to_owned(),
|
Token::MLText(t) => trim_indent(t).replace("\\}", "}").replace("\\\\", "\\"),
|
||||||
Token::MLMSText(n, t) => set_spaces(t, n).to_owned(),
|
Token::MLMSText(n, t) => set_spaces(t, n).replace("\\}", "}").replace("\\\\", "\\"),
|
||||||
Token::MLRText(t) => t.to_owned()
|
Token::MLRText(t) => t.replace("\\}", "}").replace("\\\\", "\\")
|
||||||
}
|
}
|
||||||
.labelled("Text body");
|
.labelled("Text body");
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue