From 24d78d886996ef55b71b90d7987d195d2f36c9fd Mon Sep 17 00:00:00 2001 From: Hackerpilot Date: Sun, 22 Feb 2015 01:04:00 -0800 Subject: [PATCH] Fix label formatting --- src/dfmt.d | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/dfmt.d b/src/dfmt.d index d53019a..e92e2bf 100644 --- a/src/dfmt.d +++ b/src/dfmt.d @@ -376,6 +376,12 @@ private: writeToken(); newline(); } + else if (peekBackIs(tok!"identifier") && (peekBack2Is(tok!";") + || peekBack2Is(tok!"}") || peekBack2Is(tok!"{"))) + { + writeToken(); + write(" "); + } else { write(" : "); @@ -771,6 +777,11 @@ private: return (index >= 1) && tokens[index - 1].type == tokenType; } + bool peekBack2Is(IdType tokenType) + { + return (index >= 2) && tokens[index - 2].type == tokenType; + } + bool peekImplementation(IdType tokenType, size_t n) { auto i = index + n;