fix: accept empty file

This commit is contained in:
hylo 2022-12-30 17:53:13 +01:00
parent e456845b9a
commit 09dfd01956
1 changed files with 4 additions and 1 deletions

View File

@ -359,7 +359,9 @@
(define (peg-tree->scm tree)
;; (pretty-print tree)
(let loop ((tree (if (symbol? (car tree)) (list tree) tree))
(let loop ((tree (cond ((null? tree) '(()))
((symbol? (car tree)) (list tree))
(else tree)))
(result '())
(current-table '())
(inline-table-keys '())
@ -440,6 +442,7 @@
('() '())
(x (error x)))
(if (null? (cdr tree))