[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [DotGNU]A request for help ... a mass effort

From: Rhys Weatherley
Subject: Re: [DotGNU]A request for help ... a mass effort
Date: Tue, 19 Nov 2002 21:40:22 +1000

James Michael DuPont wrote:

> >               yysetfilename(*parent, yygetfilename(node));
> >               yysetlinenum(*parent, yygetlinenum(node));
> Let me see if I understand you correctly.
> you want to add in the linenumbers and filenames to all the nodes.
> *parent is the name of the created node.

It isn't actually a parser issue.  The parser is pretty good
at assigning the correct line number to nodes as they are created.

The problem comes during semantic analysis.  Sometimes a node
needs to be replaced with another.  e.g. "ILNode_Add" is replaced
with "ILNode_UserBinaryOp" if the addition is used in a context
where a user-defined operator is involved.

When the replacement node is created, it is created with the current
filename and line number from the parser, which is usually miles away
from the node being replaced.  So it is necessary to "fix up" the
replacement node.  There are some places where the fixups may be

The C front-end has a function called "CGenCloneLine" which makes
the process a little easier, but it would certainly be nice to find
a better (yet simple) way of solving this problem.  Or simply track
down every place is semantic analysis where replacement nodes are
created and add a call to "CSCloneLine" or something.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]