@@ -544,21 +544,31 @@ module public Microsoft.FSharp.Compiler.PrettyNaming
544544
545545/// Return a string array delimited by the given separator.
546546/// Note that a quoted string is not going to be mangled into pieces.
547+ let inline private isNotQuotedQuotation ( text : string ) n = n> 0 && text.[ n-1 ] <> '\\'
547548let private splitAroundQuotation ( text : string ) ( separator : char ) =
548549let length = text.Length
549- let isNotQuotedQuotation n = n> 0 && text.[ n-1 ] <> '\\'
550- let rec split ( i , cur , group , insideQuotation ) =
551- if i>= lengththen List.rev( cur:: group) else
550+ let result = ResizeArray()
551+ let mutable insideQuotation = false
552+ let mutable start = 0
553+ for i= 0 to length- 1 do
552554match text.[ i], insideQuotationwith
553555// split when seeing a separator
554- | c, false when c= separator-> split( i+ 1 , " " , cur:: group, false )
556+ | c, false when c= separator->
557+ result.Add( text.Substring( start, i- start))
558+ insideQuotation<- false
559+ start<- i+ 1
560+ | _, _ when i= length- 1 ->
561+ result.Add( text.Substring( start, i- start+ 1 ))
555562// keep reading if a separator is inside quotation
556- | c, true when c= separator-> split( i+ 1 , cur+( Char.ToString c), group, true )
557- // open or close quotation
558- | '\"' , _ when isNotQuotedQuotation i-> split( i+ 1 , cur+ " \" " , group, not insideQuotation)
563+ | c, true when c= separator->
564+ insideQuotation<- true
565+ // open or close quotation
566+ | '\"' , _ when isNotQuotedQuotation text i->
567+ insideQuotation<- not insideQuotation
559568// keep reading
560- | c, _ -> split( i+ 1 , cur+( Char.ToString c), group, insideQuotation)
561- split( 0 , " " , [], false ) |> Array.ofList
569+ | _ -> ()
570+
571+ result.ToArray()
562572
563573/// Return a string array delimited by the given separator up to the maximum number.
564574/// Note that a quoted string is not going to be mangled into pieces.