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:
parent
718acc97e6
commit
1a7bb9aa94
2 changed files with 10 additions and 3 deletions
|
@ -314,10 +314,15 @@
|
||||||
(cons (integer->char (get-character port #t))
|
(cons (integer->char (get-character port #t))
|
||||||
result-chars))))))
|
result-chars))))))
|
||||||
(else (iterate (cons cur result-chars)))))))
|
(else (iterate (cons cur result-chars)))))))
|
||||||
;; Circular markers (either reference or definition).
|
|
||||||
((#\#)
|
((#\#)
|
||||||
(let ((mark (get-circular-marker port)))
|
(let ((c (read-char port)))
|
||||||
(return (car mark) (cdr mark))))
|
(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.
|
;; Parentheses and other special-meaning single characters.
|
||||||
((#\() (return 'paren-open #f))
|
((#\() (return 'paren-open #f))
|
||||||
((#\)) (return 'paren-close #f))
|
((#\)) (return 'paren-close #f))
|
||||||
|
|
|
@ -182,6 +182,8 @@
|
||||||
(parse-error token "end of file during parsing"))
|
(parse-error token "end of file during parsing"))
|
||||||
((integer float symbol character string)
|
((integer float symbol character string)
|
||||||
(return (cdr token)))
|
(return (cdr token)))
|
||||||
|
((function)
|
||||||
|
(return `(function ,(get-expression lex))))
|
||||||
((quote backquote unquote unquote-splicing)
|
((quote backquote unquote unquote-splicing)
|
||||||
(return (list (assq-ref quotation-symbols type)
|
(return (list (assq-ref quotation-symbols type)
|
||||||
(get-expression lex))))
|
(get-expression lex))))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue