mirror of
https://github.com/NixOS/nix.git
synced 2025-11-20 09:19:36 +01:00
* String interpolation. Expressions like
"--with-freetype2-library=" + freetype + "/lib"
can now be written as
"--with-freetype2-library=${freetype}/lib"
An arbitrary expression can be enclosed within ${...}, not just
identifiers.
* Escaping in string literals: \n, \r, \t interpreted as in C, any
other character following \ is interpreted as-is.
* Newlines are now allowed in string literals.
This commit is contained in:
parent
6cecad2be0
commit
0064599a27
7 changed files with 88 additions and 15 deletions
|
|
@ -71,9 +71,29 @@ const char * getPath(ParseData * data)
|
|||
return data->path.c_str();
|
||||
}
|
||||
|
||||
int yyparse(yyscan_t scanner, ParseData * data);
|
||||
Expr unescapeStr(const char * s)
|
||||
{
|
||||
string t;
|
||||
char c;
|
||||
while (c = *s++) {
|
||||
if (c == '\\') {
|
||||
assert(*s);
|
||||
c = *s++;
|
||||
if (c == 'n') t += "\n";
|
||||
else if (c == 'r') t += "\r";
|
||||
else if (c == 't') t += "\t";
|
||||
else t += c;
|
||||
}
|
||||
else t += c;
|
||||
}
|
||||
return makeStr(toATerm(t));
|
||||
}
|
||||
|
||||
int yyparse(yyscan_t scanner, ParseData * data);
|
||||
|
||||
|
||||
} /* end of C functions */
|
||||
|
||||
|
||||
static void checkAttrs(ATermMap & names, ATermList bnds)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue