From 9f2dd563f0173dff2ed5db357b66c8f2614cec38 Mon Sep 17 00:00:00 2001 From: Hans Dijkema Date: Thu, 27 Aug 2026 15:41:42 +0200 Subject: [PATCH] better error reporting --- main.rkt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/main.rkt b/main.rkt index 5a74d06..6ad0dfb 100644 --- a/main.rkt +++ b/main.rkt @@ -124,7 +124,8 @@ (lines (if (file-exists? file) (file->lines file) '())) (re-section #px"^\\[([a-zA-Z0-9_.-]+)\\]$") (re-keyval #px"^([a-zA-Z0-9_.-]+)[=](.*)$") - (re-comment #px"^[;](.*)$")) + (re-comment #px"^[;](.*)$") + (line-nr 0)) (letrec ((f (lambda (sections section lines) (if (null? lines) (append sections (list section)) @@ -133,6 +134,7 @@ (m-comment (regexp-match re-comment line)) (m-keyval (regexp-match re-keyval line)) (m-section (regexp-match re-section line))) + (set! line-nr (+ 1 line-nr)) (if empty (f sections (append section (list (list 'empty))) (cdr lines)) (if m-comment @@ -146,7 +148,7 @@ (interpret (string-trim (caddr m-keyval)))))) (cdr lines)) (if m-section (f (append sections (list section)) (list (string->symbol (string-trim (cadr m-section)))) (cdr lines)) - (error "Unknown INI line")))))))))) + (error (format "Unknown INI line\n~a: ~a\n" line-nr line))))))))))) (mcons 'ini (f '() (list 'nil) lines))))) (define (ini-get ini section key def-val)