Initial scaffold for developing a quoted string parser
This commit is contained in:
parent
41abcb9b4a
commit
b3120d2e52
@ -1,5 +1,7 @@
|
||||
use nom::branch::alt;
|
||||
use nom::bytes::complete::escaped;
|
||||
use nom::bytes::complete::is_a;
|
||||
use nom::bytes::complete::is_not;
|
||||
use nom::bytes::complete::tag;
|
||||
use nom::bytes::complete::take_until;
|
||||
use nom::character::complete::one_of;
|
||||
@ -326,6 +328,10 @@ pub fn template(i: &str) -> IResult<&str, Template> {
|
||||
Ok((remaining, Template { contents: contents }))
|
||||
}
|
||||
|
||||
fn temp_string(i: &str) -> IResult<&str, &str> {
|
||||
escaped(is_not("\""), '\\', one_of(r#""\"#))(i)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
@ -601,4 +607,9 @@ mod tests {
|
||||
))
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_temp_string() {
|
||||
assert_eq!(temp_string(""), Ok(("", "")));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user