Mantis Bugtracker

Einfache Problemansicht anzeigen Zu Notizen wechseln ] erweiterte Anzeige ] Problem-Historie ] Drucken ]
ID Kategorie Auswirkung Reproduzierbar Meldungsdatum Letzte Aktualisierung
0000078 [Mascot] general kleinerer Fehler nicht getestet 2011-08-08 16:25 2012-08-29 20:18
Reporter sigonnea Anzeigestatus öffentlich  
Bearbeitung durch
Priorität normal Lösung wird nicht behoben  
Status geschlossen   Produktversion
Zusammenfassung 0000078: Allow closing blocks on a newline
Beschreibung 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.
Zusätzliche Information 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
Tags Keine Tags zugeordnet.
Angehängte Dateien

- Problem-Beziehungen

Zu diesem Problem gibt es keine Notizen.

- Problem-Historie
Änderungsdatum Benutzername Feld Änderung
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


Mantis 1.1.7[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker