File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -2007,6 +2007,8 @@ extension Lexer.Cursor {
2007
2007
) -> RawTokenKind ? {
2008
2008
var Tmp = TokStart
2009
2009
var poundCount = 0
2010
+ var parenCount = 0
2011
+
2010
2012
while Tmp . advance ( matching: UInt8 ( ascii: " # " ) ) != nil {
2011
2013
poundCount += 1
2012
2014
}
@@ -2072,6 +2074,15 @@ extension Lexer.Cursor {
2072
2074
// // delimiter.
2073
2075
// throw DelimiterLexError(.unprintableASCII, resumeAt: cursor.successor())
2074
2076
2077
+ case UInt8 ( ascii: " ( " ) :
2078
+ parenCount += 1
2079
+
2080
+ case UInt8 ( ascii: " ) " ) :
2081
+ if parenCount == 0 {
2082
+ return nil
2083
+ }
2084
+ parenCount -= 1
2085
+
2075
2086
default :
2076
2087
continue DELIMITLOOP
2077
2088
}
Original file line number Diff line number Diff line change @@ -347,6 +347,13 @@ public class LexerTests: XCTestCase {
347
347
lexeme ( . pound, " # " ) ,
348
348
lexeme ( . eof, " " ) ,
349
349
] ) ,
350
+ ( " /a)/ " , [
351
+ lexeme ( . prefixOperator, " / " ) ,
352
+ lexeme ( . identifier, " a " ) ,
353
+ lexeme ( . rightParen, " ) " ) ,
354
+ lexeme ( . postfixOperator, " / " ) ,
355
+ lexeme ( . eof, " " ) ,
356
+ ] ) ,
350
357
]
351
358
for (fixture, expectation) in fixtures {
352
359
var fixture = fixture
You can’t perform that action at this time.
0 commit comments