From 8c1013322a15c09c9253eec8022fd94e366bb4de Mon Sep 17 00:00:00 2001 From: SeungCheol Jung Date: Thu, 27 Apr 2023 06:06:15 +0900 Subject: ocamllex: Accept line directives ended with CR/LF. (#12146) (#12147) --- Changes | 3 +++ lex/lexer.mll | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Changes b/Changes index 123c033648..2d2c90be0f 100644 --- a/Changes +++ b/Changes @@ -386,6 +386,9 @@ OCaml 5.1.0 used in any context where a character set is expected. (Nicolás Ojeda Bär, Martin Jambon, review by Sébastien Hinderer) +- #12147: ocamllex: Allow carriage returns at the end of line directives. + (SeungCheol Jung, review by Nicolás Ojeda Bär) + - #11718: ocamlyacc: OCaml-style comments are now supported, in addition to the C-style comments already supported. The syntax is the same as that used in OCaml code. diff --git a/lex/lexer.mll b/lex/lexer.mll index 83111badc1..ca6f170713 100644 --- a/lex/lexer.mll +++ b/lex/lexer.mll @@ -137,7 +137,7 @@ rule main = parse main lexbuf } | "#" [' ' '\t']* (['0'-'9']+ as num) [' ' '\t']* ('\"' ([^ '\010' '\013' '\"']* as name) '\"')? - [^ '\010' '\013']* '\010' + [^ '\010' '\013']* '\013'* '\010' { update_loc lexbuf name (int_of_string num); main lexbuf } -- cgit v1.2.1