1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-11 06:20:23 +02:00

support "#'" syntax for function expressions

* module/language/elisp/lexer.scm (lex):
* module/language/elisp/parser.scm (get-expression): Support sharpsign
  single-quote syntax as an abbreviation for `function' expressions.

Signed-off-by: Andy Wingo <wingo@pobox.com>
This commit is contained in:
Brian Templeton 2010-07-22 15:12:50 -04:00 committed by Andy Wingo
parent f5742cf042
commit b7966c10ef
2 changed files with 10 additions and 3 deletions

View file

@ -313,10 +313,15 @@
(cons (integer->char (get-character port #t))
result-chars))))))
(else (iterate (cons cur result-chars)))))))
;; Circular markers (either reference or definition).
((#\#)
(let ((mark (get-circular-marker port)))
(return (car mark) (cdr mark))))
(let ((c (read-char port)))
(case c
((#\0 #\1 #\2 #\3 #\4 #\5 #\6 #\7 #\8 #\9)
(unread-char c port)
(let ((mark (get-circular-marker port)))
(return (car mark) (cdr mark))))
((#\')
(return 'function #f)))))
;; Parentheses and other special-meaning single characters.
((#\() (return 'paren-open #f))
((#\)) (return 'paren-close #f))

View file

@ -183,6 +183,8 @@
(parse-error token "end of file during parsing"))
((integer float symbol character string)
(return (cdr token)))
((function)
(return `(function ,(get-expression lex))))
((quote backquote unquote unquote-splicing)
(return (list (assq-ref quotation-symbols type)
(get-expression lex))))