@@ -30,6 +30,7 @@ pub enum ReservedChar {
3030 Tilde ,
3131 Dollar ,
3232 Circumflex ,
33+ Backslash ,
3334}
3435
3536impl fmt:: Display for ReservedChar {
@@ -61,6 +62,7 @@ impl fmt::Display for ReservedChar {
6162 ReservedChar :: Tilde => '~' ,
6263 ReservedChar :: Dollar => '$' ,
6364 ReservedChar :: Circumflex => '^' ,
65+ ReservedChar :: Backslash => '\\' ,
6466 }
6567 )
6668 }
@@ -94,6 +96,7 @@ impl TryFrom<char> for ReservedChar {
9496 '~' => Ok ( ReservedChar :: Tilde ) ,
9597 '$' => Ok ( ReservedChar :: Dollar ) ,
9698 '^' => Ok ( ReservedChar :: Circumflex ) ,
99+ '\\' => Ok ( ReservedChar :: Backslash ) ,
97100 _ => Err ( "Unknown reserved char" ) ,
98101 }
99102 }
@@ -465,7 +468,16 @@ pub(super) fn tokenize(source: &str) -> Result<Tokens<'_>, &'static str> {
465468 || v. last ( )
466469 . unwrap_or ( & Token :: Char ( ReservedChar :: Space ) )
467470 . is_a_media ( ) ;
471+
468472 match c {
473+ ReservedChar :: Backslash => {
474+ v. push ( Token :: Char ( ReservedChar :: Backslash ) ) ;
475+
476+ if iterator. next ( ) . is_some ( ) {
477+ pos += 1 ;
478+ v. push ( Token :: Other ( & source[ pos..pos + 1 ] ) ) ;
479+ }
480+ }
469481 ReservedChar :: Quote | ReservedChar :: DoubleQuote => {
470482 if let Some ( s) = get_string ( source, & mut iterator, & mut pos, c) {
471483 v. push ( s) ;
0 commit comments