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> {
466466
467467fn character ( input : Cursor ) -> Result < Cursor , LexError > {
468468 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 > {
475469 let mut chars = input. char_indices ( ) ;
476470 let ok = match chars. next ( ) . map ( |( _, ch) | ch) {
477471 Some ( '\\' ) => match chars. next ( ) . map ( |( _, ch) | ch) {
@@ -484,14 +478,11 @@ fn cooked_char(input: Cursor) -> Result<Cursor, LexError> {
484478 } ,
485479 ch => ch. is_some ( ) ,
486480 } ;
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 ) ;
494483 }
484+ let ( idx, _) = chars. next ( ) . ok_or ( LexError ) ?;
485+ input. advance ( idx) . expect ( "'" )
495486}
496487
497488macro_rules! next_ch {
You can’t perform that action at this time.
0 commit comments