From 7d1f4d1dff41c1a4015668395a4516264c42dba7 Mon Sep 17 00:00:00 2001 From: Quahu Date: Sat, 24 Mar 2018 01:22:25 +0100 Subject: [PATCH 1/2] Smh, Finitey --- src/Discord.Net.Commands/CommandParser.cs | 48 +++++++++++------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/src/Discord.Net.Commands/CommandParser.cs b/src/Discord.Net.Commands/CommandParser.cs index d65d99349..ffbf1ea93 100644 --- a/src/Discord.Net.Commands/CommandParser.cs +++ b/src/Discord.Net.Commands/CommandParser.cs @@ -33,30 +33,6 @@ namespace Discord.Commands else c = '\0'; - //If this character is escaped, skip it - if (isEscaping) - { - if (curPos != endPos) - { - argBuilder.Append(c); - isEscaping = false; - continue; - } - } - //Are we escaping the next character? - if (c == '\\' && (curParam == null || !curParam.IsRemainder)) - { - isEscaping = true; - continue; - } - - //If we're processing an remainder parameter, ignore all other logic - if (curParam != null && curParam.IsRemainder && curPos != endPos) - { - argBuilder.Append(c); - continue; - } - //If we're not currently processing one, are we starting the next argument yet? if (curPart == ParserPart.None) { @@ -83,6 +59,30 @@ namespace Discord.Commands } } + //If this character is escaped, skip it + if (isEscaping) + { + if (curPos != endPos) + { + argBuilder.Append(c); + isEscaping = false; + continue; + } + } + //Are we escaping the next character? + if (c == '\\' && (curParam == null || !curParam.IsRemainder)) + { + isEscaping = true; + continue; + } + + //If we're processing a remainder parameter, ignore all other logic + if (curParam != null && curParam.IsRemainder && curPos != endPos) + { + argBuilder.Append(c); + continue; + } + //Has this parameter ended yet? string argString = null; if (curPart == ParserPart.Parameter) From 7457847489cc6026d2304cc43554685f37ddd354 Mon Sep 17 00:00:00 2001 From: Quahu Date: Sun, 1 Apr 2018 00:28:11 +0200 Subject: [PATCH 2/2] I broke it even more with this PR, lol Remainder parameters weren't parsed properly. --- src/Discord.Net.Commands/CommandParser.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Discord.Net.Commands/CommandParser.cs b/src/Discord.Net.Commands/CommandParser.cs index ffbf1ea93..1d09a8b4b 100644 --- a/src/Discord.Net.Commands/CommandParser.cs +++ b/src/Discord.Net.Commands/CommandParser.cs @@ -33,6 +33,13 @@ namespace Discord.Commands else c = '\0'; + //If we're processing a remainder parameter, ignore all other logic + if (curParam != null && curParam.IsRemainder && curPos != endPos) + { + argBuilder.Append(c); + continue; + } + //If we're not currently processing one, are we starting the next argument yet? if (curPart == ParserPart.None) { @@ -76,13 +83,6 @@ namespace Discord.Commands continue; } - //If we're processing a remainder parameter, ignore all other logic - if (curParam != null && curParam.IsRemainder && curPos != endPos) - { - argBuilder.Append(c); - continue; - } - //Has this parameter ended yet? string argString = null; if (curPart == ParserPart.Parameter)