Work on ignoring errors and giving warnings.
This commit is contained in:
parent
82319aaa4d
commit
06159627aa
1 changed files with 19 additions and 7 deletions
|
@ -28,6 +28,8 @@
|
|||
(module
|
||||
member-file
|
||||
(
|
||||
*member-file-context*
|
||||
*member-file-check-syntax*
|
||||
load-member-file
|
||||
member-file-tests!
|
||||
)
|
||||
|
@ -54,6 +56,12 @@
|
|||
;; Configuration of error reporting
|
||||
(define *member-file-context* (make-parameter 3))
|
||||
|
||||
;; Tolerance to formal errors (invalid key or key without value):
|
||||
;; 'error - show source and exits with error
|
||||
;; 'warning - show source and error, continue
|
||||
;; 'quiet - ignore
|
||||
(define *member-file-check-syntax* (make-parameter 'error))
|
||||
|
||||
;; Derived keys
|
||||
(define start/stop-keys-keys
|
||||
(map
|
||||
|
@ -79,14 +87,18 @@
|
|||
(car (string-chop l si)))
|
||||
l)))
|
||||
|
||||
;; Reports error with highlighted source line(s), configured via the
|
||||
;; *member-file-check-syntax* parameter.
|
||||
(define (report-line-error file-name lines highlights message)
|
||||
(when (not (eq? (*member-file-check-syntax*) 'quiet))
|
||||
(print "Error in " file-name ": " message)
|
||||
(newline)
|
||||
(print-source-listing lines highlights
|
||||
(*member-file-context*)
|
||||
(ansi #:red #:bold) (ansi #:default)
|
||||
"" "" "...")
|
||||
(exit 1))
|
||||
"" "" "..."))
|
||||
(when (eq? (*member-file-check-syntax*) 'error)
|
||||
(exit 1)))
|
||||
|
||||
;; Parses given key-value line. Key is up to first space, value is the
|
||||
;; rest of the line. If the line doesn't contain anything, returns #f.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue