D parsing

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon Nov 11 18:35:51 PST 2013


On 11/11/13 12:00 AM, Jacob Carlborg wrote:
> On 2013-11-11 02:54, Andrei Alexandrescu wrote:
>
>> What do you have in mind? I find it difficult to grab e.g. the file and
>> the line unless there's some plumbing in the language that allows you to.
>
> The language just need to provide a way to introspect the AST. If we're
> talking about a specific API I can think of something like this:
>
> macro foo (Context context, Ast!(string) str)
> {
>      auto line = context.caller.line;
>      auto file = context.caller.file;
> }
>
> foo("asd");

So... there is rote addition to the context.caller structure. It's just 
spelled differently. No?

Andrei




More information about the Digitalmars-d mailing list