language-c
Benedikt Huber
benedikt.huber at gmail.com
Sun Jan 25 09:41:24 EST 2009
Hi Joe,
I've done a rollback of yesterday's patch introducing the change to
Data.Position.
Are you fine now ?
As I said, the representation used at the moment isn't ideal either,
and the documentation
needs some updates.
I've also decided to create a mailing list on projects.haskell.org
right now, and will
cc discussions and release announcement there.
best regards,
benedikt
On 25.01.2009, at 14:41, Joe Thornber wrote:
> Hi Benedikt,
>
> I've been playing with the Haskell language-c library ,which is great,
> and was wondering if I could ask your advice on how to approach a
> problem I'm working on ?
>
> I'm writing a little program that will apply my employers archaic
> naming conventions to exiting C source code. So the plan was to parse
> the C files including pre-processing. Walk the AST generating a list
> of rename operations. Finally re-read the source and then apply the
> renaming ops.
>
> Of course there are complications applying the rename ops if a macro
> has been expanded on the line in question. But in general the
> 'posColumn' field of the identifier being renamed gave very useful
> information - even if it was just used as a starting point for a
> search.
>
> This worked pretty well with the Cabal version of language-c. I've
> just grabbed your latest and greatest via Darcs, and find that the
> posColumn now refers to the fileOffset, rather than offset within a
> line.
>
> So I guess there are a couple of questions ?
>
> i) In you comments in Position.hs you say the column field is
> meaningless because of #line directives. I don't quite understand
> this. True the column position refers to the pre-processed code - but
> why is it wrong? Surely #line directives don't make any difference ?
> ii) I think lineOffset is still useful information, so could we put an
> extra field into the Position for the fileOffset rather than stomping
> on the column field ? (I'm quite happy to do the coding for this).
>
> - Joe
More information about the Language-c
mailing list