1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-28 16:00:22 +02:00

syntax-error throws to syntax-error

* module/language/lua/common.scm (syntax-error): Throw to
  'syntax-error.
This commit is contained in:
Andy Wingo 2010-12-10 11:28:00 +01:00 committed by Ian Price
parent a30c18c22a
commit 32c58e2edd

View file

@ -24,21 +24,11 @@
#:export (syntax-error or-eqv?)) #:export (syntax-error or-eqv?))
(define (syntax-error src string . arguments) (define (syntax-error src string . args)
"Throw an error tagged with 'lua-syntax, and print detailed source "Throw an error tagged with 'syntax-error, and print detailed source
code information when available. STRING and ARGUMENTS are given to FORMAT." code information when available. STRING and ARGS are given to FORMAT."
(throw 'lua-syntax (throw 'syntax-error #f (apply format #f string args)
(string-append src #f #f '()))
(if src
(format #f "~a@~a.~a"
(cdr (assq 'filename src))
(cdr (assq 'line src))
(if (assq 'column src)
(cdr (assq 'column src))
"[no column available]"))
"[no source code information given]")
": "
(apply format (cons string arguments)))))
;; I was using CASE, but this is more succinct ;; I was using CASE, but this is more succinct
;; (or-eqv? 1 #f 1) => (or (eqv? 1 #f) (eqv? 1 1)) ;; (or-eqv? 1 #f 1) => (or (eqv? 1 #f) (eqv? 1 1))