On 02/05/2013 03:14 PM, Jacob Carlborg wrote:
On 2013-02-05 01:29, Timon Gehr wrote:
Well, ideally something like
ast.match{
2*(?a) => a+a,
(?a)+2 => 2+a,
(?e) => e,
}
When I think about it, it can't look like that. What's passed to a macro
needs to be syntactically valid.
I'd prefer if it needn't be.
macro match(Context context, Ast ast, string code){
...
if(...) context.error("invalid syntax", code[a..b]);
// (slice of code describes exact location where error
// is shown to user at the call site.)
...
}