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;