@@ -956,6 +956,22 @@ impl<'run, 'src> Parser<'run, 'src> {
956956 dependencies. append ( & mut subsequents) ;
957957 }
958958
959+ let if_error = dependencies. len ( ) ;
960+
961+ if self . accepted ( BarBar ) ? {
962+ let mut recoveries = Vec :: new ( ) ;
963+
964+ while let Some ( recovery) = self . accept_dependency ( ) ? {
965+ recoveries. push ( recovery) ;
966+ }
967+
968+ if recoveries. is_empty ( ) {
969+ return Err ( self . unexpected_token ( ) ?) ;
970+ }
971+
972+ dependencies. append ( & mut recoveries) ;
973+ }
974+
959975 self . expect_eol ( ) ?;
960976
961977 let body = self . parse_body ( ) ?;
@@ -1007,6 +1023,7 @@ impl<'run, 'src> Parser<'run, 'src> {
10071023 dependencies,
10081024 doc : doc. filter ( |doc| !doc. is_empty ( ) ) ,
10091025 file_depth : self . file_depth ,
1026+ if_error,
10101027 import_offsets : self . import_offsets . clone ( ) ,
10111028 name,
10121029 namepath : self
@@ -2533,7 +2550,7 @@ mod tests {
25332550 column: 9 ,
25342551 width: 1 ,
25352552 kind: UnexpectedToken {
2536- expected: vec![ AmpersandAmpersand , Comment , Eof , Eol , Identifier , ParenL ] ,
2553+ expected: vec![ AmpersandAmpersand , BarBar , Comment , Eof , Eol , Identifier , ParenL ] ,
25372554 found: Equals
25382555 } ,
25392556 }
0 commit comments