chiark / gitweb /
src/fragment-parse.lisp, src/lexer-{impl,proto}.lisp: Better errors.
authorMark Wooding <mdw@distorted.org.uk>
Thu, 26 May 2016 08:26:09 +0000 (09:26 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Fri, 8 Jun 2018 18:58:28 +0000 (19:58 +0100)
commite046c3f65a8f7241889fb9b6005aac21e2aad1a8
tree2fdae60db75d11d4f48f54bbbcd3adceba607fb1
parent3c46cb3a94f2407959c3f5899f87f763a3e3865c
src/fragment-parse.lisp, src/lexer-{impl,proto}.lisp: Better errors.

Improve error reporting for comments, string and character literals, and
C fragments.  Most significantly, if we encounter end-of-file while
trying to read one of these, then also report where the construct
started.  For C fragments, if we encounter a mismatching closing
bracket, then report where the opening bracket was; and if we hit end-
of-file while brackets are still open, then report where they were.

Also, deal with a subtlety in the initialization procedure for
`sod-token-scanner': the first token is read to `prime the pump' as part
of the behaviour of `token-scanner', which is done before `sod-token-
scanner' itself has had a chance to initialize its own slots -- such as
the filename to report to `file-location'.  There are several ways I
could have dealt with this -- e.g., introducing some deliberately-less-
specific superclass to initialize the filename for me -- but the path of
least resistance seems to be to cope with this problem carefully in
`scanner-token'.  This is anyway an improvement because the function no
longer depends on a sensible ambient error-location object being set.
src/fragment-parse.lisp
src/lexer-impl.lisp
src/lexer-proto.lisp