@@ -59,7 +59,7 @@ impl<'a> Cursor<'a> {
5959 self . rest . char_indices ( )
6060 }
6161
62- fn expect ( & self , tag : & str ) -> Result < Cursor < ' a > , LexError > {
62+ fn parse ( & self , tag : & str ) -> Result < Cursor < ' a > , LexError > {
6363 if self . starts_with ( tag) {
6464 Ok ( self . advance ( tag. len ( ) ) )
6565 } else {
@@ -232,7 +232,7 @@ fn group(input: Cursor) -> PResult<Group> {
232232 let input = input. advance ( 1 ) ;
233233 let ( input, ts) = token_stream ( input) ?;
234234 let input = skip_whitespace ( input) ;
235- let input = input. expect ( close) ?;
235+ let input = input. parse ( close) ?;
236236 Ok ( ( input, Group :: new ( delimiter, ts) ) )
237237}
238238
@@ -310,9 +310,9 @@ fn literal_suffix(input: Cursor) -> Cursor {
310310}
311311
312312fn string ( input : Cursor ) -> Result < Cursor , LexError > {
313- if let Ok ( input) = input. expect ( "\" " ) {
313+ if let Ok ( input) = input. parse ( "\" " ) {
314314 cooked_string ( input)
315- } else if let Ok ( input) = input. expect ( "r" ) {
315+ } else if let Ok ( input) = input. parse ( "r" ) {
316316 raw_string ( input)
317317 } else {
318318 Err ( LexError )
@@ -365,9 +365,9 @@ fn cooked_string(input: Cursor) -> Result<Cursor, LexError> {
365365}
366366
367367fn byte_string ( input : Cursor ) -> Result < Cursor , LexError > {
368- if let Ok ( input) = input. expect ( "b\" " ) {
368+ if let Ok ( input) = input. parse ( "b\" " ) {
369369 cooked_byte_string ( input)
370- } else if let Ok ( input) = input. expect ( "br" ) {
370+ } else if let Ok ( input) = input. parse ( "br" ) {
371371 raw_string ( input)
372372 } else {
373373 Err ( LexError )
@@ -444,7 +444,7 @@ fn raw_string(input: Cursor) -> Result<Cursor, LexError> {
444444}
445445
446446fn byte ( input : Cursor ) -> Result < Cursor , LexError > {
447- let input = input. expect ( "b'" ) ?;
447+ let input = input. parse ( "b'" ) ?;
448448 let mut bytes = input. bytes ( ) . enumerate ( ) ;
449449 let ok = match bytes. next ( ) . map ( |( _, b) | b) {
450450 Some ( b'\\' ) => match bytes. next ( ) . map ( |( _, b) | b) {
@@ -462,12 +462,12 @@ fn byte(input: Cursor) -> Result<Cursor, LexError> {
462462 if !input. chars ( ) . as_str ( ) . is_char_boundary ( offset) {
463463 return Err ( LexError ) ;
464464 }
465- let input = input. advance ( offset) . expect ( "'" ) ?;
465+ let input = input. advance ( offset) . parse ( "'" ) ?;
466466 Ok ( literal_suffix ( input) )
467467}
468468
469469fn character ( input : Cursor ) -> Result < Cursor , LexError > {
470- let input = input. expect ( "'" ) ?;
470+ let input = input. parse ( "'" ) ?;
471471 let mut chars = input. char_indices ( ) ;
472472 let ok = match chars. next ( ) . map ( |( _, ch) | ch) {
473473 Some ( '\\' ) => match chars. next ( ) . map ( |( _, ch) | ch) {
@@ -484,7 +484,7 @@ fn character(input: Cursor) -> Result<Cursor, LexError> {
484484 return Err ( LexError ) ;
485485 }
486486 let ( idx, _) = chars. next ( ) . ok_or ( LexError ) ?;
487- let input = input. advance ( idx) . expect ( "'" ) ?;
487+ let input = input. advance ( idx) . parse ( "'" ) ?;
488488 Ok ( literal_suffix ( input) )
489489}
490490
0 commit comments