diff --git a/Content.Tests/DMProject/Tests/Statements/Switch/else_colon.dm b/Content.Tests/DMProject/Tests/Statements/Switch/else_colon.dm new file mode 100644 index 0000000000..aa821136f9 --- /dev/null +++ b/Content.Tests/DMProject/Tests/Statements/Switch/else_colon.dm @@ -0,0 +1,10 @@ +// RETURN TRUE + +/proc/RunTest() + var/foo = 5 + switch(foo) + if(2) + return FALSE + else: + return TRUE + return FALSE diff --git a/DMCompiler/Compiler/DM/DMParser.cs b/DMCompiler/Compiler/DM/DMParser.cs index 13b6841524..c8b41019c2 100644 --- a/DMCompiler/Compiler/DM/DMParser.cs +++ b/DMCompiler/Compiler/DM/DMParser.cs @@ -1547,6 +1547,8 @@ private DMASTProcStatementSwitch.SwitchCase[] SwitchInner() { return new DMASTProcStatementSwitch.SwitchCaseValues(expressions.ToArray(), body); } else if (Check(TokenType.DM_Else)) { + Whitespace(); + Check(TokenType.DM_Colon); // Someone wrote "else:" instead of "else" Whitespace(); var loc = Current().Location; if (Current().Type == TokenType.DM_If) {