about summary refs log tree commit diff
path: root/users/glittershark/achilles/src/parser/expr.rs
diff options
context:
space:
mode:
Diffstat (limited to 'users/glittershark/achilles/src/parser/expr.rs')
-rw-r--r--users/glittershark/achilles/src/parser/expr.rs13
1 files changed, 10 insertions, 3 deletions
diff --git a/users/glittershark/achilles/src/parser/expr.rs b/users/glittershark/achilles/src/parser/expr.rs
index 12c55df02b80..99c8018fd00c 100644
--- a/users/glittershark/achilles/src/parser/expr.rs
+++ b/users/glittershark/achilles/src/parser/expr.rs
@@ -165,9 +165,16 @@ named!(bool_(&str) -> Literal, alt!(
 ));
 
 fn string_internal(i: &str) -> nom::IResult<&str, Cow<'_, str>, nom::error::Error<&str>> {
-    let (s, rem) = i
-        .split_once('"')
-        .ok_or_else(|| nom::Err::Error(nom::error::Error::new(i, nom::error::ErrorKind::Tag)))?;
+    // TODO(grfn): use String::split_once when that's stable
+    let (s, rem) = if let Some(pos) = i.find('"') {
+        (&i[..pos], &i[(pos + 1)..])
+    } else {
+        return Err(nom::Err::Error(nom::error::Error::new(
+            i,
+            nom::error::ErrorKind::Tag,
+        )));
+    };
+
     Ok((rem, Cow::Borrowed(s)))
 }