let put_line = printf "#line %d \"%s\"\n"
+ let isspace = function |' '|'\t' -> true | _ -> false
+
+ let strip s =
+ let l = ref 0 and r = ref (String.length s) in
+ while (isspace s.[!l] && !l < !r) do incr l done;
+ while (isspace s.[!r - 1] && !l < !r) do decr r done;
+ String.sub s !l (!r - !l)
+
(* @types related {{{ *)
type typedef =
| [t] -> (false, type_find lpos fpos t)
| _ -> assert false
in
- match s with
+ match strip s with
| "void" -> []
- | s -> List.map aux (Str.split (Str.regexp "[ \t]+,[ \t]+") s)
+ | s -> List.map aux (Str.split (Str.regexp "[ \t]*,[ \t]*") s)
let parse_args lpos fpos s =
let aux t =
| [t; n] -> ((false, type_find lpos fpos t), n)
| _ -> assert false
in
- match s with
+ match strip s with
| "void" -> []
- | s -> List.map aux (Str.split (Str.regexp "[ \t]+,[ \t]+") s)
+ | s -> List.map aux (Str.split (Str.regexp "[ \t]*,[ \t]*") s)
(* }}} *)
(* parsing helpers {{{ *)