From b0aa30472dbc3c97b9bb7d90be48e79f35af52e9 Mon Sep 17 00:00:00 2001 From: Will Robson Date: Tue, 5 Aug 2025 16:04:43 -0400 Subject: [PATCH] Expose Lexer.comments in the Parse module Signed-off-by: Will Robson --- ast/import.ml | 2 ++ astlib/parse.ml | 2 ++ astlib/parse.mli | 3 +++ 3 files changed, 7 insertions(+) diff --git a/ast/import.ml b/ast/import.ml index d281f178f..c4b242adb 100644 --- a/ast/import.ml +++ b/ast/import.ml @@ -211,4 +211,6 @@ module Parse = struct let core_type lexbuf = core_type lexbuf |> Of_ocaml.copy_core_type let expression lexbuf = expression lexbuf |> Of_ocaml.copy_expression let pattern lexbuf = pattern lexbuf |> Of_ocaml.copy_pattern + + let comments_in_last_parse = comments_in_last_parse end diff --git a/astlib/parse.ml b/astlib/parse.ml index d82ef0aa6..e16209036 100644 --- a/astlib/parse.ml +++ b/astlib/parse.ml @@ -1 +1,3 @@ include Ocaml_common.Parse + +let comments_in_last_parse = Ocaml_common.Lexer.comments diff --git a/astlib/parse.mli b/astlib/parse.mli index 2181d5ae6..c407ae47d 100644 --- a/astlib/parse.mli +++ b/astlib/parse.mli @@ -20,3 +20,6 @@ val expression : Lexing.lexbuf -> Parsetree.expression val pattern : Lexing.lexbuf -> Parsetree.pattern (** Parse a pattern *) + +val comments_in_last_parse : unit -> (string * Location.t) list +(** Get the comments from the last parse *)