- let (skipped,aft,rest) = collect_up_to_plus [] rest in
- let (a,b,c,d,e,strbef,straft,pos) = get_clt aft in
- skipped@
- (process_pragmas ((update_clt aft (a,b,c,d,e,pragmas,straft,pos))::rest))
- | bef::xs ->
- (match plus_attachable bef with
- PLUS ->
- (match collect_up_to_pragmas [] xs with
- Some(skipped,pragmas,rest) ->
+ let (pass,rest0) = collect_pass rest in
+ let (next,rest) =
+ match rest0 with [] -> (None,[]) | next::rest -> (Some next,rest) in
+ (match (bef,plus_attach true bef,next,plus_attach true next) with
+ (Some bef,PLUS,_,_) ->
+ let (a,b,c,d,e,strbef,straft,pos) = get_clt bef in
+ (update_clt bef (a,b,c,d,e,strbef,pragmas,pos))::List.rev skips@
+ pass@process_pragmas None [] rest0
+ | (_,_,Some next,PLUS) ->
+ let (a,b,c,d,e,strbef,straft,pos) = get_clt next in
+ (add_bef bef) @ List.rev skips @ pass @
+ (process_pragmas
+ (Some (update_clt next (a,b,c,d,e,pragmas,straft,pos)))
+ [] rest)
+ | _ ->
+ (match (bef,plus_attach false bef,next,plus_attach false next) with
+ (Some bef,PLUS,_,_) ->