[plt-dev] at-exp and whitespace
I have a C parser that I would like to integrate with the at-exp
reader so you can write things like
#lang at-exp scheme/base
...
(define decls
@declaration-list{
typedef int foo;
typedef char bar;
})
There's a subtle pitfall: if you insert whitespace between
@declaration-list and the first curly brace (which is very tempting,
given traditional C style), it reads as
(define decls declaration-list {typedef int foo typedef char bar})
which is then a syntax error with `define'. There doesn't seem to be
any way that the `declaration-list' macro can defend against this with
a clearer error message.
As a compromise, would it make sense for the at-exp reader to turn off
`read-curly-brace-as-paren' so that wherever an accidentally orphaned
curly-brace argument appears, it can produce a more localized error?
It's not a perfect solution, but curly braces are pretty rarely used
as an S-expression delimiter so it might not be too bad of a compromise.
Dave