Skip to content

Commit f7bcad3

Browse files
committed
Separate out suffix parser to share with other literals
1 parent da53cdd commit f7bcad3

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/parse.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -302,14 +302,18 @@ fn literal_nocapture(input: Cursor) -> Result<Cursor, LexError> {
302302
}
303303
}
304304

305+
fn literal_suffix(input: Cursor) -> Cursor {
306+
match symbol_not_raw(input) {
307+
Ok((input, _)) => input,
308+
Err(LexError) => input,
309+
}
310+
}
311+
305312
fn string(input: Cursor) -> Result<Cursor, LexError> {
306313
if let Ok(input) = input.expect("\"") {
307314
let input = cooked_string(input)?;
308315
let input = input.expect("\"")?;
309-
match symbol_not_raw(input) {
310-
Ok((input, _)) => Ok(input),
311-
Err(LexError) => Ok(input),
312-
}
316+
Ok(literal_suffix(input))
313317
} else if let Ok(input) = input.expect("r") {
314318
raw_string(input)
315319
} else {

0 commit comments

Comments
 (0)