From e2390521b589031a545f61324b136cc87799cfee Mon Sep 17 00:00:00 2001 From: Hackerpilot Date: Thu, 16 Apr 2015 12:14:39 -0700 Subject: [PATCH] Fix #128 --- src/dfmt/formatter.d | 3 ++- tests/allman/issue0128.d.ref | 5 +++++ tests/issue0128.d | 5 +++++ tests/otbs/issue0128.d.ref | 4 ++++ 4 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 tests/allman/issue0128.d.ref create mode 100644 tests/issue0128.d create mode 100644 tests/otbs/issue0128.d.ref diff --git a/src/dfmt/formatter.d b/src/dfmt/formatter.d index 1847cbc..d68e55e 100644 --- a/src/dfmt/formatter.d +++ b/src/dfmt/formatter.d @@ -154,7 +154,8 @@ private: { immutable t = tokens[index].type; if (t == tok!"identifier" || isStringLiteral(t) - || isNumberLiteral(t) || t == tok!"characterLiteral") + || isNumberLiteral(t) || t == tok!"characterLiteral" + || isKeyword(t)) write(" "); } } diff --git a/tests/allman/issue0128.d.ref b/tests/allman/issue0128.d.ref new file mode 100644 index 0000000..cba3197 --- /dev/null +++ b/tests/allman/issue0128.d.ref @@ -0,0 +1,5 @@ +unittest +{ + string[string] aa = ["a" : "b"]; + auto x = "a" in aa; +} diff --git a/tests/issue0128.d b/tests/issue0128.d new file mode 100644 index 0000000..96e718e --- /dev/null +++ b/tests/issue0128.d @@ -0,0 +1,5 @@ +unittest +{ + string[string] aa = ["a":"b"]; + auto x = "a" in aa; +} diff --git a/tests/otbs/issue0128.d.ref b/tests/otbs/issue0128.d.ref new file mode 100644 index 0000000..0b1261c --- /dev/null +++ b/tests/otbs/issue0128.d.ref @@ -0,0 +1,4 @@ +unittest { + string[string] aa = ["a" : "b"]; + auto x = "a" in aa; +}