diff --git a/src/dune_lexer.mli b/src/dune_lexer.mli index 7b3c5eaf..2067c6c7 100644 --- a/src/dune_lexer.mli +++ b/src/dune_lexer.mli @@ -12,3 +12,5 @@ val first_line : Lexing.lexbuf -> first_line (** Parse the first line of a versioned file but do not fail if it doesn't start with [(lang ...)]. *) val maybe_first_line : Lexing.lexbuf -> first_line option + +val eof_reached : Lexing.lexbuf -> bool diff --git a/src/dune_lexer.mll b/src/dune_lexer.mll index b7ac50b8..603c9407 100644 --- a/src/dune_lexer.mll +++ b/src/dune_lexer.mll @@ -61,6 +61,10 @@ and to_eol = parse { () } +and eof_reached = parse + | eof { true } + | "" { false } + { let first_line lb = match maybe_first_line lb with