* [TCommentSpace "\n"; TDefEOL] but if TDefEOL is a fakeinfo then we will
* not synchronize on it and so we will not print the "\n".
* A solution would be to put the TDefEOL before the "\n".
+ * (jll: tried to do this, see the comment "Put end of line..." below)
*
* todo?: could put a ExpandedTok for that ?
*)
let line = Ast_c.line_of_info ii in
let acc = (TDefine ii) :: acc in
define_line_2 acc line ii xs
+ | TUndef ii::xs ->
+ let line = Ast_c.line_of_info ii in
+ let acc = (TUndef ii) :: acc in
+ define_line_2 acc line ii xs
| TCppEscapedNewline ii::xs ->
pr2 ("SUSPICIOUS: a \\ character appears outside of a #define at");
pr2 (Ast_c.strloc_of_info ii);
| x ->
if line' =|= line
then define_line_2 (x::acc) line info xs
- else define_line_1 (mark_end_define lastinfo::acc) (x::xs)
+ else
+ (* Put end of line token before the newline. A newline at least
+ must be there because the line changed and because we saw a
+ #define previously to get to this function at all *)
+ define_line_1
+ ((List.hd acc)::(mark_end_define lastinfo::(List.tl acc)))
+ (x::xs)
)
let rec define_ident acc xs =
match xs with
| [] -> List.rev acc
+ | TUndef ii::xs ->
+ let acc = TUndef ii :: acc in
+ (match xs with
+ TCommentSpace i1::TIdent (s,i2)::xs ->
+ let acc = (TCommentSpace i1) :: acc in
+ let acc = (TIdentDefine (s,i2)) :: acc in
+ define_ident acc xs
+ | _ ->
+ pr2 "WEIRD: weird #define body";
+ define_ident acc xs
+ )
| TDefine ii::xs ->
let acc = TDefine ii :: acc in
(match xs with
end
else x
- | (TUndef (id, ii) as x)::_, _
+ | (TUndef (ii) as x)::_, _
->
if (pass >= 2)
then begin
*)
->
-
if s ==~ regexp_foreach &&
is_really_foreach (Common.take_safe forLOOKAHEAD rest)