In one of last discussions about standard lexer/parser I remember quite a neat proposal - take a delegate for error handling and provide two out of the box ( one, that throws exception and one that returns Error token)