@@ -156,13 +156,13 @@ impl<'a> StringParser<'a> {
156156 'v' => '\x0b' ,
157157 o @ '0' ..='7' => self . parse_octet ( o) ,
158158 'x' => self . parse_unicode_literal ( 2 ) ?,
159- 'u' if !self . kind . is_bytes ( ) => self . parse_unicode_literal ( 4 ) ?,
160- 'U' if !self . kind . is_bytes ( ) => self . parse_unicode_literal ( 8 ) ?,
161- 'N' if !self . kind . is_bytes ( ) => self . parse_unicode_name ( ) ?,
159+ 'u' if !self . kind . is_any_bytes ( ) => self . parse_unicode_literal ( 4 ) ?,
160+ 'U' if !self . kind . is_any_bytes ( ) => self . parse_unicode_literal ( 8 ) ?,
161+ 'N' if !self . kind . is_any_bytes ( ) => self . parse_unicode_name ( ) ?,
162162 // Special cases where the escape sequence is not a single character
163163 '\n' => return Ok ( "" . to_string ( ) ) ,
164164 c => {
165- if self . kind . is_bytes ( ) && !c. is_ascii ( ) {
165+ if self . kind . is_any_bytes ( ) && !c. is_ascii ( ) {
166166 return Err ( LexicalError {
167167 error : LexicalErrorType :: OtherError (
168168 "bytes can only contain ASCII literal characters" . to_owned ( ) ,
@@ -578,9 +578,9 @@ impl<'a> StringParser<'a> {
578578 }
579579
580580 fn parse ( & mut self ) -> Result < Vec < Expr > , LexicalError > {
581- if self . kind . is_fstring ( ) {
581+ if self . kind . is_any_fstring ( ) {
582582 self . parse_fstring ( 0 )
583- } else if self . kind . is_bytes ( ) {
583+ } else if self . kind . is_any_bytes ( ) {
584584 self . parse_bytes ( ) . map ( |expr| vec ! [ expr] )
585585 } else {
586586 self . parse_string ( ) . map ( |expr| vec ! [ expr] )
@@ -611,10 +611,12 @@ pub(crate) fn parse_strings(
611611 let initial_start = values[ 0 ] . 0 ;
612612 let last_end = values. last ( ) . unwrap ( ) . 2 ;
613613 let initial_kind = ( values[ 0 ] . 1 . 1 == StringKind :: Unicode ) . then ( || "u" . to_owned ( ) ) ;
614- let has_fstring = values. iter ( ) . any ( |( _, ( _, kind, ..) , _) | kind. is_fstring ( ) ) ;
614+ let has_fstring = values
615+ . iter ( )
616+ . any ( |( _, ( _, kind, ..) , _) | kind. is_any_fstring ( ) ) ;
615617 let num_bytes = values
616618 . iter ( )
617- . filter ( |( _, ( _, kind, ..) , _) | kind. is_bytes ( ) )
619+ . filter ( |( _, ( _, kind, ..) , _) | kind. is_any_bytes ( ) )
618620 . count ( ) ;
619621 let has_bytes = num_bytes > 0 ;
620622
0 commit comments