mirror of
https://github.com/NixOS/nix
synced 2025-07-02 05:11:47 +02:00
* Handle carriage returns. Fixes NIX-53.
This commit is contained in:
parent
bfe19b3c37
commit
2670642733
2 changed files with 14 additions and 5 deletions
|
@ -21,6 +21,10 @@ static void adjustLoc(YYLTYPE * loc, const char * s, size_t len)
|
|||
{
|
||||
while (len--) {
|
||||
switch (*s++) {
|
||||
case '\r':
|
||||
if (*s == '\n') /* cr/lf */
|
||||
s++;
|
||||
/* fall through */
|
||||
case '\n':
|
||||
++loc->first_line;
|
||||
loc->first_column = 1;
|
||||
|
@ -85,8 +89,8 @@ inherit { return INHERIT; }
|
|||
{PATH} { yylval->t = toATerm(yytext); return PATH; /* !!! alloc */ }
|
||||
{URI} { yylval->t = toATerm(yytext); return URI; /* !!! alloc */ }
|
||||
|
||||
[ \t\n]+ /* eat up whitespace */
|
||||
\#[^\n]* /* single-line comments */
|
||||
[ \t\r\n]+ /* eat up whitespace */
|
||||
\#[^\r\n]* /* single-line comments */
|
||||
\/\*([^*]|\*[^\/])*\*\/ /* long comments */
|
||||
|
||||
. return yytext[0];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue