std.d.lexer requirements

Walter Bright newshound2 at digitalmars.com
Tue Aug 7 02:52:51 PDT 2012


On 8/7/2012 1:00 AM, Christophe Travert wrote:
>> That's why I suggested supplying a callback delegate to decide what to do with
>> errors (ignore, throw exception, or quit) and have the delegate itself do that.
>> That way, there is no customization of the Lexer required.
>
> It may be easier to take into accound few cases (return error token and
> throwing is enough, so that is a basic static if), than to define a way
> to integrate a delegate (what should be the delegate's signature, what
> value to return to query for stopping, how to provide ways to recovers,
> etc).


If the delegate returns, then the lexer recovers.

The delegate is passed the error message and the location.

I don't see it is more complex than that.



More information about the Digitalmars-d mailing list