I have the need to generate errors while parsing operators using FParsec's OperatorPrecedenceParsers, specifically during the mapping phase. Suppose I have the following code:
let pOperatorExpr : ExpressionParser =
let opp = new OperatorPrecedenceParser<MyType, unit, unit>()
let arithmeticOperator a b ->
if someOperation a b then
// Fatal error! Abort!
else foobar a b
opp.AddOperator(InfixOperator("+", spaces, 1, Associativity.Left, arithmeticOperator)
opp.ExpressionParser
What should I do to generate an error in that particular position?