@@ -311,9 +311,7 @@ fn literal_suffix(input: Cursor) -> Cursor {
311
311
312
312
fn string ( input : Cursor ) -> Result < Cursor , LexError > {
313
313
if let Ok ( input) = input. expect ( "\" " ) {
314
- let input = cooked_string ( input) ?;
315
- let input = input. expect ( "\" " ) ?;
316
- Ok ( literal_suffix ( input) )
314
+ cooked_string ( input)
317
315
} else if let Ok ( input) = input. expect ( "r" ) {
318
316
raw_string ( input)
319
317
} else {
@@ -326,7 +324,8 @@ fn cooked_string(input: Cursor) -> Result<Cursor, LexError> {
326
324
while let Some ( ( byte_offset, ch) ) = chars. next ( ) {
327
325
match ch {
328
326
'"' => {
329
- return Ok ( input. advance ( byte_offset) ) ;
327
+ let input = input. advance ( byte_offset + 1 ) ;
328
+ return Ok ( literal_suffix ( input) ) ;
330
329
}
331
330
'\r' => {
332
331
if let Some ( ( _, '\n' ) ) = chars. next ( ) {
@@ -367,12 +366,9 @@ fn cooked_string(input: Cursor) -> Result<Cursor, LexError> {
367
366
368
367
fn byte_string ( input : Cursor ) -> Result < Cursor , LexError > {
369
368
if let Ok ( input) = input. expect ( "b\" " ) {
370
- let input = cooked_byte_string ( input) ?;
371
- let input = input. expect ( "\" " ) ?;
372
- Ok ( input)
369
+ cooked_byte_string ( input)
373
370
} else if let Ok ( input) = input. expect ( "br" ) {
374
- let input = raw_string ( input) ?;
375
- Ok ( input)
371
+ raw_string ( input)
376
372
} else {
377
373
Err ( LexError )
378
374
}
@@ -383,7 +379,7 @@ fn cooked_byte_string(mut input: Cursor) -> Result<Cursor, LexError> {
383
379
' outer: while let Some ( ( offset, b) ) = bytes. next ( ) {
384
380
match b {
385
381
b'"' => {
386
- return Ok ( input. advance ( offset) ) ;
382
+ return Ok ( input. advance ( offset + 1 ) ) ;
387
383
}
388
384
b'\r' => {
389
385
if let Some ( ( _, b'\n' ) ) = bytes. next ( ) {
0 commit comments