You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
//GivenletsanityExpr,sanityExprImpl = createParserForwardedToRef()letsanityParser= OperatorPrecedenceParser<String, unit, unit>()
sanityParser.AddOperator(InfixOperator("+", spaces,100, Associativity.Left,fun s1 s2 -> s1 + s2))letsanityTerm=(choice [
attempt (pWordCI "hello");
attempt (pWordCI "world")])
sanityParser.TermParser <- sanityTerm
sanityExprImpl.Value <- sanityParser
letrunParser p s =match run p s with| Failure(errorString,_,_)->
InvalidOperationException(errorString)|> raise
| Success(result,_,_)-> result
[<Test>]let``Infix operator precedence parser should fail when operator and second term is absent`` ()=//Expect parser to fail.//Operator = "+"//Term = ["hello";"world"] i.e. "hello+world" -> "helloworld"//Expect parser to throwletresult= runParser sanityParser "hello"//Should not pass
result |> should equal "hello"
Example reply
Reply(Ok, "hello", [Expected("infix operator")])
The text was updated successfully, but these errors were encountered:
Example reply
The text was updated successfully, but these errors were encountered: