File tree Expand file tree Collapse file tree 2 files changed +1
-19
lines changed Expand file tree Collapse file tree 2 files changed +1
-19
lines changed Original file line number Diff line number Diff line change @@ -122,20 +122,6 @@ extension Lexer {
122
122
return remainingText
123
123
}
124
124
}
125
-
126
- #if SWIFTPARSER_ENABLE_ALTERNATE_TOKEN_INTROSPECTION
127
- /// If `pointer` is in the source buffer of this ``LexemeSequence``, return
128
- /// its offset, otherwise `nil`. Should only be used for the parser's
129
- /// alternate token introspection
130
- func offset( of pointer: UnsafePointer < UInt8 > ) -> Int ? {
131
- let offset = pointer - self . sourceBufferStart. input. baseAddress!
132
- if offset <= self . sourceBufferStart. input. count {
133
- return offset
134
- } else {
135
- return nil
136
- }
137
- }
138
- #endif
139
125
}
140
126
141
127
@_spi ( Testing)
Original file line number Diff line number Diff line change @@ -250,11 +250,7 @@ public struct Parser {
250
250
public var alternativeTokenChoices : [ Int : [ TokenSpec ] ] = [ : ]
251
251
252
252
mutating func recordAlternativeTokenChoice( for lexeme: Lexer . Lexeme , choices: [ TokenSpec ] ) {
253
- guard let lexemeBaseAddress = lexeme. tokenText. baseAddress,
254
- let offset = lexemes. offset ( of: lexemeBaseAddress)
255
- else {
256
- return
257
- }
253
+ let offset = lexemes. getOffsetToStart ( lexeme)
258
254
alternativeTokenChoices [ offset, default: [ ] ] . append ( contentsOf: choices)
259
255
}
260
256
#endif
You can’t perform that action at this time.
0 commit comments