Re: [Readable-discuss] Error when no empty line at end of file
Readable Lisp/S-expressions with infix, functions, and indentation
Brought to you by:
dwheeler
From: David A. W. <dwh...@dw...> - 2014-10-13 03:27:01
|
On Fri, 3 Oct 2014 02:18:32 +0200, martijn brekelmans <tij...@ms...> wrote: > I'm trying out readable, and I'm already finding it brilliant. I found a little bug however, in common lisp, when the file doesn't end with an empty line, it will throw an Error, Error: Unexpected text after n-expression. > > Code can be found here > > When I add a newline at the end of the file, all works well again. I'm using GNU CLISP 2.49. Ahah! I managed to duplicate the bug. Frankly, I *never* have source code without newline at end-of-file, so to me this is an incredibly weird case. That said, we should gracefully handle it. The fix turns out to be trivial, and is included below for your amusement. Basically, procedure "it-expr-real" didn't handle EOF-without-EOL gracefully. I expect this patch will be in the next release. --- David A. Wheeler ======================================================= --- a/sweet.lisp +++ b/sweet.lisp @@ -665,6 +665,8 @@ (read-body stream new-indent) (list body-new-indent (my-append line-value body-value))) (list new-indent (monify line-value))))) + ((eof-objectp (my-peek-char stream)) + (list " " (monify line-value))) (t (read-error "Unexpected text after n-expression"))) ; Here, line-exprs begins with something special like GROUP-SPLIT: |