mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-14 07:30:32 +02:00
throw SyntaxError on bad syntax
* module/language/ecmascript/parse.scm (syntax-error): * module/language/ecmascript/tokenize.scm (syntax-error): Throw an error on bad syntax.
This commit is contained in:
parent
af6c20b731
commit
0b229e81a7
2 changed files with 26 additions and 20 deletions
|
@ -24,11 +24,14 @@
|
|||
#:use-module (language ecmascript tokenize)
|
||||
#:export (read-ecmascript read-ecmascript/1 parse-ecmascript))
|
||||
|
||||
(define (syntax-error message . args)
|
||||
(apply throw 'SyntaxError message args))
|
||||
|
||||
(define (read-ecmascript port)
|
||||
(parse-ecmascript (make-tokenizer port) pk))
|
||||
(parse-ecmascript (make-tokenizer port) syntax-error))
|
||||
|
||||
(define (read-ecmascript/1 port)
|
||||
(parse-ecmascript (make-tokenizer/1 port) pk))
|
||||
(parse-ecmascript (make-tokenizer/1 port) syntax-error))
|
||||
|
||||
(define *eof-object*
|
||||
(call-with-input-string "" read-char))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue