Adding a '(provide type)' in expander.rkt (where 'line' is defined) gets me 
past this error. Strangely, providing 'compare' or 'offset' doesn't seem to 
be necessary. I'm interested in any theories as to why this might be the 
case.

Thanks for your help.

-- Jonathan

On Sunday, December 30, 2018 at 5:14:38 PM UTC-5, Jens Axel Søgaard wrote:
>
> Den søn. 30. dec. 2018 kl. 22.33 skrev Jonathan Simpson <jjsi...@gmail.com 
> <javascript:>>:
>
>> On Sunday, December 30, 2018 at 3:58:50 PM UTC-5, Jens Axel Søgaard wrote:
>>
>>> The error
>>>
>>>     line: bad syntax
>>>     (line (offset 0) (type (string8 "string")) (test (strtest "MZ")))
>>>
>>> means that the macro `line` doesn't have a clause that matches the input.
>>>
>>> How is line defined?
>>>
>>> /Jens Axel
>>>
>>
>> (define-syntax line
>>   (syntax-rules (offset type test message)
>>     [(line (offset off) (type type-expr) (test test-expr)) 
>>      (magic-test (offset off) (type (quote type-expr) (quote test-expr)) 
>> (compare (quote test-expr)))]
>>     [(line (offset off) (type type-expr) (test test-expr) (message msg)) 
>>      (magic-test (offset off) (type (quote type-expr) (quote test-expr)) 
>> (compare (quote test-expr)) msg)]))
>>
>> This is defined in my expander, and it seems to work from the REPL with 
>> expander.rkt loaded.
>>
>
> Try adding a clause:
>  
> (define-syntax line
>   (syntax-rules (offset type test message)
>     [(line (offset off) (type type-expr) (test test-expr)) 
>      (magic-test (offset off) (type (quote type-expr) (quote test-expr)) 
> (compare (quote test-expr)))]
>     [(line (offset off) (type type-expr) (test test-expr) (message msg)) 
>      (magic-test (offset off) (type (quote type-expr) (quote test-expr)) 
> (compare (quote test-expr)) msg)]
>     [_ "no clause found in line"]))
>
> If you get the string instead of the "bad syntax" we know that something 
> unexpected happened.
>
> I am guessing it has "something" to do with either offset, type, test or 
> message which
> will only match in syntax-rules, if the context is correct.
>
> /Jens Axel
>
>
>  
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to