From 0b4e630b8ca60747c19e23d6ce5d93d7144e10eb Mon Sep 17 00:00:00 2001 From: Jon Rafkind Date: Wed, 14 Sep 2011 16:07:18 -0600 Subject: [PATCH] [honu] return currently parsed form if a macro is seen --- collects/honu/core/private/parse2.rkt | 24 +++++++++++++----------- collects/tests/honu/linq.honu | 6 ++---- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/collects/honu/core/private/parse2.rkt b/collects/honu/core/private/parse2.rkt index 98fe79e107..bee6c93539 100644 --- a/collects/honu/core/private/parse2.rkt +++ b/collects/honu/core/private/parse2.rkt @@ -187,17 +187,19 @@ [(head rest ...) (cond [(honu-macro? #'head) - (begin - (debug "Honu macro ~a\n" #'head) - (let-values ([(parsed unparsed terminate?) - ((syntax-local-value #'head) #'(head rest ...) #f)]) - (with-syntax ([parsed parsed] - [rest unparsed]) - (if terminate? - (values (left #'parsed) - #'rest) - (do-parse #'rest precedence - left #'parsed)))))] + (if current + (values (left current) stream) + (begin + (debug "Honu macro ~a\n" #'head) + (let-values ([(parsed unparsed terminate?) + ((syntax-local-value #'head) #'(head rest ...) #f)]) + (with-syntax ([parsed parsed] + [rest unparsed]) + (if terminate? + (values (left #'parsed) + #'rest) + (do-parse #'rest precedence + left #'parsed))))))] [(parsed-syntax? #'head) (do-parse #'(rest ...) precedence left #'head)] [(honu-operator? #'head) diff --git a/collects/tests/honu/linq.honu b/collects/tests/honu/linq.honu index efd4c50991..3f27c29038 100644 --- a/collects/tests/honu/linq.honu +++ b/collects/tests/honu/linq.honu @@ -53,10 +53,8 @@ for add in addresses do { printf("name ~a address ~a\n", add.name, add.address); } -printf("+++\n"); for xs in linq from foo in xml.Descendants("Table1") - where starts_with("x", foo.Element("familyName").Value()) - select foo.Element("familyName").Value() do { + where starts_with("x", foo.Element("familyName").Value()) + select foo.Element("familyName").Value() do { printf("only x: ~a\n", xs) } -// printf("---\n");