diff options
author | Hugo Herbelin <Hugo.Herbelin@inria.fr> | 2016-10-08 22:51:09 +0200 |
---|---|---|
committer | Hugo Herbelin <Hugo.Herbelin@inria.fr> | 2016-10-09 08:13:18 +0200 |
commit | b8ae2de5be242bbd1e34ec974627c81f99b16d23 (patch) | |
tree | 6b6c2980e6aac60e53da6097dca7ae93db83d52e /printing/pputils.ml | |
parent | 8a8caba36ea6b0fd67e026ee3833d3b5b25af56d (diff) |
Moving Pp.comments to CLexer so that Pp is purer (no more side-effect
done by the Ppcmd_comment token) and so that lexing/parsing
side-effects are collected at the same place, i.e. in CLexer.
Diffstat (limited to 'printing/pputils.ml')
-rw-r--r-- | printing/pputils.ml | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/printing/pputils.ml b/printing/pputils.ml index 906b463a8..57a1d957e 100644 --- a/printing/pputils.ml +++ b/printing/pputils.ml @@ -11,5 +11,9 @@ open Pp let pr_located pr (loc, x) = if Flags.do_beautify () && loc <> Loc.ghost then let (b, e) = Loc.unloc loc in - Pp.comment b ++ pr x ++ Pp.comment e + (* Side-effect: order matters *) + let before = Pp.comment (CLexer.extract_comments b) in + let x = pr x in + let after = Pp.comment (CLexer.extract_comments e) in + before ++ x ++ after else pr x |