1
1
namespace FSharpLint.Framework
2
2
3
+ open System
3
4
open FParsec
4
5
open FSharp.Compiler .Tokenization
5
6
@@ -146,7 +147,7 @@ module HintParser =
146
147
147
148
override this.GetHashCode () = hash ( this.AnyMatch, hash this.Lookup)
148
149
149
- static member Empty = { Lookup = Dictionary<_, _>(); AnyMatch = [] }
150
+ static member Empty = { Lookup = Dictionary<_, _>(); AnyMatch = List.Empty }
150
151
151
152
let private getConstKey = function
152
153
| Constant.Unit -> SyntaxHintNode.Unit
@@ -235,7 +236,7 @@ module HintParser =
235
236
| HintExpr( Expression.Constant(_))
236
237
| HintExpr( Expression.Null)
237
238
| HintExpr( Expression.Wildcard)
238
- | HintExpr( Expression.Variable(_)) -> []
239
+ | HintExpr( Expression.Variable(_)) -> List.Empty
239
240
| HintPat( Pattern.Cons( lhs, rhs))
240
241
| HintPat( Pattern.Or( lhs, rhs)) -> [ HintPat lhs; HintPat rhs]
241
242
| HintPat( Pattern.Array( patterns))
@@ -246,7 +247,7 @@ module HintParser =
246
247
| HintPat( Pattern.Identifier(_))
247
248
| HintPat( Pattern.Constant(_))
248
249
| HintPat( Pattern.Wildcard)
249
- | HintPat( Pattern.Null) -> []
250
+ | HintPat( Pattern.Null) -> List.Empty
250
251
251
252
let private getConstantHashCode = function
252
253
| Constant.Bool( x) -> hash x
@@ -320,7 +321,7 @@ module HintParser =
320
321
transposeHead next rest
321
322
| [] -> builtList
322
323
323
- transposeHead [] hintLists
324
+ transposeHead List.Empty hintLists
324
325
325
326
let isAnyMatch = function
326
327
| (( SyntaxHintNode.Wildcard | SyntaxHintNode.Variable), _, _, _) -> true
@@ -387,7 +388,7 @@ module HintParser =
387
388
getEdges transposed
388
389
389
390
let charListToString charList =
390
- Seq.fold ( fun x y -> x + y.ToString()) " " charList
391
+ Seq.fold ( fun x y -> x + y.ToString()) String.Empty charList
391
392
392
393
let pischar chars : Parser < char , 'T > =
393
394
satisfy ( fun x -> List.exists ((=) x) chars)
@@ -424,7 +425,7 @@ module HintParser =
424
425
pidentstartchar .>>. many pidentchar
425
426
|>> fun ( start , rest ) -> start:: rest
426
427
>>= fun ident ->
427
- let identStr = System.String.Join( " " , ident)
428
+ let identStr = System.String.Join( String.Empty , ident)
428
429
429
430
let isKeyword = List.exists ((=) identStr) FSharpKeywords.KeywordNames
430
431
@@ -902,9 +903,9 @@ module HintParser =
902
903
let addInfixOperator prefix precedence associativity =
903
904
let remainingOpChars =
904
905
if prefix = " =" then
905
- notFollowedBy ( pstring " ==>" ) |>> fun _ -> " "
906
+ notFollowedBy ( pstring " ==>" ) |>> fun _ -> String.Empty
906
907
else if prefix = " |" then
907
- notFollowedBy ( pstring " ]" ) |>> fun _ -> " "
908
+ notFollowedBy ( pstring " ]" ) |>> fun _ -> String.Empty
908
909
else
909
910
manySatisfy ( isAnyOf Operators.opchars)
910
911
@@ -922,7 +923,7 @@ module HintParser =
922
923
else if prefix = " ~" then
923
924
manySatisfy ((=) '~' )
924
925
else
925
- preturn " "
926
+ preturn String.Empty
926
927
927
928
let checkPrefix remOpChars expr =
928
929
if prefix = " &" then Expression.AddressOf( true , expr)
@@ -1026,7 +1027,7 @@ module HintParser =
1026
1027
let addInfixOperator operator precedence associativity =
1027
1028
let remainingOpChars =
1028
1029
if operator = " |" then
1029
- notFollowedBy ( pstring " ]" ) |>> fun _ -> " "
1030
+ notFollowedBy ( pstring " ]" ) |>> fun _ -> String.Empty
1030
1031
else
1031
1032
manySatisfy ( isAnyOf Operators.opchars)
1032
1033
0 commit comments