Skip to content

Commit bdeee36

Browse files
committed
fix: ocamlobjinfo parsing for multiple files
Do not stop parsing once we run into an unrecognized lined. Skip it and continue parsing. Signed-off-by: Rudi Grinberg <[email protected]>
1 parent b9be02f commit bdeee36

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/dune_rules/ocamlobjinfo.mll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,12 @@ and intfs acc_units acc = parse
3131
| ws hash ws (name as name) newline { intfs acc_units (add_intf acc name) lexbuf }
3232
| "Implementations imported:" newline { impls acc_units acc lexbuf }
3333
| "File " [^ '\n']+ newline { ocamlobjinfo (acc :: acc_units) empty lexbuf }
34+
| [^ '\n' ]* newline { intfs acc_units acc lexbuf }
3435
| _ | eof { acc :: acc_units }
3536
and impls acc_units acc = parse
3637
| ws hash ws (name as name) newline { impls acc_units (add_impl acc name) lexbuf }
3738
| "File " [^ '\n']+ newline { ocamlobjinfo (acc :: acc_units) empty lexbuf }
39+
| [^ '\n' ]* newline { impls acc_units acc lexbuf }
3840
| _ | eof { acc :: acc_units }
3941

4042
and archive acc = parse

test/expect-tests/ocamlobjinfo_tests.ml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,5 +248,9 @@ Required globals:
248248
Uses unsafe features: no
249249
Force link: no
250250
|fixture};
251-
[%expect {| [ { impl = set {}; intf = set { "m1"; "m2" } } ] |}]
251+
[%expect {|
252+
[ { impl = set {}; intf = set { "m1"; "m2" } }
253+
; { impl = set {}; intf = set { "m3"; "m4" } }
254+
]
255+
|}]
252256
;;

0 commit comments

Comments
 (0)