@@ -4,13 +4,14 @@ import Antlr4
4
4
public class SwiftLexer : Lexer {
5
5
internal static var _decisionToDFA : [ DFA ] = {
6
6
var decisionToDFA = [ DFA] ( )
7
- for i in 0 ..< SwiftLexer . _ATN. getNumberOfDecisions ( ) {
7
+ let length = SwiftLexer . _ATN. getNumberOfDecisions ( )
8
+ for i in 0 ..< length {
8
9
decisionToDFA. append ( DFA ( SwiftLexer . _ATN. getDecisionState ( i) !, i) )
9
10
}
10
11
return decisionToDFA
11
12
} ( )
12
13
13
- internal let _sharedContextCache : PredictionContextCache = PredictionContextCache ( )
14
+ internal static let _sharedContextCache : PredictionContextCache = PredictionContextCache ( )
14
15
public static let T__0 = 1 , T__1 = 2 , T__2 = 3 , T__3 = 4 , T__4 = 5 , T__5 = 6 , T__6 = 7 ,
15
16
T__7 = 8 , T__8 = 9 , T__9 = 10 , T__10 = 11 , T__11 = 12 , T__12 = 13 ,
16
17
T__13 = 14 , T__14 = 15 , T__15 = 16 , T__16 = 17 , T__17 = 18 , T__18 = 19 ,
@@ -120,18 +121,17 @@ public class SwiftLexer: Lexer {
120
121
*/
121
122
//@Deprecated
122
123
public let tokenNames : [ String ? ] ? = {
123
- var tokenNames = [ String ? ] ( )
124
-
125
- for i in 0 ..< _SYMBOLIC_NAMES . count {
124
+ let length = _SYMBOLIC_NAMES . count
125
+ var tokenNames = [ String ? ] ( count : length , repeatedValue : nil )
126
+ for i in 0 ..< length {
126
127
var name = VOCABULARY . getLiteralName ( i)
127
128
if name == nil {
128
129
name = VOCABULARY . getSymbolicName ( i)
129
130
}
130
-
131
131
if name == nil {
132
132
name = " <INVALID> "
133
133
}
134
- tokenNames. append ( name)
134
+ tokenNames [ i ] = name
135
135
}
136
136
return tokenNames
137
137
} ( )
@@ -141,15 +141,14 @@ public class SwiftLexer: Lexer {
141
141
return tokenNames
142
142
}
143
143
144
-
145
144
public override func getVocabulary( ) -> Vocabulary {
146
145
return SwiftLexer . VOCABULARY
147
146
}
148
147
149
148
public override init ( _ input: CharStream ) {
150
149
RuntimeMetaData . checkVersion ( " 4.5.1 " , RuntimeMetaData . VERSION)
151
150
super. init ( input)
152
- _interp = LexerATNSimulator ( self , SwiftLexer . _ATN, SwiftLexer . _decisionToDFA, _sharedContextCache)
151
+ _interp = LexerATNSimulator ( self , SwiftLexer . _ATN, SwiftLexer . _decisionToDFA, SwiftLexer . _sharedContextCache)
153
152
}
154
153
155
154
override
@@ -167,7 +166,7 @@ public class SwiftLexer: Lexer {
167
166
override
168
167
public func getATN( ) -> ATN { return SwiftLexer . _ATN }
169
168
170
- public static let _serializedATN : String = SwiftLexerATN ( ) . contents
169
+ public static let _serializedATN : String = SwiftLexerATN ( ) . jsonString
171
170
public static let _ATN : ATN = ATNDeserializer ( ) . deserializeFromJson ( _serializedATN)
172
171
173
172
}
0 commit comments