File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed
Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,8 @@ public struct SwiftGrammar: Grammar {
5555 return false
5656 case ( " . " , " / " ) :
5757 return false
58+ case ( " { " , " / " ) , ( " } " , " / " ) :
59+ return false
5860 default :
5961 return true
6062 }
Original file line number Diff line number Diff line change @@ -173,6 +173,23 @@ final class CommentTests: SyntaxHighlighterTestCase {
173173 ] )
174174 }
175175
176+ func testCommentsNextToCurlyBrackets( ) {
177+ let components = highlighter. highlight ( """
178+ call {//commentA
179+ }//commentB
180+ """ )
181+
182+ XCTAssertEqual ( components, [
183+ . token( " call " , . call) ,
184+ . whitespace( " " ) ,
185+ . plainText( " { " ) ,
186+ . token( " //commentA " , . comment) ,
187+ . whitespace( " \n " ) ,
188+ . plainText( " } " ) ,
189+ . token( " //commentB " , . comment)
190+ ] )
191+ }
192+
176193 func testAllTestsRunOnLinux( ) {
177194 XCTAssertTrue ( TestCaseVerifier . verifyLinuxTests ( ( type ( of: self ) ) . allTests) )
178195 }
@@ -188,7 +205,8 @@ extension CommentTests {
188205 ( " testCommentStartingWithPunctuation " , testCommentStartingWithPunctuation) ,
189206 ( " testCommentEndingWithComma " , testCommentEndingWithComma) ,
190207 ( " testCommentWithNumber " , testCommentWithNumber) ,
191- ( " testCommentWithNoWhiteSpaceToPunctuation " , testCommentWithNoWhiteSpaceToPunctuation)
208+ ( " testCommentWithNoWhiteSpaceToPunctuation " , testCommentWithNoWhiteSpaceToPunctuation) ,
209+ ( " testCommentsNextToCurlyBrackets " , testCommentsNextToCurlyBrackets)
192210 ]
193211 }
194212}
You can’t perform that action at this time.
0 commit comments