[Nix-dev] More error locations - nixexpr-ast.def ..

Eelco Dolstra eelco at cs.uu.nl
Tue Jul 24 22:38:48 CEST 2007


Hi,

Marc Weber wrote:

> I've choosen to make some difference between
>   a) noPos (no position can be given/ is implemented)
>   b) position is omitted for efficiency (sharing etc)
>      the option to enable is called
> 
>        bool moreErrorLocations
> 
>       and I've put it into globals.{hh,c}
> 
>       I'm not sure wether this is the perfect place to put it?
> 
> nixexpr-ast.def:
>     Pos | string int int | Pos |
>     NoPos | | Pos |
>   + OmittedPosForSpeedReasons | | Pos |
> 
> In parser.c:
>   + #define CUR_POS makeCurPos(yylocp, data)
>     #define CUR_POS_MORE ( moreErrorLocations ? CUR_POS : makeOmittedPosForSpeedReasons() )
> 
> 
> My trouble now is that when not enabling the extension I'm getting this
> error message:
>   error: position expected, in `OmittedPosForSpeedReasons'

This happens in showPos() in nixexpr.cc.  The OmittedPosForSpeedReasons (please
change to a shorter name like OmittedPos :-) ) should be handled there as well
e.g. by returning something like "unknown position (pass --more-error-locations
to see it)".

-- 
Eelco Dolstra | http://www.cs.uu.nl/~eelco



More information about the nix-dev mailing list