summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--module/language/elisp/lexer.scm4
-rw-r--r--module/language/elisp/parser.scm11
2 files changed, 10 insertions, 5 deletions
diff --git a/module/language/elisp/lexer.scm b/module/language/elisp/lexer.scm
index 9c4bf5893..b201e18ce 100644
--- a/module/language/elisp/lexer.scm
+++ b/module/language/elisp/lexer.scm
@@ -269,7 +269,7 @@
(c (read-char port)))
(cond
;; End of input must be specially marked to the parser.
- ((eof-object? c) '*eoi*)
+ ((eof-object? c) (return 'eof c))
;; Whitespace, just skip it.
((char-whitespace? c) (lex port))
;; The dot is only the one for dotted lists if followed by
@@ -389,7 +389,7 @@
(paren-level 0))
(lambda ()
(if finished
- '*eoi*
+ (cons 'eof ((@ (rnrs io ports) eof-object)))
(let ((next (lex))
(quotation #f))
(case (car next)
diff --git a/module/language/elisp/parser.scm b/module/language/elisp/parser.scm
index 3436abf22..188b2961c 100644
--- a/module/language/elisp/parser.scm
+++ b/module/language/elisp/parser.scm
@@ -179,6 +179,8 @@
(source-properties token)))
result)))
(case type
+ ((eof)
+ (parse-error token "end of file during parsing"))
((integer float symbol character string)
(return (cdr token)))
((quote backquote unquote unquote-splicing)
@@ -208,6 +210,9 @@
(with-fluids ((circular-definitions (make-circular-definitions)))
(let* ((lexer (get-lexer port))
(lexbuf (make-lexer-buffer lexer))
- (result (get-expression lexbuf)))
- (lexbuf 'finish)
- result)))
+ (next (lexbuf 'peek)))
+ (if (eq? (car next) 'eof)
+ (cdr next)
+ (let ((result (get-expression lexbuf)))
+ (lexbuf 'finish)
+ result)))))