Mantis Bugtracker

Einfache Problemansicht anzeigen Zu Notizen wechseln ] erweiterte Anzeige ] Problem-Historie ] Drucken ]
ID Kategorie Auswirkung Reproduzierbar Meldungsdatum Letzte Aktualisierung
0000072 [Mascot] general schwerer Fehler immer 2011-08-03 16:15 2011-08-07 08:17
Reporter sigonnea Anzeigestatus öffentlich  
Bearbeitung durch xclerc
Priorität normal Lösung erledigt  
Status erledigt   Produktversion
Zusammenfassung 0000072: typography.spaces_around_blocks: Allow punctuation after closing a block
Beschreibung Closing parens have to be followed by whitespace *unless* they are followed by some punctuation, eg. like in

    (f x), (g y)

or in

    [(f x); y]

Zusätzliche Information
Tags Keine Tags zugeordnet.
Angehängte Dateien

- Problem-Beziehungen

-  Notiz
(0000238)
sigonnea (Reporter)
2011-08-03 16:23
bearbeitet am: 2011-08-03 16:51

The following patch fixes this bug. I can't find how to properly attach it to the bug report, so here it is inlined:

[Allow punctuation after closing a block
Benjamin Sigonneau <benjamin@xxxxxxxxxxxx.info>**20110803140159
 Ignore-this: 8e62908a2f3ed1ae99a0b2bb80e014a
 
 Closing parens have to be followed by whitespace *unless* they are
 followed by some punctuation, eg. like in
 
     (f x), (g y)
 
 or in
 
     [(f x); y]
 
] hunk ./src/checks/typo_spacesAroundBlocks.ml 48
   | Camlp4.Sig.SYMBOL "{"
   | Camlp4.Sig.LIDENT "begin" -> true
   | _ -> false
-
+
 let closing = function
   | Camlp4.Sig.SYMBOL ")"
   | Camlp4.Sig.SYMBOL "]"
hunk ./src/checks/typo_spacesAroundBlocks.ml 63
   | (_, _, hd) :: _ -> closing hd
   | [] -> true
 
+let punctuation = fun t ->
+ match t with
+ | Camlp4.Sig.SYMBOL ","
+ | Camlp4.Sig.SYMBOL "."
+ | Camlp4.Sig.SYMBOL ";"
+ | Camlp4.Sig.SYMBOL ":"
+ | Camlp4.Sig.SYMBOL "::"
+ | Camlp4.Sig.LABEL _
+ | Camlp4.Sig.OPTLABEL _ -> true
+ | _ -> false
+
+let first_punctuation = function
+ | (_, _, hd) :: _ -> punctuation hd
+ | [] -> true
+
 let run _ _ (_, tokens) _ report =
   let rec iter = function
     | (_, _, prev) :: (line, column, (Camlp4.Sig.SYMBOL s)) :: tl ->
hunk ./src/checks/typo_spacesAroundBlocks.ml 84
         let err = report.Check.error line (Some column) in
         (match s with
         | "(" | "[" | "[|" ->
- if not (opening prev) then
+ if not ((opening prev) || (punctuation prev)) then
               Camlp4Utils.check_white "sign" s err prev;
             Camlp4Utils.check_first_not_white "sign" s err tl
         | ")" | "]" | "|]" ->
hunk ./src/checks/typo_spacesAroundBlocks.ml 90
             if not ((closing prev) || (opening prev)) then
               Camlp4Utils.check_not_white "sign" s err prev;
- if not (first_closing tl) then
+ if not ((first_closing tl) || (first_punctuation tl)) then
               Camlp4Utils.check_first_white "sign" s err tl
         | "{" | "}" ->
             Camlp4Utils.check_white "sign" s err prev;

Context:

[TAG 1.0-beta
mascot@x9c.fr**20110715041203
 Ignore-this: 5d3c45d2c84c26077cf3af5135d116a3
]

(0000240)
xclerc (Administrator)
2011-08-07 08:17

Thanks for reporting.
I have committed a slightly different patch, to underline the various kinds of symbol:
until now only "opening" and "closing" were explicitly handled; following your report we
now handle "opening", "closing", "punctuation", and "other".


note: the ability to upload/attach a file was disabled after a server attack...

- Problem-Historie
Änderungsdatum Benutzername Feld Änderung
2011-08-03 16:15 sigonnea Neues Problem
2011-08-03 16:15 sigonnea Problem beobachten: sigonnea
2011-08-03 16:15 sigonnea Problembeobachtung beendet: sigonnea
2011-08-03 16:23 sigonnea Problemnotiz hinzugefügt: 0000238
2011-08-03 16:24 sigonnea Problemnotiz bearbeitet: 0000238
2011-08-03 16:24 sigonnea Problemnotiz bearbeitet: 0000238
2011-08-03 16:51 sigonnea Problemnotiz bearbeitet: 0000238
2011-08-07 08:17 xclerc Problemnotiz hinzugefügt: 0000240
2011-08-07 08:17 xclerc Status neu => erledigt
2011-08-07 08:17 xclerc Behoben in Version => 1.0
2011-08-07 08:17 xclerc Lösung offen => erledigt
2011-08-07 08:17 xclerc Bearbeitung durch => xclerc


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