Add ECMAScript Unicode literal support

* module/language/ecmascript/tokenize.scm: add unicode literals

* test-suite/tests/ecmascript.test ("parser"): Add new tests for Latin-1
  and Unicode escapes in string literals.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
Noah Lavine 2011-01-11 16:32:17 -05:00 committed by Ludovic Courtès
commit b1846b7fb3
2 changed files with 11 additions and 3 deletions

View file

@ -1,6 +1,6 @@
;;; ECMAScript for Guile
;; Copyright (C) 2009, 2010 Free Software Foundation, Inc.
;; Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public
@ -150,7 +150,11 @@
(else
(syntax-error "bad hex character escape" loc (string a b))))))
((#\u)
(syntax-error "unicode not supported" loc #f))
(let* ((a (read-char port))
(b (read-char port))
(c (read-char port))
(d (read-char port)))
(integer->char (string->number (string a b c d) 16))))
(else
c))))
(let lp ((str (read-until terms port loc)))