File tree Expand file tree Collapse file tree 1 file changed +7
-19
lines changed Expand file tree Collapse file tree 1 file changed +7
-19
lines changed Original file line number Diff line number Diff line change @@ -444,12 +444,6 @@ fn raw_string(input: Cursor) -> Result<Cursor, LexError> {
444
444
445
445
fn byte ( input : Cursor ) -> Result < Cursor , LexError > {
446
446
let input = input. expect ( "b'" ) ?;
447
- let input = cooked_byte ( input) ?;
448
- let input = input. expect ( "'" ) ?;
449
- Ok ( input)
450
- }
451
-
452
- fn cooked_byte ( input : Cursor ) -> Result < Cursor , LexError > {
453
447
let mut bytes = input. bytes ( ) . enumerate ( ) ;
454
448
let ok = match bytes. next ( ) . map ( |( _, b) | b) {
455
449
Some ( b'\\' ) => match bytes. next ( ) . map ( |( _, b) | b) {
@@ -460,20 +454,14 @@ fn cooked_byte(input: Cursor) -> Result<Cursor, LexError> {
460
454
} ,
461
455
b => b. is_some ( ) ,
462
456
} ;
463
- if ok {
464
- match bytes. next ( ) {
465
- Some ( ( offset, _) ) => {
466
- if input. chars ( ) . as_str ( ) . is_char_boundary ( offset) {
467
- Ok ( input. advance ( offset) )
468
- } else {
469
- Err ( LexError )
470
- }
471
- }
472
- None => Ok ( input. advance ( input. len ( ) ) ) ,
473
- }
474
- } else {
475
- Err ( LexError )
457
+ if !ok {
458
+ return Err ( LexError ) ;
459
+ }
460
+ let ( offset, _) = bytes. next ( ) . ok_or ( LexError ) ?;
461
+ if !input. chars ( ) . as_str ( ) . is_char_boundary ( offset) {
462
+ return Err ( LexError ) ;
476
463
}
464
+ input. advance ( offset) . expect ( "'" )
477
465
}
478
466
479
467
fn character ( input : Cursor ) -> Result < Cursor , LexError > {
You can’t perform that action at this time.
0 commit comments