~=(_:_:)
public func ~=<T, U>(lhs: Parser<T, U>, rhs: T) -> Bool
~= allows the usage of Parser
s in switch-case pattern matching statements.
example:
switch "a" {
case L.char: print("it's a char \o/")
case L.digit: print("it's a digit!")
default: print("it's something unexpected :/")
NOTE: Be aware that this also checks if the rest is empty to ensure the whole input matches!