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

use correct names for quasiquotation operators

Use #{`}#, #{,}# and #{,@}# as the quasiquote, unquote and
unquote-splicing operators, respectively. Previously they were named
escaping.

* module/language/elisp/compile-tree-il.scm (unquote?): Change "\," to
  "#{,}#".
  (unquote-splicing): Change "\,@" to "#{,@}#".
  (#{compile-`}#): Rename from #{compile-\`}#.
* module/language/elisp/runtime/function-slot.scm: Import #{compile-`}#
  instead of #{compile-\`}#, and re-export as #{`}# instead of as
  #{\`}#.
* module/language/elisp/parser.scm (quotation-symbols):
* test-suite/tests/elisp-compiler.test ("Eval", "Quotation"):
* test-suite/tests/elisp-reader.test ("Parser"): Change "\`", "\,", and
  "\,@" to "#{`}#", "#{,}#" and "#{,@}#", respectively.
This commit is contained in:
Brian Templeton 2010-07-09 20:33:32 -04:00
parent 7d6816f0c7
commit 3b93c9b881
5 changed files with 19 additions and 19 deletions

View file

@ -49,7 +49,7 @@
compile-function compile-function
compile-defmacro compile-defmacro
compile-defun compile-defun
compile-\` #{compile-`}#
compile-quote)) compile-quote))
;;; Certain common parameters (like the bindings data structure or ;;; Certain common parameters (like the bindings data structure or
@ -101,10 +101,10 @@
;;; unquote/unquote-splicing/backquote form. ;;; unquote/unquote-splicing/backquote form.
(define (unquote? sym) (define (unquote? sym)
(and (symbol? sym) (eq? sym '\,))) (and (symbol? sym) (eq? sym '#{,}#)))
(define (unquote-splicing? sym) (define (unquote-splicing? sym)
(and (symbol? sym) (eq? sym '\,@))) (and (symbol? sym) (eq? sym '#{,@}#)))
;;; Build a call to a primitive procedure nicely. ;;; Build a call to a primitive procedure nicely.
@ -876,7 +876,7 @@
body)) body))
(make-const loc name))))))) (make-const loc name)))))))
(defspecial \` (loc args) (defspecial #{`}# (loc args)
(pmatch args (pmatch args
((,val) ((,val)
(process-backquote loc val)))) (process-backquote loc val))))

View file

@ -164,9 +164,9 @@
;;; routine in our recursive-descent parser. ;;; routine in our recursive-descent parser.
(define quotation-symbols '((quote . quote) (define quotation-symbols '((quote . quote)
(backquote . \`) (backquote . #{`}#)
(unquote . \,) (unquote . #{,}#)
(unquote-splicing . \,@))) (unquote-splicing . #{,@}#)))
(define (get-expression lex) (define (get-expression lex)
(let* ((token (lex 'get)) (let* ((token (lex 'get))

View file

@ -56,7 +56,7 @@
(compile-function . function) (compile-function . function)
(compile-defun . defun) (compile-defun . defun)
(compile-defmacro . defmacro) (compile-defmacro . defmacro)
(compile-\` . \`) (#{compile-`}# . #{`}#)
(compile-quote . quote))) (compile-quote . quote)))
#:duplicates (last) #:duplicates (last)
;; special operators ;; special operators
@ -79,7 +79,7 @@
function function
defun defun
defmacro defmacro
\` #{`}#
quote) quote)
;; macros ;; macros
#:re-export (lambda #:re-export (lambda

View file

@ -204,7 +204,7 @@
(progn (setq depth 10 i depth) (progn (setq depth 10 i depth)
(setq code '(eval 0)) (setq code '(eval 0))
(while (not (zerop i)) (while (not (zerop i))
(setq code (\` (eval (quote (1+ (\, code)))))) (setq code (#{`}# (eval (quote (1+ (#{,}# code))))))
(setq i (1- i))) (setq i (1- i)))
(= (eval code) depth)))) (= (eval code) depth))))
@ -527,19 +527,19 @@
(equal '(1 2 . 3) '(1 2 . 3)))) (equal '(1 2 . 3) '(1 2 . 3))))
(pass-if "simple backquote" (pass-if "simple backquote"
(and (equal (\` 42) 42) (and (equal (#{`}# 42) 42)
(equal (\` (1 (a))) '(1 (a))) (equal (#{`}# (1 (a))) '(1 (a)))
(equal (\` (1 . 2)) '(1 . 2)))) (equal (#{`}# (1 . 2)) '(1 . 2))))
(pass-if "unquote" (pass-if "unquote"
(progn (setq a 42 l '(18 12)) (progn (setq a 42 l '(18 12))
(and (equal (\` (\, a)) 42) (and (equal (#{`}# (#{,}# a)) 42)
(equal (\` (1 a ((\, l)) . (\, a))) '(1 a ((18 12)) . 42))))) (equal (#{`}# (1 a ((#{,}# l)) . (#{,}# a))) '(1 a ((18 12)) . 42)))))
(pass-if "unquote splicing" (pass-if "unquote splicing"
(progn (setq l '(18 12) empty '()) (progn (setq l '(18 12) empty '())
(and (equal (\` (\,@ l)) '(18 12)) (and (equal (#{`}# (#{,@}# l)) '(18 12))
(equal (\` (l 2 (3 (\,@ l)) ((\,@ l)) (\,@ l))) (equal (#{`}# (l 2 (3 (#{,@}# l)) ((#{,@}# l)) (#{,@}# l)))
'(l 2 (3 18 12) (18 12) 18 12)) '(l 2 (3 18 12) (18 12) 18 12))
(equal (\` (1 2 (\,@ empty) 3)) '(1 2 3)))))) (equal (#{`}# (1 2 (#{,@}# empty) 3)) '(1 2 3))))))

View file

@ -163,7 +163,7 @@ test\"ab\"\\ abcd
(and (equal? (parse-str "'(1 2 3 '4)") (and (equal? (parse-str "'(1 2 3 '4)")
'(quote (1 2 3 (quote 4)))) '(quote (1 2 3 (quote 4))))
(equal? (parse-str "`(1 2 ,3 ,@a)") (equal? (parse-str "`(1 2 ,3 ,@a)")
'(\` (1 2 (\, 3) (\,@ a)))))) '(#{`}# (1 2 (#{,}# 3) (#{,@}# a))))))
(pass-if "lists" (pass-if "lists"
(equal? (parse-str "(1 2 (3) () 4 (. 5) (1 2 . (3 4)) (1 . 2) . 42)") (equal? (parse-str "(1 2 (3) () 4 (. 5) (1 2 . (3 4)) (1 . 2) . 42)")