<div dir="ltr"><span style="font-family:arial,sans-serif;font-size:13px">Silly me, I was trying (require syntax/parse). Thanks!</span><br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jun 17, 2014 at 1:26 PM, Stephen Chang <span dir="ltr"><<a href="mailto:stchang@ccs.neu.edu" target="_blank">stchang@ccs.neu.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hmm, you might need to provide some more details about what you are<br>
trying to define then? (This particular example seems to work with<br>
syntax-parse in TR)<br>
<br>
#lang typed/racket<br>
(require (for-syntax syntax/parse))<br>
<br>
(define-syntax (test stx)<br>
(syntax-parse stx #:datum-literals (in def)<br>
<div class=""> [(_ name<br>
(def a ...) ...<br>
(in clause do ...) ...)<br>
</div> #'(list a ... ... do ... ...)]))<br>
<div class="im HOEnZb"><br>
(test A (def 1 2 3) (in 4 5 6))<br>
<br>
</div><div class="HOEnZb"><div class="h5">On Tue, Jun 17, 2014 at 2:08 PM, Spencer Florence <<a href="mailto:spencer@florence.io">spencer@florence.io</a>> wrote:<br>
> Unfortunately I'm working in typed racket, which (as far as I can tell)<br>
> doesn't play nice with syntax-parse. Any other ideas?<br>
><br>
><br>
> On Tue, Jun 17, 2014 at 1:04 PM, Jens Axel Søgaard <<a href="mailto:jensaxel@soegaard.net">jensaxel@soegaard.net</a>><br>
> wrote:<br>
>><br>
>> Hi Spencer,<br>
>><br>
>> The problem is that syntax-case pattern doesn't allow allow<br>
>> pattern of the form (x ... y ...) that is with two ellipsis on the<br>
>> same level.<br>
>><br>
>> Luckily syntax-parse allow these:<br>
>><br>
>> (require syntax/parse)<br>
>><br>
>> (syntax-parse #'(a a a a 41 42 43)<br>
>> [(c ... d ...)<br>
>> #''((c ...) (d ...))])<br>
>><br>
>> (syntax-parse #'(a a a a 41 42 43)<br>
>> [(c:id ... d ...)<br>
>> #''((c ...) (d ...))])<br>
>><br>
>><br>
>> /Jens Axel<br>
>><br>
>><br>
>><br>
>><br>
>> 2014-06-17 19:46 GMT+02:00 Spencer Florence <<a href="mailto:florence@northwestern.edu">florence@northwestern.edu</a>>:<br>
>> > Hey all,<br>
>> ><br>
>> > I'm trying to write a macro with syntax-case that looks something like<br>
>> > this:<br>
>> ><br>
>> > (syntax-case stx (in def)<br>
>> > [(_ name<br>
>> > (def a ...) ...<br>
>> > (in clause do ...) ...)<br>
>> > stuff])<br>
>> ><br>
>> > But, this gives me the error "syntax-case: misplaced ellipsis in pattern<br>
>> > (follows other ellipsis)" on the last ellipsis. Does anyone know a way<br>
>> > around this?<br>
>> ><br>
>> > --spencer<br>
>> ><br>
>> > ____________________<br>
>> > Racket Users list:<br>
>> > <a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
>> ><br>
>><br>
>><br>
>><br>
>> --<br>
>> --<br>
>> Jens Axel Søgaard<br>
>><br>
>> ____________________<br>
>> Racket Users list:<br>
>> <a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
><br>
><br>
><br>
> ____________________<br>
> Racket Users list:<br>
> <a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
><br>
</div></div></blockquote></div><br></div>