File tree Expand file tree Collapse file tree 1 file changed +4
-13
lines changed Expand file tree Collapse file tree 1 file changed +4
-13
lines changed Original file line number Diff line number Diff line change @@ -466,12 +466,6 @@ fn byte(input: Cursor) -> Result<Cursor, LexError> {
466
466
467
467
fn character ( input : Cursor ) -> Result < Cursor , LexError > {
468
468
let input = input. expect ( "'" ) ?;
469
- let input = cooked_char ( input) ?;
470
- let input = input. expect ( "'" ) ?;
471
- Ok ( input)
472
- }
473
-
474
- fn cooked_char ( input : Cursor ) -> Result < Cursor , LexError > {
475
469
let mut chars = input. char_indices ( ) ;
476
470
let ok = match chars. next ( ) . map ( |( _, ch) | ch) {
477
471
Some ( '\\' ) => match chars. next ( ) . map ( |( _, ch) | ch) {
@@ -484,14 +478,11 @@ fn cooked_char(input: Cursor) -> Result<Cursor, LexError> {
484
478
} ,
485
479
ch => ch. is_some ( ) ,
486
480
} ;
487
- if ok {
488
- match chars. next ( ) {
489
- Some ( ( idx, _) ) => Ok ( input. advance ( idx) ) ,
490
- None => Ok ( input. advance ( input. len ( ) ) ) ,
491
- }
492
- } else {
493
- Err ( LexError )
481
+ if !ok {
482
+ return Err ( LexError ) ;
494
483
}
484
+ let ( idx, _) = chars. next ( ) . ok_or ( LexError ) ?;
485
+ input. advance ( idx) . expect ( "'" )
495
486
}
496
487
497
488
macro_rules! next_ch {
You can’t perform that action at this time.
0 commit comments