Slide 77
Slide 77 text
let jEscapedChar =
[ // each item is (stringToMatch, resultChar)
("\\\"",'\"') // quote
("\\\\",'\\') // reverse solidus
("\\/",'/') // solidus
("\\b",'\b') // backspace
("\\f",'\f') // formfeed
("\\n",'\n') // newline
("\\r",'\r') // cr
("\\t",'\t') // tab
]
// convert each pair into a parser
|> List.map (fun (toMatch,result) -> pstring toMatch >>% result)
// and combine them into one
|> choice
> "escaped char" // set label