On 26 July 2010 17:48, Alberto Bacchelli <alberto.bacchelli(a)usi.ch> wrote:
Another fast question :) :
since the "not" method parses p and succeeds when it fails, but does
not consume its input.
What is the best way to define something negated? For example to define:
"everything but a word or a space"
If
wordOrSpace := #word asParser / #space asParser.
is given you can write the negation using the helper #negate like
wordOrSpace negate
which simply consumes one character if the receiver does not parse:
wordOrSpace not , #any asParser ==> #second
Lukas
--
Lukas Renggli
www.lukas-renggli.ch