diff --git a/src/swift/swift.test.ts b/src/swift/swift.test.ts index fcdb543a..569246cd 100644 --- a/src/swift/swift.test.ts +++ b/src/swift/swift.test.ts @@ -163,6 +163,20 @@ testTokenization('swift', [ { startIndex: 60, type: 'string.quote.swift' } /* '"' */ ] }], + // Multiline string + [{ + line: '"""test"test', // Separate new lines into separate objects within this same array. + tokens: [ + { startIndex: 0, type: 'string.quote.swift' }, /* '"""' */ + { startIndex: 3, type: 'string.swift' } /* test"test */ + ] + }, { + line: ' keepsgoing"""', + tokens: [ + { startIndex: 0, type: 'string.swift' }, /* ' keepsgoing' */ + { startIndex: 11, type: 'string.quote.swift' } /* '"""' */ + ] + }], // Method invocation/property accessor. [{ line: ' let view = self.window!.contr as! UIView', diff --git a/src/swift/swift.ts b/src/swift/swift.ts index 6960bec3..3b076065 100644 --- a/src/swift/swift.ts +++ b/src/swift/swift.ts @@ -83,6 +83,13 @@ export const language = { [/"""/, 'string.quote', '@endDblDocString'] ], + endDblDocString: [ + [/[^"]+/, 'string'], + [/\\"/, 'string'], + [/"""/, 'string.quote', '@popall'], + [/"/, 'string'] + ], + symbol: [ [/[{}()\[\]]/, '@brackets'], [/[<>](?!@symbols)/, '@brackets'],