Skip to content
This repository has been archived by the owner on Feb 12, 2018. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Various bug fixes with legacy code conversion.
  • Loading branch information
Paris committed Feb 20, 2010
1 parent 094fb13 commit 085e2ac
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions Scripting/Parser/Helpers/Translate.cs
Expand Up @@ -35,6 +35,9 @@ void Translate(ref string code)

string[] parts = SplitCommandParameters(param);

if (parts.Length > 0)
parts[parts.Length - 1] = StripCommentSingle(parts[parts.Length - 1]);

for (int i = 0; i < parts.Length; i++)
{
if (IsExpressionParameter(parts[i]))
Expand All @@ -59,9 +62,6 @@ void Translate(ref string code)
}
}

if (parts.Length > 0)
parts[parts.Length - 1] = StripCommentSingle(parts[parts.Length - 1]);

#endregion

switch (cmd.ToLowerInvariant())
Expand Down Expand Up @@ -100,8 +100,8 @@ void Translate(ref string code)
case "settitlematchmode":
case "setwindelay":
case "setworkingdir":
replaced.Append("A_");
replaced.Append(cmd, 3, cmd.Length - 3);
replaced.Append(AssignPre);
replaced.Append(Equal);
replaced.Append(param);
break;
Expand All @@ -112,7 +112,6 @@ void Translate(ref string code)
case "stringcasesense":
replaced.Append("A_");
replaced.Append(cmd);
replaced.Append(AssignPre);
replaced.Append(Equal);
replaced.Append(param);
break;
Expand Down Expand Up @@ -255,9 +254,11 @@ void Translate(ref string code)
throw new ParseException(ExTooFewParams);
replaced.Append(FlowIf);
replaced.Append(SingleSpace);
replaced.Append(ParenOpen);
replaced.Append("A_MsgBox");
replaced.Append(Equal);
replaced.Append(parts[0]);
replaced.Append(ParenClose);
break;

case "ifwinactive":
Expand All @@ -271,7 +272,8 @@ void Translate(ref string code)
replaced.Append(part);
replaced.Append(Multicast);
}
replaced.Remove(replaced.Length - 1, 1);
if (parts.Length > 1)
replaced.Remove(replaced.Length - 1, 1);
replaced.Append(ParenClose, 2);
break;

Expand All @@ -286,7 +288,8 @@ void Translate(ref string code)
replaced.Append(part);
replaced.Append(Multicast);
}
replaced.Remove(replaced.Length - 1, 1);
if (parts.Length > 1)
replaced.Remove(replaced.Length - 1, 1);
replaced.Append(ParenClose, 2);
break;

Expand All @@ -302,7 +305,8 @@ void Translate(ref string code)
replaced.Append(part);
replaced.Append(Multicast);
}
replaced.Remove(replaced.Length - 1, 1);
if (parts.Length > 1)
replaced.Remove(replaced.Length - 1, 1);
replaced.Append(ParenClose, 2);
break;

Expand All @@ -318,7 +322,8 @@ void Translate(ref string code)
replaced.Append(part);
replaced.Append(Multicast);
}
replaced.Remove(replaced.Length - 1, 1);
if (parts.Length > 1)
replaced.Remove(replaced.Length - 1, 1);
replaced.Append(ParenClose, 2);
break;

Expand Down

0 comments on commit 085e2ac

Please sign in to comment.