diff --git a/CHANGELOG.md b/CHANGELOG.md
index c3008abe3..71ce258fc 100755
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,11 @@
# Change Log
+## [0.16.2](https://github.com/nicklockwood/SwiftFormat/releases/tag/0.16.2) (2016-11-03)
+
+- Fixed bug with spacing of deeply nested generic arguments, or generic operator functions
+- Fixed spacing of `@autoclosure(escaping)` syntax (only used in Swift 2.2)
+- Fixed bug where `(Void) throws -> Void` was handled incorrectly
+
## [0.16.1](https://github.com/nicklockwood/SwiftFormat/releases/tag/0.16.1) (2016-11-03)
- Fixed critical bug where `redundantParens` would remove parens from tuple in `switch` condition
diff --git a/CommandLineTool/main.swift b/CommandLineTool/main.swift
index dbd0632f1..c5ee9ac5b 100644
--- a/CommandLineTool/main.swift
+++ b/CommandLineTool/main.swift
@@ -2,7 +2,7 @@
// main.swift
// SwiftFormat
//
-// Version 0.16.1
+// Version 0.16.2
//
// Created by Nick Lockwood on 12/08/2016.
// Copyright 2016 Nick Lockwood
@@ -33,7 +33,7 @@
import Foundation
-let version = "0.16.1"
+let version = "0.16.2"
let arguments = [
"output",
diff --git a/CommandLineTool/swiftformat b/CommandLineTool/swiftformat
index b319f56c0..883e73ba7 100755
Binary files a/CommandLineTool/swiftformat and b/CommandLineTool/swiftformat differ
diff --git a/EditorExtension/Application/Info.plist b/EditorExtension/Application/Info.plist
index 0ad22ee76..50a122d8a 100644
--- a/EditorExtension/Application/Info.plist
+++ b/EditorExtension/Application/Info.plist
@@ -17,7 +17,7 @@
CFBundlePackageType
APPL
CFBundleShortVersionString
- 0.16.1
+ 0.16.2
CFBundleVersion
$(CURRENT_PROJECT_VERSION)
LSMinimumSystemVersion
diff --git a/EditorExtension/Extension/CommandErrors.swift b/EditorExtension/Extension/CommandErrors.swift
index 58179909d..30c44dfdd 100644
--- a/EditorExtension/Extension/CommandErrors.swift
+++ b/EditorExtension/Extension/CommandErrors.swift
@@ -2,7 +2,7 @@
// CommandErrors.swift
// Swift Formatter
//
-// Version 0.16.1
+// Version 0.16.2
//
// Created by Tony Arnold on 6/10/16.
// Copyright 2016 Nick Lockwood
diff --git a/EditorExtension/Extension/FormatEntireFileCommand.swift b/EditorExtension/Extension/FormatEntireFileCommand.swift
index e9ddb83c3..4d3e06d9e 100644
--- a/EditorExtension/Extension/FormatEntireFileCommand.swift
+++ b/EditorExtension/Extension/FormatEntireFileCommand.swift
@@ -2,7 +2,7 @@
// FormatEntireFileCommand.swift
// Swift Formatter
//
-// Version 0.16.1
+// Version 0.16.2
//
// Created by Tony Arnold on 5/10/16.
// Copyright 2016 Nick Lockwood
diff --git a/EditorExtension/Extension/FormatSelectedSourceCommand.swift b/EditorExtension/Extension/FormatSelectedSourceCommand.swift
index db29c5f14..6fe4f1c74 100644
--- a/EditorExtension/Extension/FormatSelectedSourceCommand.swift
+++ b/EditorExtension/Extension/FormatSelectedSourceCommand.swift
@@ -2,7 +2,7 @@
// FormatSelectedSourceCommand.swift
// Swift Formatter
//
-// Version 0.16.1
+// Version 0.16.2
//
// Created by Tony Arnold on 5/10/16.
// Copyright 2016 Nick Lockwood
diff --git a/EditorExtension/Extension/Info.plist b/EditorExtension/Extension/Info.plist
index 8af7399d4..2a9b1bbab 100644
--- a/EditorExtension/Extension/Info.plist
+++ b/EditorExtension/Extension/Info.plist
@@ -15,7 +15,7 @@
CFBundlePackageType
XPC!
CFBundleShortVersionString
- 0.16.1
+ 0.16.2
CFBundleVersion
$(CURRENT_PROJECT_VERSION)
LSMinimumSystemVersion
diff --git a/EditorExtension/Extension/SourceEditorExtension.swift b/EditorExtension/Extension/SourceEditorExtension.swift
index 38d757278..ad104ac20 100644
--- a/EditorExtension/Extension/SourceEditorExtension.swift
+++ b/EditorExtension/Extension/SourceEditorExtension.swift
@@ -2,7 +2,7 @@
// SourceEditorExtension.swift
// Swift Formatter
//
-// Version 0.16.1
+// Version 0.16.2
//
// Created by Tony Arnold on 5/10/16.
// Copyright 2016 Nick Lockwood
diff --git a/EditorExtension/Extension/XCSourceTextBuffer+SwiftFormat.swift b/EditorExtension/Extension/XCSourceTextBuffer+SwiftFormat.swift
index e6a4efc87..080a541a3 100644
--- a/EditorExtension/Extension/XCSourceTextBuffer+SwiftFormat.swift
+++ b/EditorExtension/Extension/XCSourceTextBuffer+SwiftFormat.swift
@@ -2,7 +2,7 @@
// XCSourceTextBuffer+SwiftFormat.swift
// SwiftFormat
//
-// Version 0.16.1
+// Version 0.16.2
//
// Created by Nick Lockwood on 21/10/2016.
// Copyright © 2016 Nick Lockwood. All rights reserved.
diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftAppKit.dylib b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftAppKit.dylib
index 917c5af98..e4c520ebe 100755
Binary files a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftAppKit.dylib and b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftAppKit.dylib differ
diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftCore.dylib b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftCore.dylib
index 7bb263ddc..cd4cf2ebd 100755
Binary files a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftCore.dylib and b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftCore.dylib differ
diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftCoreData.dylib b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftCoreData.dylib
index 41d5599ae..e80331d13 100755
Binary files a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftCoreData.dylib and b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftCoreData.dylib differ
diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftCoreGraphics.dylib b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftCoreGraphics.dylib
index 37d19308a..8e4f0fdb3 100755
Binary files a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftCoreGraphics.dylib and b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftCoreGraphics.dylib differ
diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftCoreImage.dylib b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftCoreImage.dylib
index 121480fb5..43d980c9a 100755
Binary files a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftCoreImage.dylib and b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftCoreImage.dylib differ
diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftDarwin.dylib b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftDarwin.dylib
index e5482525d..86a4c3f9c 100755
Binary files a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftDarwin.dylib and b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftDarwin.dylib differ
diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftDispatch.dylib b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftDispatch.dylib
index 3b0753808..b4392de17 100755
Binary files a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftDispatch.dylib and b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftDispatch.dylib differ
diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftFoundation.dylib b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftFoundation.dylib
index 876b678cb..c15168bdf 100755
Binary files a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftFoundation.dylib and b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftFoundation.dylib differ
diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftIOKit.dylib b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftIOKit.dylib
index 50f8976d7..2d1ca76d1 100755
Binary files a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftIOKit.dylib and b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftIOKit.dylib differ
diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftObjectiveC.dylib b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftObjectiveC.dylib
index 841d48498..bd9a5eb1b 100755
Binary files a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftObjectiveC.dylib and b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftObjectiveC.dylib differ
diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftQuartzCore.dylib b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftQuartzCore.dylib
index f932b87f6..eaef6ea05 100755
Binary files a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftQuartzCore.dylib and b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftQuartzCore.dylib differ
diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftSwiftOnoneSupport.dylib b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftSwiftOnoneSupport.dylib
index 842c63ef3..5fed42503 100755
Binary files a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftSwiftOnoneSupport.dylib and b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftSwiftOnoneSupport.dylib differ
diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftXPC.dylib b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftXPC.dylib
index 8195b872e..ecdc96556 100755
Binary files a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftXPC.dylib and b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftXPC.dylib differ
diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/Info.plist b/EditorExtension/SwiftFormat for Xcode.app/Contents/Info.plist
index 7c01c12ec..02048083f 100644
--- a/EditorExtension/SwiftFormat for Xcode.app/Contents/Info.plist
+++ b/EditorExtension/SwiftFormat for Xcode.app/Contents/Info.plist
@@ -17,7 +17,7 @@
CFBundlePackageType
APPL
CFBundleShortVersionString
- 0.16.1
+ 0.16.2
CFBundleSupportedPlatforms
MacOSX
diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/MacOS/SwiftFormat for Xcode b/EditorExtension/SwiftFormat for Xcode.app/Contents/MacOS/SwiftFormat for Xcode
index ade362c07..cef85d522 100755
Binary files a/EditorExtension/SwiftFormat for Xcode.app/Contents/MacOS/SwiftFormat for Xcode and b/EditorExtension/SwiftFormat for Xcode.app/Contents/MacOS/SwiftFormat for Xcode differ
diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/PlugIns/SwiftFormat.appex/Contents/Info.plist b/EditorExtension/SwiftFormat for Xcode.app/Contents/PlugIns/SwiftFormat.appex/Contents/Info.plist
index f214a20c6..9341cc83f 100644
--- a/EditorExtension/SwiftFormat for Xcode.app/Contents/PlugIns/SwiftFormat.appex/Contents/Info.plist
+++ b/EditorExtension/SwiftFormat for Xcode.app/Contents/PlugIns/SwiftFormat.appex/Contents/Info.plist
@@ -17,7 +17,7 @@
CFBundlePackageType
XPC!
CFBundleShortVersionString
- 0.16.1
+ 0.16.2
CFBundleSupportedPlatforms
MacOSX
diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/PlugIns/SwiftFormat.appex/Contents/MacOS/SwiftFormat b/EditorExtension/SwiftFormat for Xcode.app/Contents/PlugIns/SwiftFormat.appex/Contents/MacOS/SwiftFormat
index 99cdbf66e..7925d86ff 100755
Binary files a/EditorExtension/SwiftFormat for Xcode.app/Contents/PlugIns/SwiftFormat.appex/Contents/MacOS/SwiftFormat and b/EditorExtension/SwiftFormat for Xcode.app/Contents/PlugIns/SwiftFormat.appex/Contents/MacOS/SwiftFormat differ
diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/Resources/Base.lproj/Main.storyboardc/Info.plist b/EditorExtension/SwiftFormat for Xcode.app/Contents/Resources/Base.lproj/Main.storyboardc/Info.plist
index 927176e29..0d4dcc63a 100644
Binary files a/EditorExtension/SwiftFormat for Xcode.app/Contents/Resources/Base.lproj/Main.storyboardc/Info.plist and b/EditorExtension/SwiftFormat for Xcode.app/Contents/Resources/Base.lproj/Main.storyboardc/Info.plist differ
diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/Resources/Base.lproj/Main.storyboardc/MainMenu.nib b/EditorExtension/SwiftFormat for Xcode.app/Contents/Resources/Base.lproj/Main.storyboardc/MainMenu.nib
index eab26b524..91b1df03b 100644
Binary files a/EditorExtension/SwiftFormat for Xcode.app/Contents/Resources/Base.lproj/Main.storyboardc/MainMenu.nib and b/EditorExtension/SwiftFormat for Xcode.app/Contents/Resources/Base.lproj/Main.storyboardc/MainMenu.nib differ
diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/Resources/Base.lproj/Main.storyboardc/NSWindowController-B8D-0N-5wS.nib b/EditorExtension/SwiftFormat for Xcode.app/Contents/Resources/Base.lproj/Main.storyboardc/NSWindowController-B8D-0N-5wS.nib
index 73a3b6d17..ac02d4ba4 100644
Binary files a/EditorExtension/SwiftFormat for Xcode.app/Contents/Resources/Base.lproj/Main.storyboardc/NSWindowController-B8D-0N-5wS.nib and b/EditorExtension/SwiftFormat for Xcode.app/Contents/Resources/Base.lproj/Main.storyboardc/NSWindowController-B8D-0N-5wS.nib differ
diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/Resources/Base.lproj/Main.storyboardc/ViewController.nib b/EditorExtension/SwiftFormat for Xcode.app/Contents/Resources/Base.lproj/Main.storyboardc/ViewController.nib
index 91d0ce6c1..0f03d0ff1 100644
Binary files a/EditorExtension/SwiftFormat for Xcode.app/Contents/Resources/Base.lproj/Main.storyboardc/ViewController.nib and b/EditorExtension/SwiftFormat for Xcode.app/Contents/Resources/Base.lproj/Main.storyboardc/ViewController.nib differ
diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/Resources/Base.lproj/Main.storyboardc/XfG-lQ-9wD-view-m2S-Jp-Qdl.nib b/EditorExtension/SwiftFormat for Xcode.app/Contents/Resources/Base.lproj/Main.storyboardc/XfG-lQ-9wD-view-m2S-Jp-Qdl.nib
index 2871eac0e..6f9f77e9e 100644
Binary files a/EditorExtension/SwiftFormat for Xcode.app/Contents/Resources/Base.lproj/Main.storyboardc/XfG-lQ-9wD-view-m2S-Jp-Qdl.nib and b/EditorExtension/SwiftFormat for Xcode.app/Contents/Resources/Base.lproj/Main.storyboardc/XfG-lQ-9wD-view-m2S-Jp-Qdl.nib differ
diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/_CodeSignature/CodeResources b/EditorExtension/SwiftFormat for Xcode.app/Contents/_CodeSignature/CodeResources
index d60cb947c..76b5f1daf 100644
--- a/EditorExtension/SwiftFormat for Xcode.app/Contents/_CodeSignature/CodeResources
+++ b/EditorExtension/SwiftFormat for Xcode.app/Contents/_CodeSignature/CodeResources
@@ -6,23 +6,23 @@
Resources/Base.lproj/Main.storyboardc/Info.plist
- 9zRMIOeu8p18vhTjQt1JrWjdUTs=
+ t7ojotPoqWQiIaUFnkpbaO+flWg=
Resources/Base.lproj/Main.storyboardc/MainMenu.nib
- wWbzKzgCybMyXC74xwL2Z5YgIhQ=
+ u5+f2LM7oP7l+ZaVYRrDQefNp40=
Resources/Base.lproj/Main.storyboardc/NSWindowController-B8D-0N-5wS.nib
- tElWgi1r/6JdsD1G0XZxmkUhXqQ=
+ /456IPsK5PuQmTxIbZYziYSzzFY=
Resources/Base.lproj/Main.storyboardc/ViewController.nib
- WpPoKzQON29fgzeTKpsPBOBkJ4M=
+ 1bitQ76vDK8r6vTuVC2FA7cbPgQ=
Resources/Base.lproj/Main.storyboardc/XfG-lQ-9wD-view-m2S-Jp-Qdl.nib
- Y+ryX87SiZeJNYOWewGKWPEAIBM=
+ 79S1r8lbSuDTeykfmldXcyWgP1E=
Resources/libswiftRemoteMirror.dylib
@@ -152,7 +152,7 @@
cdhash
- Vx/qHHf7DgAaB15JCEO7B3tpevA=
+ FN8XhbhvOhC8ZAB4REPWZqj/FyU=
requirement
identifier "com.charcoaldesign.SwiftFormat-for-Xcode.SourceEditorExtension" and anchor apple generic and certificate leaf[subject.CN] = "Mac Developer: Nick Lockwood (XDQ4XJZXHD)" and certificate 1[field.1.2.840.113635.100.6.2.1] /* exists */
@@ -161,55 +161,55 @@
hash
- 9zRMIOeu8p18vhTjQt1JrWjdUTs=
+ t7ojotPoqWQiIaUFnkpbaO+flWg=
hash2
- Qdqh1N6PKRznd9n/Fb14jWvlk8SuioJcOyQMXMCfrnA=
+ zmv5lfRPMHfIOXEylIeqNinrajlghabiHUg1eRbNKsc=
Resources/Base.lproj/Main.storyboardc/MainMenu.nib
hash
- wWbzKzgCybMyXC74xwL2Z5YgIhQ=
+ u5+f2LM7oP7l+ZaVYRrDQefNp40=
hash2
- gkhRt2yNPyEhIE9bfT1EWWvFbcvm8Hd6iSDCDDrdizU=
+ myntpeKzM1/OixyVynJxXGOycQJO6WNabEivPgyZCBk=
Resources/Base.lproj/Main.storyboardc/NSWindowController-B8D-0N-5wS.nib
hash
- tElWgi1r/6JdsD1G0XZxmkUhXqQ=
+ /456IPsK5PuQmTxIbZYziYSzzFY=
hash2
- fOLIzn6WKP1Jn5n+SZ8Ekh6v6e/SZ/8doJbacGp69r8=
+ wyg4nPPTdRqGaYhhfXzUrT8yefTxL556CQFpgVLYnFI=
Resources/Base.lproj/Main.storyboardc/ViewController.nib
hash
- WpPoKzQON29fgzeTKpsPBOBkJ4M=
+ 1bitQ76vDK8r6vTuVC2FA7cbPgQ=
hash2
- bJL/EJkm1/Drv1jwTSyZ7ZQkMwITkipqt5l5r6+eHo0=
+ /zpEv8r0eyjQyUvMR/b3IfJOPb5KFId02xJ3rsQb+m4=
Resources/Base.lproj/Main.storyboardc/XfG-lQ-9wD-view-m2S-Jp-Qdl.nib
hash
- Y+ryX87SiZeJNYOWewGKWPEAIBM=
+ 79S1r8lbSuDTeykfmldXcyWgP1E=
hash2
- daqWq+TKCbBl98nq/S6rMSGR+ARaqD6QnacOix2wS8E=
+ kMovzhtLaeJjdb3BH9vs9WKpEaUX5FQXxXPY+0waFyE=
Resources/libswiftRemoteMirror.dylib
diff --git a/SwiftFormat.podspec.json b/SwiftFormat.podspec.json
index faa77b224..7f9415f79 100644
--- a/SwiftFormat.podspec.json
+++ b/SwiftFormat.podspec.json
@@ -1,6 +1,6 @@
{
"name": "SwiftFormat",
- "version": "0.16.1",
+ "version": "0.16.2",
"license": {
"type": "zlib",
"file": "LICENCE.md"
@@ -10,7 +10,7 @@
"authors": "Nick Lockwood",
"source": {
"git": "https://github.com/nicklockwood/SwiftFormat.git",
- "tag": "0.16.1"
+ "tag": "0.16.2"
},
"source_files": "SwiftFormat",
"requires_arc": true,
diff --git a/SwiftFormat/Formatter.swift b/SwiftFormat/Formatter.swift
index 4df40618a..2f407329c 100644
--- a/SwiftFormat/Formatter.swift
+++ b/SwiftFormat/Formatter.swift
@@ -2,7 +2,7 @@
// Formatter.swift
// SwiftFormat
//
-// Version 0.16.1
+// Version 0.16.2
//
// Created by Nick Lockwood on 12/08/2016.
// Copyright 2016 Nick Lockwood
diff --git a/SwiftFormat/Info.plist b/SwiftFormat/Info.plist
index 640c61a36..229e85f13 100644
--- a/SwiftFormat/Info.plist
+++ b/SwiftFormat/Info.plist
@@ -15,7 +15,7 @@
CFBundlePackageType
FMWK
CFBundleShortVersionString
- 0.16.1
+ 0.16.2
CFBundleSignature
????
CFBundleVersion
diff --git a/SwiftFormat/Options.swift b/SwiftFormat/Options.swift
index 1cdd63be2..d1a89c380 100644
--- a/SwiftFormat/Options.swift
+++ b/SwiftFormat/Options.swift
@@ -1,9 +1,34 @@
//
-// Options.swift
+// Rules.swift
// SwiftFormat
//
+// Version 0.16.2
+//
// Created by Nick Lockwood on 21/10/2016.
-// Copyright © 2016 Nick Lockwood. All rights reserved.
+// Copyright 2016 Nick Lockwood
+//
+// Distributed under the permissive zlib license
+// Get the latest version from here:
+//
+// https://github.com/nicklockwood/SwiftFormat
+//
+// This software is provided 'as-is', without any express or implied
+// warranty. In no event will the authors be held liable for any damages
+// arising from the use of this software.
+//
+// Permission is granted to anyone to use this software for any purpose,
+// including commercial applications, and to alter it and redistribute it
+// freely, subject to the following restrictions:
+//
+// 1. The origin of this software must not be misrepresented; you must not
+// claim that you wrote the original software. If you use this software
+// in a product, an acknowledgment in the product documentation would be
+// appreciated but is not required.
+//
+// 2. Altered source versions must be plainly marked as such, and must not be
+// misrepresented as being the original software.
+//
+// 3. This notice may not be removed or altered from any source distribution.
//
/// Configuration options for formatting. These aren't actually used by the
diff --git a/SwiftFormat/Rules.swift b/SwiftFormat/Rules.swift
index 28871bf81..2bb67da40 100644
--- a/SwiftFormat/Rules.swift
+++ b/SwiftFormat/Rules.swift
@@ -2,7 +2,7 @@
// Rules.swift
// SwiftFormat
//
-// Version 0.16.1
+// Version 0.16.2
//
// Created by Nick Lockwood on 12/08/2016.
// Copyright 2016 Nick Lockwood
@@ -1174,10 +1174,17 @@ public func todos(_ formatter: Formatter) {
for tag in ["TODO", "MARK", "FIXME"] {
if string.hasPrefix(tag) {
var suffix = string.substring(from: tag.endIndex)
- while suffix.characters.first == " " || suffix.characters.first == ":" {
- suffix = suffix.substring(from: suffix.characters.index(suffix.startIndex, offsetBy: 1))
+ if let first = suffix.characters.first {
+ // If not followed by a space or :, don't mess with it as it may be a custom format
+ if " :".characters.contains(first) {
+ while let first = suffix.characters.first, " :".characters.contains(first) {
+ suffix = suffix.substring(from: suffix.index(after: suffix.startIndex))
+ }
+ formatter.replaceTokenAtIndex(i, with: .commentBody(tag + ": " + suffix))
+ }
+ } else {
+ formatter.replaceTokenAtIndex(i, with: .commentBody(tag + ":"))
}
- formatter.replaceTokenAtIndex(i, with: .commentBody(tag + ": " + suffix))
break
}
}
diff --git a/SwiftFormat/SwiftFormat.h b/SwiftFormat/SwiftFormat.h
index cb94f93ab..26e48d850 100644
--- a/SwiftFormat/SwiftFormat.h
+++ b/SwiftFormat/SwiftFormat.h
@@ -2,7 +2,7 @@
// SwiftFormat.h
// SwiftFormat
//
-// Version 0.16.1
+// Version 0.16.2
//
// Created by Nick Lockwood on 12/08/2016.
// Copyright 2016 Nick Lockwood
diff --git a/SwiftFormat/SwiftFormat.swift b/SwiftFormat/SwiftFormat.swift
index 1305db3be..46879b6d6 100644
--- a/SwiftFormat/SwiftFormat.swift
+++ b/SwiftFormat/SwiftFormat.swift
@@ -2,7 +2,7 @@
// SwiftFormat.swift
// SwiftFormat
//
-// Version 0.16.1
+// Version 0.16.2
//
// Created by Nick Lockwood on 12/08/2016.
// Copyright 2016 Nick Lockwood
diff --git a/SwiftFormat/Tokenizer.swift b/SwiftFormat/Tokenizer.swift
index c1d5da103..aaafcf32c 100644
--- a/SwiftFormat/Tokenizer.swift
+++ b/SwiftFormat/Tokenizer.swift
@@ -2,7 +2,7 @@
// Tokenizer.swift
// SwiftFormat
//
-// Version 0.16.1
+// Version 0.16.2
//
// Created by Nick Lockwood on 11/08/2016.
// Copyright 2016 Nick Lockwood
@@ -730,12 +730,6 @@ public func tokenize(_ source: String) -> [Token] {
flushCommentBodyTokens()
}
- func convertOpeningChevronToSymbol(atScopeStackIndex index: Int) {
- let scopeIndex = scopeIndexStack[index]
- scopeIndexStack.remove(at: index)
- convertOpeningChevronToSymbol(at: scopeIndex)
- }
-
func convertOpeningChevronToSymbol(at index: Int) {
assert(tokens[index] == .startOfScope("<"))
tokens[index] = .symbol("<")
@@ -899,12 +893,14 @@ public func tokenize(_ source: String) -> [Token] {
break
default:
// Not a generic scope
- convertOpeningChevronToSymbol(atScopeStackIndex: scopeIndexStack.count - 1)
+ convertOpeningChevronToSymbol(at: scopeIndex)
+ scopeIndexStack.removeLast()
}
case .endOfScope:
// If we encountered a closing scope token that wasn't >
// then the opening < must have been an operator after all
- convertOpeningChevronToSymbol(atScopeStackIndex: scopeIndexStack.count - 1)
+ convertOpeningChevronToSymbol(at: scopeIndex)
+ scopeIndexStack.removeLast()
processToken()
return
default:
@@ -952,7 +948,8 @@ public func tokenize(_ source: String) -> [Token] {
case .startOfScope("<"):
// If we encountered an end-of-file while a generic scope was
// still open, the opening < must have been an operator
- convertOpeningChevronToSymbol(atScopeStackIndex: scopeIndexStack.count - 1)
+ convertOpeningChevronToSymbol(at: scopeIndex)
+ scopeIndexStack.removeLast()
case .startOfScope("//"):
break
default:
diff --git a/SwiftFormatTests/Info.plist b/SwiftFormatTests/Info.plist
index 1e0435710..d703e40b0 100644
--- a/SwiftFormatTests/Info.plist
+++ b/SwiftFormatTests/Info.plist
@@ -15,7 +15,7 @@
CFBundlePackageType
BNDL
CFBundleShortVersionString
- 0.16.1
+ 0.16.2
CFBundleSignature
????
CFBundleVersion