You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The idea is to distinguish lexing errors from I/O errors.
On the other hand, if an I/O error occurs, s.abort is set to true, so any subsequent calls to next will return an EOF token.
Clients that need to distinguish error types may consider the built-in Error token as fatal and implement their own soft error token in their ragel file.
Something possibly more versatile is to have any returned error token added to a list of errors (with the actual error interface) and add ErrorCount and Errors method to Scanner.
The text was updated successfully, but these errors were encountered:
After much consideration and extensive use with a couple of parsers, it turns out that an error from the lexer, whether due to incorrect input or I/O, will result in a parsing failure. Adding different error cases only complicates the parser implementation for no benefit.
The idea is to distinguish lexing errors from I/O errors.
On the other hand, if an I/O error occurs,
s.abort
is set totrue
, so any subsequent calls to next will return anEOF
token.Clients that need to distinguish error types may consider the built-in
Error
token as fatal and implement their own soft error token in their ragel file.Something possibly more versatile is to have any returned error token added to a list of errors (with the actual
error
interface) and addErrorCount
andErrors
method toScanner
.The text was updated successfully, but these errors were encountered: