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

Commit

Permalink
Added #Delimiter.
Browse files Browse the repository at this point in the history
Reported by derRaphael on IRC.
  • Loading branch information
Paris committed Oct 31, 2010
1 parent d7d367f commit 310576b
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 10 deletions.
6 changes: 3 additions & 3 deletions Scripting/Generator/Emission/Expression.cs
Expand Up @@ -128,7 +128,7 @@ void EmitInvoke(CodeMethodInvokeExpression invoke)
first = false;
else
{
writer.Write(Parser.Multicast);
writer.Write(Parser.DefaultMulticast);
writer.Write(Parser.SingleSpace);
}

Expand Down Expand Up @@ -165,7 +165,7 @@ void EmitInvoke(CodeMethodInvokeExpression invoke)
depth++;
if (i > 0)
{
writer.Write(Parser.Multicast);
writer.Write(Parser.DefaultMulticast);
writer.Write(Parser.SingleSpace);
}
EmitExpression(invoke.Parameters[i]);
Expand Down Expand Up @@ -272,7 +272,7 @@ void EmitArray(CodeArrayCreateExpression array)
first = false;
else
{
writer.Write(Parser.Multicast);
writer.Write(Parser.DefaultMulticast);
writer.Write(Parser.SingleSpace);
}
EmitExpression(expr);
Expand Down
2 changes: 1 addition & 1 deletion Scripting/Generator/Emission/Members.cs
Expand Up @@ -36,7 +36,7 @@ void EmitMethod(CodeMemberMethod method)
if (first)
first = false;
else
writer.Write(Parser.Multicast);
writer.Write(Parser.DefaultMulticast);

}

Expand Down
4 changes: 4 additions & 0 deletions Scripting/Parser/Construct/Directive.cs
Expand Up @@ -141,6 +141,10 @@ void ParseDirective(string code)
Escape = parts[1][0];
break;

case "DELIMITER":
Multicast = parts[1][0];
break;

case "HOTSTRING":
HotstringNewOptions = parts[1];
break;
Expand Down
3 changes: 1 addition & 2 deletions Scripting/Parser/Construct/Expressions/Texts.cs
Expand Up @@ -189,7 +189,6 @@ List<object> SplitTokens(string code)
case Less:
case BitXOR:
case BitOR:
case Multicast:
case ParenOpen:
case ParenClose:
case Equal:
Expand Down Expand Up @@ -235,7 +234,7 @@ List<object> SplitTokens(string code)
break;

default:
if (sym == Resolve)
if (sym == Resolve || sym == Multicast)
goto case Add;
throw new ParseException(ExUnexpected);
}
Expand Down
7 changes: 6 additions & 1 deletion Scripting/Parser/Symbols.cs
Expand Up @@ -31,7 +31,6 @@ partial class Parser
internal const char TernaryB = ':';
internal const char HotkeyBound = ':';
internal const string HotkeySignal = "::";
internal const char Multicast = ',';
internal const char Directive = '#';

#if !LEGACY
Expand All @@ -41,6 +40,7 @@ partial class Parser
internal const char DefaultEscpe = '`';
internal const char DefaultComment = ';';
internal const char DefaultResolve = '%';
internal const char DefaultMulticast = ',';

#if !LEGACY
const
Expand All @@ -57,6 +57,11 @@ partial class Parser
#endif
internal char Resolve = DefaultResolve;

#if !LEGACY
const
#endif
internal char Multicast = DefaultMulticast;

#if LEGACY
internal const string VarExt = "#_@$?"; // []
#endif
Expand Down
6 changes: 5 additions & 1 deletion Scripting/Parser/Texts/Line.cs
Expand Up @@ -38,7 +38,6 @@ bool IsContinuationLine(string code)
case Concatenate:
case Equal:
case TernaryA:
case Multicast:
case Not:
case BitNOT:
case BitXOR:
Expand All @@ -62,6 +61,11 @@ bool IsContinuationLine(string code)
if (code.Length > 1 && code[1] == Equal)
return true;
return !(code.Length > 1 && !IsSpace(code[1]));

default:
if (code[0] == Multicast)
goto case Divide;
break;
}

if (code.Length >= AndTxt.Length && code.Substring(0, AndTxt.Length).Equals(AndTxt, StringComparison.OrdinalIgnoreCase))
Expand Down
4 changes: 2 additions & 2 deletions Scripting/Script/Conversion.cs
Expand Up @@ -148,7 +148,7 @@ public static string ForceString(object input)
if (first)
first = false;
else
buffer.Append(Parser.Multicast);
buffer.Append(Parser.DefaultMulticast);

buffer.Append(Parser.StringBound);
buffer.Append(ForceString(key));
Expand Down Expand Up @@ -187,7 +187,7 @@ public static string ForceString(object input)
if (first)
first = false;
else
buffer.Append(Parser.Multicast);
buffer.Append(Parser.DefaultMulticast);

buffer.Append(ForceString(item));
}
Expand Down

0 comments on commit 310576b

Please sign in to comment.