1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-29 06:21:14 +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

@ -19,13 +19,16 @@ namespace nix {
static void initLoc(YYLTYPE * loc)
{
loc->first_line = 1;
loc->first_column = 1;
loc->first_line = loc->last_line = 1;
loc->first_column = loc->last_column = 1;
}
static void adjustLoc(YYLTYPE * loc, const char * s, size_t len)
{
loc->first_line = loc->last_line;
loc->first_column = loc->last_column;
while (len--) {
switch (*s++) {
case '\r':
@ -33,11 +36,11 @@ static void adjustLoc(YYLTYPE * loc, const char * s, size_t len)
s++;
/* fall through */
case '\n':
++loc->first_line;
loc->first_column = 1;
++loc->last_line;
loc->last_column = 1;
break;
default:
++loc->first_column;
++loc->last_column;
}
}
}