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:
parent
c82782f9a5
commit
84ce7ac76f
6 changed files with 56 additions and 56 deletions
|
@ -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
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue