Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/dune_rules/cram/cram_lexer.mll
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,13 @@ and command_cont loc acc = parse
| " > " ([^'\n']* as str)
{ let loc = Loc.set_stop loc (Lexing.lexeme_end_p lexbuf) in
eol_then_continue_or_finish loc str acc lexbuf }
| " >"
| " >" '\n'
{ let loc = Loc.set_stop loc (pos_before_newline lexbuf) in
Lexing.new_line lexbuf;
command_cont loc ("" :: acc) lexbuf }
| " >" eof
{ let loc = Loc.set_stop loc (Lexing.lexeme_end_p lexbuf) in
eol_then_continue_or_finish loc "" acc lexbuf }
(loc, Command (List.rev ("" :: acc))) }
| ""
{ (loc, Command (List.rev acc)) }

Expand Down
13 changes: 0 additions & 13 deletions test/blackbox-tests/test-cases/cram/conflict-marker-lexer-error.t

This file was deleted.

18 changes: 18 additions & 0 deletions test/expect-tests/dune_rules/cram_parsing_tests.ml
Original file line number Diff line number Diff line change
Expand Up @@ -473,3 +473,21 @@ let%expect_test "single-space comment after output" =
}
|}]
;;

(* Test for https://github.com/ocaml/dune/pull/12963: >> in output confused the
lexer *)
let%expect_test "output resembling conflict marker" =
test " $ echo '>> Hello'\n >> Hello";
[%expect
{|
File "test.t", line 1, characters 2-19:
1 | $ echo '>> Hello'
^^^^^^^^^^^^^^^^^

Command [ "echo '>> Hello'" ]
{ pos_fname = "test.t"
; start = { pos_lnum = 1; pos_bol = 0; pos_cnum = 2 }
; stop = { pos_lnum = 1; pos_bol = 0; pos_cnum = 19 }
}
|}]
;;
Loading