1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 11:40:18 +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.
This commit is contained in:
Brian Templeton 2010-07-22 15:12:50 -04:00
parent 718acc97e6
commit 1a7bb9aa94
2 changed files with 10 additions and 3 deletions

View file

@ -314,10 +314,15 @@
(cons (integer->char (get-character port #t))
result-chars))))))
(else (iterate (cons cur result-chars)))))))
;; Circular markers (either reference or definition).
((#\#)
(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

@ -182,6 +182,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))))