[honu] function application respects precedence so that dot can bind higher
This commit is contained in:
parent
8ae1a903fa
commit
062a20f7e1
|
@ -13,6 +13,7 @@
|
|||
(rename-out [#%dynamic-honu-module-begin #%module-begin]
|
||||
[honu-top-interaction #%top-interaction]
|
||||
[honu-function function]
|
||||
[honu-require require]
|
||||
[honu-macro macro]
|
||||
[honu-syntax syntax]
|
||||
[honu-var var]
|
||||
|
|
|
@ -409,6 +409,7 @@ Then, in the pattern above for 'if', 'then' would be bound to the following synt
|
|||
#'(provide x.x ...))
|
||||
#'rest)])))
|
||||
|
||||
#;
|
||||
(honu:define-honu-syntax honu-require
|
||||
(lambda (body ctx)
|
||||
(define-syntax-class for-syntax-form
|
||||
|
|
|
@ -166,3 +166,13 @@
|
|||
(syntax-case stx ()
|
||||
[(_ rest ...)
|
||||
#'(#%top-interaction . (honu-unparsed-begin rest ...))]))
|
||||
|
||||
(provide honu-require)
|
||||
(define-honu-syntax honu-require
|
||||
(lambda (code context)
|
||||
(syntax-parse code
|
||||
[(_ module . rest)
|
||||
(values
|
||||
#'(require module)
|
||||
#'rest
|
||||
#f)])))
|
||||
|
|
|
@ -264,13 +264,20 @@
|
|||
;; expression or function application
|
||||
[(#%parens args ...)
|
||||
(if current
|
||||
(let ()
|
||||
(debug "function call ~a\n" left)
|
||||
(define call (with-syntax ([current current]
|
||||
[(parsed-args ...)
|
||||
(parse-comma-expression #'(args ...)) ])
|
||||
#'(current parsed-args ...)))
|
||||
(do-parse #'(rest ...) precedence left call))
|
||||
(if (> precedence 9000)
|
||||
(let ()
|
||||
(define call (with-syntax ([current (left current)]
|
||||
[(parsed-args ...)
|
||||
(parse-comma-expression #'(args ...)) ])
|
||||
#'(current parsed-args ...)))
|
||||
(do-parse #'(rest ...) 9000 (lambda (x) x) call))
|
||||
(let ()
|
||||
(debug "function call ~a\n" left)
|
||||
(define call (with-syntax ([current current]
|
||||
[(parsed-args ...)
|
||||
(parse-comma-expression #'(args ...)) ])
|
||||
#'(current parsed-args ...)))
|
||||
(do-parse #'(rest ...) precedence left call)))
|
||||
(let ()
|
||||
(debug "inner expression ~a\n" #'(args ...))
|
||||
(define-values (inner-expression unparsed) (parse #'(args ...)))
|
||||
|
|
|
@ -70,11 +70,7 @@
|
|||
[":" (token-identifier ':)]
|
||||
["'" (token-identifier 'quote)]
|
||||
["`" (token-identifier 'quasiquote)]
|
||||
;; ["=" (token-identifier '=)]
|
||||
[operator (token-identifier (string->symbol lexeme))]
|
||||
;; ["*" (token-identifier '*)]
|
||||
;; ["/" (token-identifier '/)]
|
||||
;; ["+" (token-identifier '+)]
|
||||
[";" (token-identifier '|;|)]
|
||||
;; strip the quotes from the resulting string
|
||||
;; TODO: find a more optimal way
|
||||
|
|
Loading…
Reference in New Issue
Block a user