www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Backslash escaping weirdness

reply Nicholas Wilson <iamthewilsonator hotmail.com> writes:
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
Feb 29 2016
parent reply Adam D. Ruppe <destructionator gmail.com> writes:
On Tuesday, 1 March 2016 at 04:18:11 UTC, Nicholas Wilson wrote:
 What is causing these errors? I'm using \t and \n in string all 
 over the place and they work.
I don't think there's enough context to know for sure... but my guess is you forgot to close one of the quotes a couple lines above. So look up for an unpaired "
Feb 29 2016
parent reply Nicholas Wilson <iamthewilsonator hotmail.com> writes:
On Tuesday, 1 March 2016 at 04:48:01 UTC, Adam D. Ruppe wrote:
 On Tuesday, 1 March 2016 at 04:18:11 UTC, Nicholas Wilson wrote:
 What is causing these errors? I'm using \t and \n in string 
 all over the place and they work.
I don't think there's enough context to know for sure... but my guess is you forgot to close one of the quotes a couple lines above. So look up for an unpaired "
It was. Thanks.
Feb 29 2016
parent Marco Leise <Marco.Leise gmx.de> writes:
Am Tue, 01 Mar 2016 05:14:13 +0000
schrieb Nicholas Wilson <iamthewilsonator hotmail.com>:

 On Tuesday, 1 March 2016 at 04:48:01 UTC, Adam D. Ruppe wrote:
 On Tuesday, 1 March 2016 at 04:18:11 UTC, Nicholas Wilson wrote:
 What is causing these errors? I'm using \t and \n in string 
 all over the place and they work.
I don't think there's enough context to know for sure... but my guess is you forgot to close one of the quotes a couple lines above. So look up for an unpaired "
It was. Thanks.
And then God created syntax highlighting and He saw that it was good. ;) -- Marco
Mar 05 2016