Language-c patches (trivial)

Benedikt Huber benedikt.huber at gmail.com
Mon Jan 26 08:46:48 EST 2009


On 26.01.2009, at 11:52, Joe Thornber wrote:
> Hi Benedikt,
>
> I did some tinkering this morning.  Nothing radical, so I wont take
> offense if you don't merge it :)
Thank you, Joe !
Could you please pull the latest change (adds adjustPos to  
Data.Position) and send the
patches again - I had a conflict when trying to apply the patch.
The patches also need some small adjustments, I'll comment below.
Btw, Ive set up a mailing list (http://projects.haskell.org/cgi-bin/mailman/listinfo/language-c 
), so please CC
it, even if no one's listening but me ;)

benedikt

Comments to the patches:

[Position] Use a summation type for the various position types.
[Position] Use record syntax when defining Position

Yes, I was concerned about memory usage (Data.Position is used quite a  
lot), but I think you're right, it
won't make a big difference and its much clearer that way. Thanks !

[Ident] Replace an UNBOXED pragma with UNPACK

Oh, thanks for spotting this one. In 6.8 it is already called UNPACK,  
but the original code I'm using here
is from 1997 or so :)

[TravMonad] Remove deprecated PatternSignatures language option
No, I want to stay compatible with 6.8 for now.

[Position] documentation
[Position, Lexer] Don't export any constructors for Position

Ok fine, but I'm not so happy with incRow - rather use adjustPos.
There is an mistake in the lexer:

-alexMove pos '\r' = incRow pos

should be replaced by

Lexer.x:
   alexMove pos '\r' = incOffset pos 1
Position.hs:
   {-# INLINE incOffset #-}
   -- | advanced offset in the input stream, without changing line or  
column
   incOffset :: Position -> Int -> Position
   incOffset (Position offs fname row col) x = Position (offs + x)  
fname row col
   incOffset p _ = p





More information about the Language-c mailing list