diff --git a/collects/honu/core/private/parse2.rkt b/collects/honu/core/private/parse2.rkt index 3feca0d076..f0d82e4bfd 100644 --- a/collects/honu/core/private/parse2.rkt +++ b/collects/honu/core/private/parse2.rkt @@ -70,6 +70,13 @@ (debug "Semicolon? ~a ~a\n" what is) is) +(define (comma? what) + (define-literal-set check (honu-comma)) + (define is (and (identifier? what) + ((literal-set->predicate check) what))) + (debug "Comma? ~a ~a\n" what is) + is) + (define-literal-set argument-stuff [honu-comma]) (define (parse-arguments arguments) @@ -88,6 +95,18 @@ (loop (cons #'name out) #'())] [() (reverse out)]))) +(define (parse-call-arguments arguments) + (if (null? (syntax->list arguments)) + '() + (let loop ([used '()] + [rest arguments]) + (if (empty-syntax? rest) + (reverse used) + (let-values ([(parsed unparsed) + (parse rest)]) + (loop (cons parsed used) + unparsed)))))) + ;; 1 + 1 ;; ^ ;; left: identity @@ -162,6 +181,9 @@ 0 (lambda (x) x) (left current)))] + [(comma? #'head) + (values (left current) + #'(rest ...))] [(semicolon? #'head) (values (left current) #'(rest ...)) @@ -195,9 +217,7 @@ (debug "function call ~a\n" left) (values (left (with-syntax ([current current] [(parsed-args ...) - (if (null? (syntax->list #'(args ...))) - '() - (list (parse-all #'(args ...))))]) + (parse-call-arguments #'(args ...)) ]) #'(current parsed-args ...))) #'(rest ...)) #; diff --git a/collects/tests/honu/test.honu b/collects/tests/honu/test.honu index 3c9c5c306f..b5eb84f1d8 100644 --- a/collects/tests/honu/test.honu +++ b/collects/tests/honu/test.honu @@ -26,11 +26,12 @@ test1(){ print(x ^ 2) } -val test2(val x){ - print(x) +val test2(val x, val y){ + print(x); + print(y) } // test1(); -test2(5); +test2(5, 9); -function(z){ print(z) }(12) +// function(z){ print(z) }(12)