diff --git a/collects/honu/core/private/honu2.rkt b/collects/honu/core/private/honu2.rkt index 49bf5c1936..33f3605ca6 100644 --- a/collects/honu/core/private/honu2.rkt +++ b/collects/honu/core/private/honu2.rkt @@ -46,7 +46,13 @@ (define-honu-syntax honu-function (lambda (code context) (syntax-parse code #:literal-sets (cruft) - [(_ (#%parens arg:identifier ...) + [(_ name:identifier (#%parens (~seq arg:identifier (~optional honu-comma)) ...) + (#%braces code ...) . rest) + (values + #'(%racket (define (name arg ...) (parse-body code ...))) + #'rest + #f)] + [(_ (#%parens (~seq arg:identifier (~optional honu-comma)) ...) (#%braces code ...) . rest) (values diff --git a/collects/honu/core/private/parse2.rkt b/collects/honu/core/private/parse2.rkt index 3ed661a4d0..6c45f14a6b 100644 --- a/collects/honu/core/private/parse2.rkt +++ b/collects/honu/core/private/parse2.rkt @@ -371,6 +371,7 @@ (when (not (stx-null? unparsed)) (raise-syntax-error 'parse "found unparsed input" unparsed)) (values (parse-all #'(more ...)) #'rest)] + #; [(left:no-left function:honu-function . rest) (values #'function.result #'rest)] [else (syntax-parse #'head diff --git a/collects/tests/honu/check.rkt b/collects/tests/honu/check.rkt index 7027efabb2..99040a0d05 100644 --- a/collects/tests/honu/check.rkt +++ b/collects/tests/honu/check.rkt @@ -80,10 +80,10 @@ (test "function call" @input{ - foo(x){ + function foo(x){ x * 2 } - foo(5); + foo(5) } @output{10 diff --git a/collects/tests/honu/function.honu b/collects/tests/honu/function.honu index 307a30c441..acc5689fea 100644 --- a/collects/tests/honu/function.honu +++ b/collects/tests/honu/function.honu @@ -1,6 +1,7 @@ #lang honu - -foo(){ - 1 + 2 +function foo(x){ + 1 + x * 2 } + +foo(5) diff --git a/collects/tests/honu/linq.honu b/collects/tests/honu/linq.honu index 96866885f4..0ba4a8b404 100644 --- a/collects/tests/honu/linq.honu +++ b/collects/tests/honu/linq.honu @@ -19,18 +19,18 @@ class Xml(data){ getData(){ data } } -read_xml(){ +function read_xml(){ xml_permissive_xexprs(true) xml_xml_to_xexpr(xml_document_element(xml_read_xml())) } -loadXml(file){ +function loadXml(file){ withInputFromFile(file){ new Xml(read_xml()) } } -starts_with(start, what){ +function starts_with(start, what){ substring(what, 0, string_length(start)) string_equal start }