1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 23:11:16 +02:00

* Store attribute positions in the AST and report duplicate attribute

errors with position info.
* For all positions, use the position of the first character of the
  first token, rather than the last character of the first token plus
  one.
This commit is contained in:
Eelco Dolstra 2010-05-06 16:46:48 +00:00
parent c82782f9a5
commit 84ce7ac76f
6 changed files with 56 additions and 56 deletions

View file

@ -23,8 +23,13 @@ struct Pos
{
string file;
unsigned int line, column;
Pos() : line(0), column(0) { };
Pos(const string & file, unsigned int line, unsigned int column)
: file(file), line(line), column(column) { };
};
extern Pos noPos;
std::ostream & operator << (std::ostream & str, const Pos & pos);
@ -125,10 +130,11 @@ struct ExprOpHasAttr : Expr
struct ExprAttrs : Expr
{
bool recursive;
typedef std::map<Symbol, Expr *> Attrs;
typedef std::pair<Expr *, Pos> Attr;
typedef std::map<Symbol, Attr> Attrs;
Attrs attrs;
list<VarRef> inherited;
set<Symbol> attrNames; // used during parsing
std::map<Symbol, Pos> attrNames; // used during parsing
ExprAttrs() : recursive(false) { };
COMMON_METHODS
};