Mantis - Mascot
Erweiterte Problemanzeige
78 general kleinerer Fehler nicht getestet 2011-08-08 16:25 2012-08-29 20:18
sigonnea  
 
normal  
geschlossen  
wird nicht behoben  
keine    
keine  
0000078: Allow closing blocks on a newline
Please allow spaces before closing sign if at beginning of line, eg:

   let foo = (match bar with
               | case1 -> ...
               | case2 -> ...
              ) in

I didn't see anything about it in Ocaml Programming Guidelines, but I see it often in some code I work with.
Below is a hacky patch that solves this bug:

diff --git a/src/checks/typo_spacesAroundBlocks.ml b/src/checks/typo_spacesAroundBlocks.ml
index 721ee22..1b8495b 100644
--- a/src/checks/typo_spacesAroundBlocks.ml
+++ b/src/checks/typo_spacesAroundBlocks.ml
@@ -67,6 +67,20 @@ let first kinds = function
 
 let run _ _ (_, tokens) _ report =
   let rec iter = function
+ | (_, _, (Camlp4.Sig.NEWLINE)) :: (_, _, (Camlp4.Sig.BLANKS _)) :: (line, column, (Camlp4.Sig.SYMBOL s)) :: tl
+ | (_, _, (Camlp4.Sig.NEWLINE)) :: (line, column, (Camlp4.Sig.SYMBOL s)) :: tl ->
+ let err = report.Check.error line (Some column) in
+ (match s with
+ | "(" | "[" ->
+ Camlp4Utils.check_first_not_white "sign" s err tl
+ | ")" | "]" ->
+ if not (first [Closing; Punctuation] tl) then
+ Camlp4Utils.check_first_white "sign" s err tl
+ | "{" | "}" | "[|" | "|]" | "[<" | ">]" ->
+ if not (first [Closing] tl) then
+ Camlp4Utils.check_first_white "sign" s err tl
+ | _ -> ());
+ iter tl
     | (_, _, prev) :: (line, column, (Camlp4.Sig.SYMBOL s)) :: tl ->
         let err = report.Check.error line (Some column) in
         (match s with
Problem-Historie
2011-08-08 16:25 sigonnea Neues Problem
2012-08-29 20:18 xclerc Status neu => geschlossen
2012-08-29 20:18 xclerc Lösung offen => wird nicht behoben

Zu diesem Problem gibt es keine Notizen.