summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSeungCheol Jung <scjung.hyu@gmail.com>2023-04-27 06:06:15 +0900
committerGitHub <noreply@github.com>2023-04-26 23:06:15 +0200
commit8c1013322a15c09c9253eec8022fd94e366bb4de (patch)
treec31fc8284a17a11c062eb848fa544fc887f57e71
parent9fd4767208663033b7695c3b507239c6197bdded (diff)
downloadocaml-8c1013322a15c09c9253eec8022fd94e366bb4de.tar.gz
ocamllex: Accept line directives ended with CR/LF. (#12146) (#12147)
-rw-r--r--Changes3
-rw-r--r--lex/lexer.mll2
2 files changed, 4 insertions, 1 deletions
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
}