Backslash escaping weirdness

Nicholas Wilson via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Feb 29 20:18:11 PST 2016


line 620:
for(auto i = 1; i < pits3.length - 2; i++)
  {
       f.write(params3[i].fixup_T,"\t", pits3[i],",");
}
f.write(params3[$-2].fixup_T,"\t", pits3[$-1]);
f.write(")\n\t\t{typeof(return) _p;\n\t\t", m2,"(",mainVarName);
for(auto i = 1; i < pits3.length - 2; i++)
{
       f.write(",",pits3[i]);
}
f.write(",&_p);\n\t\treturn _p;}");

params3 and pits3 are both string[]s length equal and length > 3
fixup_T is a string function(string)

gives a bunch of errors
source/app.d(622): Error: character '\' is not a valid token
source/app.d(622): Error: found 't' when expecting ','
source/app.d(624): Error: character '\' is not a valid token
source/app.d(624): Error: found 't' when expecting ','
source/app.d(625): Error: character '\' is not a valid token
source/app.d(625): Error: found 'n' when expecting ';' following 
statement
source/app.d(625): Error: character '\' is not a valid token
source/app.d(625): Error: character '\' is not a valid token
source/app.d(625): Error: semicolon expected, not '{'
source/app.d(625): Error: character '\' is not a valid token
source/app.d(625): Error: character '\' is not a valid token
source/app.d(625): Error: character '\' is not a valid token
source/app.d(625): Error: found 't' when expecting ';' following 
statement
source/app.d(625): Error: found '", m2,"' when expecting ';' 
following statement
source/app.d(630): Error: character '\' is not a valid token
source/app.d(630): Error: character '\' is not a valid token
source/app.d(630): Error: character '\' is not a valid token
source/app.d(630): Error: found 't' when expecting ';' following 
statement
source/app.d(637): Error: character '\' is not a valid token
source/app.d(637): Error: found 'n' when expecting ';' following 
statement

What is causing these errors? I'm using \t and \n in string all 
over the place and they work.
$dmd
DMD64 D Compiler v2.070-devel-5123284



More information about the Digitalmars-d-learn mailing list