Mantis - Mascot
Erweiterte Problemanzeige
81 general kleinerer Fehler nicht getestet 2011-08-08 16:31 2012-08-29 20:16
sigonnea  
xclerc  
normal  
erledigt 1.0-beta  
erledigt  
keine    
keine 1.0  
0000081: Allow list or parenthesis directly following a label
The following code should be accepted:

   f ~label:(some thing) ~foo:["bar"; "baz"]

(instead, it complains abot missing whitespace before '(' or '[' sign)
Below is a patch that corrects this:

diff --git a/src/checks/typo_spacesAroundBlocks.ml b/src/checks/typo_spacesAroundBlocks.ml
index 4ed5614..2077d4d 100644
--- a/src/checks/typo_spacesAroundBlocks.ml
+++ b/src/checks/typo_spacesAroundBlocks.ml
@@ -42,6 +42,7 @@ type symbol_kind =
   | Opening
   | Closing
   | Punctuation
+ | Label
   | Other
 
 let symbol_kind = function
@@ -59,6 +60,8 @@ let symbol_kind = function
   | Camlp4.Sig.SYMBOL ";"
   | Camlp4.Sig.SYMBOL ";;"
   | Camlp4.Sig.SYMBOL "." -> Punctuation
+ | Camlp4.Sig.LABEL _
+ | Camlp4.Sig.OPTLABEL _ -> Label
   | _ -> Other
 
 let first kinds = function
@@ -85,7 +88,8 @@ let run _ _ (_, tokens) _ report =
         let err = report.Check.error line (Some column) in
         (match s with
         | "(" | "[" ->
- if symbol_kind prev <> Opening then
+ let prev_kind = symbol_kind prev in
+ if (prev_kind <> Opening) && (prev_kind <> Label) then
               Camlp4Utils.check_white "sign" s err prev;
             Camlp4Utils.check_first_not_white "sign" s err tl
         | ")" | "]" ->
Problem-Historie
2011-08-08 16:31 sigonnea Neues Problem
2012-08-29 20:16 xclerc Status neu => erledigt
2012-08-29 20:16 xclerc Behoben in Version => 1.0
2012-08-29 20:16 xclerc Lösung offen => erledigt
2012-08-29 20:16 xclerc Bearbeitung durch => xclerc

Zu diesem Problem gibt es keine Notizen.