Following my previous question , I am slowly getting FParsec freezes (although this is especially hard for me to understand).
My next novice F # question is, how can I extract data from a list created by the parser?
For example, I downloaded the sample code from the previous question into a module called Parser.fs and added a very simple unit test to a separate module (with corresponding links). I am using XUnit:
open Xunit
[<Fact>]
let Parse_1_ShouldReturnListContaining1 () =
let interim = Parser.parse("1")
Assert.False(List.isEmpty(interim))
let head = interim.Head
Assert.Equal("1", ???)
Interactively, when I do a parsing of "1" , the answer is:
val it : Element list = [Number "1"]
and by changing the list of valid operators, I can run the syntax "1 + 1" to get:
val it : Element list = [Number "1"; Operator "+"; Number "1"]
What I need to add instead ? , , ..?