2 people like it.

FParsec: caseInsensitiveString

Attempt to reproduce caseInsensitiveString from http://stackoverflow.com/a/12938883/17049

1: 
2: 
3: 
4: 
5: 
6: 
7: 
8: 
// http://stackoverflow.com/a/12938883/17049
open FParsec

let toLower = System.Char.ToLower
let toUpper = System.Char.ToUpper

let caseInsensitiveChar c = pchar (toLower c) <|> pchar (toUpper c)  
//let caseInsensitiveString (*s*) = ?? (Seq.map caseInsensitiveChar)  
namespace FParsec
val toLower : arg00:char -> char

Full name: Script.toLower
namespace System
type Char =
  struct
    member CompareTo : value:obj -> int + 1 overload
    member Equals : obj:obj -> bool + 1 overload
    member GetHashCode : unit -> int
    member GetTypeCode : unit -> TypeCode
    member ToString : unit -> string + 1 overload
    static val MaxValue : char
    static val MinValue : char
    static member ConvertFromUtf32 : utf32:int -> string
    static member ConvertToUtf32 : highSurrogate:char * lowSurrogate:char -> int + 1 overload
    static member GetNumericValue : c:char -> float + 1 overload
    ...
  end

Full name: System.Char
System.Char.ToLower(c: char) : char
System.Char.ToLower(c: char, culture: System.Globalization.CultureInfo) : char
val toUpper : arg00:char -> char

Full name: Script.toUpper
System.Char.ToUpper(c: char) : char
System.Char.ToUpper(c: char, culture: System.Globalization.CultureInfo) : char
val caseInsensitiveChar : c:char -> Parser<char,'a>

Full name: Script.caseInsensitiveChar
val c : char
val pchar : char -> Parser<char,'u>

Full name: FParsec.CharParsers.pchar
Raw view Test code New version

More information

Link:http://fssnip.net/pO
Posted:9 years ago
Author:Gauthier Segay
Tags: fparsec