Skip to content

Commit

Permalink
add swift4 string support, #176
Browse files Browse the repository at this point in the history
  • Loading branch information
Jintin committed Aug 22, 2017
1 parent 4561742 commit 2f3124f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Parser/SwiftParser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@ class SwiftParser {
}
break
case "\"":
if isNext(string: "\"\"\"", length: 3) {
strIndex = add(string: "\"\"\"", length: 3)
return addToNext(strIndex, stopWord: "\"\"\"")
}
let quote = try string.findQuote(from: strIndex)
retString += quote.string
return quote.index
Expand Down
7 changes: 7 additions & 0 deletions SwimatTests/FormatTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -150,4 +150,11 @@ class FormatTest: XCTestCase {
parser.autoRemoveChar = true
format(parser: parser, expect: ret)
}

func testCase13() {
let res = "\"\"\" a b \"\"\""
let ret = "\"\"\" a b \"\"\""
let parser = SwiftParser(string: res)
format(parser: parser, expect: ret)
}
}

0 comments on commit 2f3124f

Please sign in to comment.