[Lazarus] FPC Parser

Adem listmember at letterboxes.org
Sun Jun 6 22:48:52 CEST 2010


On 2010-06-06 22:17, Hans-Peter Diettrich wrote:
> And finally we'll have to talk about parsing invalid code, during 
> editing. This can be handled by the same hack as for conditionally 
> excluded code, so that after an syntax error the parser stops parsing, 
> and simply returns the tokens provided by the scanner. The only 
> question: how to make the parser resume parsing, once enough tokens 
> have been skipped?
OTOH, two approaches come to mind:

First one is, introduce another token kind (or several new token kinds, 
if we need to take care of degrees of severity) for error, and add an 
'error node' every time an error occurs and contniue regardless. Then, 
let the calling application decide what to do.

Second one could be something like this:

Call an event wherever halting occurs:

<pseudo_code>
If SomethingIllegalHappened then FOnReportErrorAndGetFeedback(Self, 
ErrorKind, PositionInText, MustStop);

If MustStop then DoEmitFatalErrorAndStop;
</pseudo_code>

-- 

Cheers,

Adem





More information about the Lazarus mailing list