@@ -956,6 +956,22 @@ impl<'run, 'src> Parser<'run, 'src> {
956
956
dependencies. append ( & mut subsequents) ;
957
957
}
958
958
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
+
959
975
self . expect_eol ( ) ?;
960
976
961
977
let body = self . parse_body ( ) ?;
@@ -1007,6 +1023,7 @@ impl<'run, 'src> Parser<'run, 'src> {
1007
1023
dependencies,
1008
1024
doc : doc. filter ( |doc| !doc. is_empty ( ) ) ,
1009
1025
file_depth : self . file_depth ,
1026
+ if_error,
1010
1027
import_offsets : self . import_offsets . clone ( ) ,
1011
1028
name,
1012
1029
namepath : self
@@ -2533,7 +2550,7 @@ mod tests {
2533
2550
column: 9 ,
2534
2551
width: 1 ,
2535
2552
kind: UnexpectedToken {
2536
- expected: vec![ AmpersandAmpersand , Comment , Eof , Eol , Identifier , ParenL ] ,
2553
+ expected: vec![ AmpersandAmpersand , BarBar , Comment , Eof , Eol , Identifier , ParenL ] ,
2537
2554
found: Equals
2538
2555
} ,
2539
2556
}
0 commit comments