1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-01 04:10:18 +02:00

fix ecmascript at the repl

* module/language/ecmascript/tokenize.scm (syntax-error): Reorder args
  to throw vals in the right order.
  (make-tokenizer/1): Fix. Broken since the lalr refactor...
This commit is contained in:
Andy Wingo 2010-11-18 12:24:01 +01:00
parent 29de6ae2e8
commit a608cad27e

View file

@ -24,8 +24,8 @@
#:use-module (system base lalr)
#:export (next-token make-tokenizer make-tokenizer/1 tokenize tokenize/1))
(define (syntax-error message . args)
(throw 'syntax-error 'tokenize #f message #f #f args))
(define (syntax-error what . args)
(throw 'syntax-error 'tokenize what #f #f #f args))
;; taken from SSAX, sorta
(define (read-until delims port)
@ -442,21 +442,24 @@
(let ((tok (next-token port div?)))
(case (if (lexical-token? tok) (lexical-token-category tok) tok)
((lparen)
(set! stack (make-lexical-token 'lparen #f stack)))
(set! stack (cons tok stack)))
((rparen)
(if (and (pair? stack) (eq? (car stack) 'lparen))
(if (and (pair? stack)
(eq? (lexical-token-category (car stack)) 'lparen))
(set! stack (cdr stack))
(syntax-error "unexpected right parenthesis")))
((lbracket)
(set! stack (make-lexical-token 'lbracket #f stack)))
(set! stack (cons tok stack)))
((rbracket)
(if (and (pair? stack) (eq? (car stack) 'lbracket))
(if (and (pair? stack)
(eq? (lexical-token-category (car stack)) 'lbracket))
(set! stack (cdr stack))
(syntax-error "unexpected right bracket" stack)))
((lbrace)
(set! stack (make-lexical-token 'lbrace #f stack)))
(set! stack (cons tok stack)))
((rbrace)
(if (and (pair? stack) (eq? (car stack) 'lbrace))
(if (and (pair? stack)
(eq? (lexical-token-category (car stack)) 'lbrace))
(set! stack (cdr stack))
(syntax-error "unexpected right brace" stack)))
((semicolon)