I was trying to run the following FParsec
code, until by some reason it stopped working:
The error I am getting is
"The value is not a function and cannot be applied."
If I comment out the last line of code (test ns ".."
) it will not yield an error, though. Any thoughts on how to solve this?
The source code in text form is the following:
open System
open FParsec
let test p str =
match run p str with
| Success(result, _, _) -> printfn "Success: %A" result
| Failure(errorMsg, _, _) -> printfn "Failure: %s" errorMsg
type Namespace = { Name : string; Classes : string list; }
let classes : Parser<string list, unit> =
many (spaces >>. many1Satisfy isLetter .>> spaces)
let ns =
pipe2
(spaces >>. skipString "namespace" >>. spaces >>. many1Satisfy isLetter)
(spaces >>. skipString "{" >>. classes .>> skipString "}")
(fun name classes -> { Name = name; Classes = classes } )
test ns "namespace abc { def ghi }"