Bug in NodeInfo for CTranslUnit
Erik de Castro Lopo
mle+hs at mega-nerd.com
Thu Feb 26 05:50:13 EST 2009
Benedikt Huber wrote:
> Well, I'm not a big fan of ugly hacks in the already contrived Lexer/
> Parser modules, but maybe we can find a sufficiently beautiful
> solution ;)
Well for now, I'm using the following (don't laugh, I'm new to
Haskell :-) ).
Cheers,
Erik
cleanTop :: String -> CTranslUnit -> CTranslUnit
cleanTop fileName (CTranslUnit list ni) =
if (posFile $ posOf ni) == fileName
then (CTranslUnit list ni)
else (CTranslUnit list (fixFileName ni))
where
fixFileName (NodeInfo p pl n) =
NodeInfo pos pl n
where
pos = p { posOffset = 0, posFile = fileName, posRow = 0 }
fixFileName x = x
--
-----------------------------------------------------------------
Erik de Castro Lopo
-----------------------------------------------------------------
"Lumping configuration data, security data, kernel tuning parameters,
etc. into one monstrous fragile binary data structure is really dumb."
- David F. Skoll
More information about the Language-c
mailing list