-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmapping.go
391 lines (390 loc) · 19.2 KB
/
mapping.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
package main
var typeMapping = map[string]string{
"uast:Identifier": "Identifier",
"uast:Comment": "Comment",
"uast:InlineImport": "Import",
"uast:RuntimeImport": "Import",
"uast:Import": "Import",
"uast:Operator": "Operator",
"uast:QualifiedIdentifier": "Identifier",
"uast:String": "StringLiteral",
"uast:Bool": "BoolLiteral",
// Bash
"bash:@": "Operator",
"bash:|&": "Operator",
"bash:!": "Operator",
"bash:?": "Operator",
"bash:,": "Operator",
"bash:%": "Operator",
"bash:&>": "Operator",
"bash:&>>": "Operator",
"bash:^": "Operator",
"bash:*": "Operator",
"bash:**": "Operator",
"bash:+": "Operator",
"bash:++": "Operator",
"bash:+=": "Operator",
"bash:-": "Operator",
"bash:--": "Operator",
"bash:/": "Operator",
"bash:\\": "Operator",
"bash:<&": "Operator",
"bash:<<<": "Operator",
"bash:<>": "Operator",
"bash:>&": "Operator",
"bash:>|": "Operator",
"bash:+=_arithmetic": "Operator",
"bash:-=_arithmetic": "Operator",
"bash:*=_arithmetic": "Operator",
"bash:/=_arithmetic": "Operator",
"bash:%=_arithmetic": "Operator",
"bash:<<=_arithmetic": "Operator",
"bash:>>=_arithmetic": "Operator",
"Parameter_expansion_operator_':-'": "Operator", // https://github.com/bblfsh/bash-driver/issues/67
"Parameter_expansion_operator_':+'": "Operator", // same
"Parameter_expansion_operator_':='": "Operator", // same
"Parameter_expansion_operator_':?'": "Operator", // same
"bash:Parameter_expansion_operator_'!'": "Operator",
"bash:Parameter_expansion_operator_'+'": "Operator",
"bash:Parameter_expansion_operator_'-'": "Operator",
"bash:Parameter_expansion_operator_'*'": "Operator",
"bash:Parameter_expansion_operator_'.'": "Operator",
"bash:Parameter_expansion_operator_'='": "Operator",
"bash:Parameter_expansion_operator_'?'": "Operator",
"bash:Parameter_expansion_operator_(unknown)": "Operator",
"bash:AND": "Operator",
"bash:ANDAND": "Operator",
"bash:BAD_CHARACTER": "StringLiteral",
"bash:COLON": "Operator",
"bash:DOLLAR": "Operator",
"bash:EQ": "Operator",
"bash:ERROR_ELEMENT": "Operator",
"bash:GT": "Operator",
"bash:GTEQ": "Operator",
"bash:GTGT": "Operator",
"bash:LBLB_left_bracket": "Operator",
"bash:LB_for_arithmetic": "Operator",
"bash:LB_left_square": "Operator",
"bash:LPLP": "Operator",
"bash:LT": "Operator",
"bash:LTEQ": "Operator",
"bash:LTLT": "Operator",
"bash:NOTEQ": "Operator",
"bash:OR": "Operator",
"bash:OROR": "Operator",
"bash:RBRB_right_bracket": "Operator",
"bash:RB_for_arithmetic": "Operator",
"bash:RB_right_square": "Operator",
"bash:RPRP": "Operator",
"bash:SEMICOLONSEMICOLON": "Operator",
"bash:arith_EQEQ": "Operator",
"bash:arith_GT": "Operator",
"bash:arith_LT": "Operator",
"bash:arithmetic_base_char_(#)": "Operator",
"bash:bitwise_negation_~": "Operator",
"bash:cond_op": "Operator",
"bash:cond_op_=~": "Operator",
"bash:cond_op_EQEQ": "Operator",
"bash:cond_op_NOT": "Operator",
"bash:elif": "Keyword",
"bash:else": "Keyword",
"bash:here_doc_content": "Comment",
"bash:0x_hex_literal": "NumericLiteral",
"bash:int_literal": "NumericLiteral",
"bash:let": "Keyword",
"bash:negation_!": "Operator",
"bash:number": "NumericLiteral",
"bash:numrange_filedescriptor": "Identifier",
"bash:octal_literal": "NumericLiteral",
"bash:param_exp_AT": "Operator",
"bash:param_exp_COLON": "Operator",
"bash:param_exp_NUM": "Operator",
"bash:param_exp_NUMNUM": "Operator",
"bash:param_exp_PERC": "Operator",
"bash:param_exp_SLASH": "Operator",
"bash:select": "Keyword",
"bash:single_bash_expansion": "Operator",
"bash:then": "Keyword",
"bash:time": "Keyword",
"bash:trap": "Keyword",
// C++
"cpp:ASTFunctionStyleMacroDefinition": "Identifier",
"cpp:ASTMacroDefinition": "Identifier",
"cpp:ASTUndef": "Identifier",
"cpp:Comment": "Comment",
"cpp:CPPASTASMDeclaration": "StringLiteral", // Assembly code
"cpp:CPPASTBinaryExpression": "Operator",
"cpp:ASTInclusionStatement": "Comment", // Test file t_9_016.cpp of Boost.Wave
"cpp:CPPASTLinkageSpecification": "Identifier",
"cpp:CPPASTLiteralExpression": "NumericLiteral",
"cpp:CPPASTSimpleDeclSpecifier": "NativeType",
// C#
"csharp:AbstractKeyword": "Keyword",
"csharp:AddKeyword": "Keyword",
"csharp:AliasKeyword": "Keyword",
"csharp:AmpersandEqualsToken": "Operator",
"csharp:AmpersandAmpersandToken": "Operator",
"csharp:AmpersandToken": "Operator",
"csharp:AsKeyword": "Keyword",
"csharp:AscendingKeyword": "Keyword",
"csharp:AssemblyKeyword": "Keyword",
"csharp:AsteriskEqualsToken": "Operator",
"csharp:AsteriskToken": "Operator",
"csharp:AsyncKeyword": "Keyword",
"csharp:AwaitKeyword": "Keyword",
"csharp:BarBarToken": "Operator",
"csharp:BarEqualsToken": "Operator",
"csharp:BarToken": "Operator",
"csharp:BaseKeyword": "NativeType",
"csharp:BoolKeyword": "NativeType",
"csharp:BreakKeyword": "Keyword",
"csharp:ByKeyword": "Keyword",
"csharp:ByteKeyword": "NativeType",
"csharp:CaretEqualsToken": "Operator",
"csharp:CaretToken": "Operator",
"csharp:CaseKeyword": "Keyword",
"csharp:CatchKeyword": "Keyword",
"csharp:CharKeyword": "NativeType",
"csharp:CharacterLiteralToken": "StringLiteral",
"csharp:CheckedKeyword": "Keyword",
"csharp:ClassKeyword": "Keyword",
"csharp:ConstKeyword": "Keyword",
"csharp:ContinueKeyword": "Keyword",
"csharp:DecimalKeyword": "NativeType",
"csharp:DefaultKeyword": "Keyword",
"csharp:DelegateKeyword": "Keyword",
"csharp:DescendingKeyword": "Keyword",
"csharp:DoKeyword": "Keyword",
"csharp:DoubleKeyword": "NativeType",
"csharp:EqualsEqualsToken": "Operator",
"csharp:EqualsGreaterThanToken": "Operator",
"csharp:EqualsKeyword": "Keyword",
"csharp:EqualsToken": "Operator",
"csharp:ElseKeyword": "Keyword",
"csharp:EnumKeyword": "Keyword",
"csharp:EventKeyword": "Keyword",
"csharp:ExclamationEqualsToken": "Operator",
"csharp:ExclamationToken": "Operator",
"csharp:ExplicitKeyword": "Keyword",
"csharp:ExternKeyword": "Keyword",
"csharp:FalseKeyword": "BoolLiteral",
"csharp:FieldKeyword": "Keyword",
"csharp:FinallyKeyword": "Keyword",
"csharp:FixedKeyword": "Keyword",
"csharp:FloatKeyword": "Keyword",
"csharp:ForEachKeyword": "Keyword",
"csharp:ForKeyword": "Keyword",
"csharp:FromKeyword": "Keyword",
"csharp:GetKeyword": "Keyword",
"csharp:GlobalKeyword": "Keyword",
"csharp:GotoKeyword": "Keyword",
"csharp:GreaterThanEqualsToken": "Operator",
"csharp:GreaterThanGreaterThanEqualsToken": "Operator",
"csharp:GreaterThanGreaterThanToken": "Operator",
"csharp:GreaterThanToken": "Operator",
"csharp:GroupKeyword": "Keyword",
"csharp:IfKeyword": "Keyword",
"csharp:ImplicitKeyword": "Keyword",
"csharp:InKeyword": "Keyword",
"csharp:IntKeyword": "NativeType",
"csharp:InterfaceKeyword": "Keyword",
"csharp:InternalKeyword": "Keyword",
"csharp:InterpolatedStringTextToken": "StringLiteral",
"csharp:IntoKeyword": "Keyword",
"csharp:IsKeyword": "Keyword",
"csharp:JoinKeyword": "Keyword",
"csharp:LessThanEqualsToken": "Operator",
"csharp:LessThanLessThanEqualsToken": "Operator",
"csharp:LessThanLessThanToken": "Operator",
"csharp:LessThanToken": "Operator",
"csharp:LetKeyword": "Keyword",
"csharp:LockKeyword": "Keyword",
"csharp:LongKeyword": "NativeType",
"csharp:MakeRefKeyword": "Keyword",
"csharp:MethodKeyword": "Keyword",
"csharp:MinusEqualsToken": "Operator",
"csharp:MinusGreaterThanToken": "Operator",
"csharp:MinusMinusToken": "Operator",
"csharp:MinusToken": "Operator",
"csharp:ModuleKeyword": "Keyword",
"csharp:MultiLineCommentTrivia": "Comment",
"csharp:NamespaceKeyword": "Keyword",
"csharp:NewKeyword": "Keyword",
"csharp:NullKeyword": "NullLiteral",
"csharp:NumericLiteralToken": "NumericLiteral",
"csharp:ObjectKeyword": "Keyword",
"csharp:OnKeyword": "Keyword",
"csharp:OperatorKeyword": "Keyword",
"csharp:OrderByKeyword": "Keyword",
"csharp:OutKeyword": "Keyword",
"csharp:OverrideKeyword": "Keyword",
"csharp:ParamKeyword": "Keyword",
"csharp:ParamsKeyword": "Keyword",
"csharp:PartialKeyword": "Keyword",
"csharp:PercentToken": "Operator",
"csharp:PercentEqualsToken": "Operator",
"csharp:PlusEqualsToken": "Operator",
"csharp:PlusPlusToken": "Operator",
"csharp:PlusToken": "Operator",
"csharp:PrivateKeyword": "Keyword",
"csharp:PropertyKeyword": "Keyword",
"csharp:ProtectedKeyword": "Keyword",
"csharp:PublicKeyword": "Keyword",
"csharp:QuestionToken": "Operator",
"csharp:QuestionQuestionToken": "Operator",
"csharp:ReadOnlyKeyword": "Keyword",
"csharp:RefKeyword": "Keyword",
"csharp:RefTypeKeyword": "Keyword",
"csharp:RefValueKeyword": "Keyword",
"csharp:RemoveKeyword": "Keyword",
"csharp:ReturnKeyword": "Keyword",
"csharp:SByteKeyword": "NativeType",
"csharp:SealedKeyword": "Keyword",
"csharp:SelectKeyword": "Keyword",
"csharp:SetKeyword": "Keyword",
"csharp:ShortKeyword": "NativeType",
"csharp:SingleLineCommentTrivia": "Comment",
"csharp:SingleLineDocumentationCommentTrivia": "Comment",
"csharp:SizeOfKeyword": "Keyword",
"csharp:SlashEqualsToken": "Operator",
"csharp:SlashToken": "Operator",
"csharp:StackAllocKeyword": "Keyword",
"csharp:StaticKeyword": "Keyword",
"csharp:StringKeyword": "NativeType",
"csharp:StructKeyword": "NativeType",
"csharp:SwitchKeyword": "Keyword",
"csharp:ThisKeyword": "Keyword",
"csharp:ThrowKeyword": "Keyword",
"csharp:TildeToken": "Operator",
"csharp:TrueKeyword": "BoolLiteral",
"csharp:TryKeyword": "Keyword",
"csharp:TypeKeyword": "Keyword",
"csharp:TypeOfKeyword": "Keyword",
"csharp:TypeVarKeyword": "Keyword",
"csharp:UIntKeyword": "NativeType",
"csharp:ULongKeyword": "NativeType",
"csharp:UShortKeyword": "NativeType",
"csharp:UncheckedKeyword": "Keyword",
"csharp:UnderscoreToken": "Operator",
"csharp:UnsafeKeyword": "Keyword",
"csharp:UsingKeyword": "Keyword",
"csharp:VirtualKeyword": "Keyword",
"csharp:VoidKeyword": "NativeType",
"csharp:VolatileKeyword": "Keyword",
"csharp:WhereKeyword": "Keyword",
"csharp:WhenKeyword": "Keyword",
"csharp:WhileKeyword": "Keyword",
"csharp:YieldKeyword": "Keyword",
// Go
"go:BasicLit": "NumericLiteral",
"go:ImportSpec": "Import",
"go:Field": "Identifier",
"go:ValueSpec": "Identifier",
// Java
"java:BlockComment": "Comment",
"java:BooleanLiteral": "BoolLiteral",
"java:CharacterLiteral": "StringLiteral",
"java:IfStatement": "Keyword",
"java:Javadoc": "Comment",
"java:LineComment": "Comment",
"java:Modifier": "Keyword",
"java:NullLiteral": "NullLiteral",
"java:NumberLiteral": "NumericLiteral",
"java:PackageDeclaration": "Keyword",
"java:PrimitiveType": "NativeType",
// JavaScript
"javascript:BigIntLiteral": "NumericLiteral",
"javascript:BooleanLiteral": "BoolLiteral",
"javascript:BooleanLiteralTypeAnnotation": "BoolLiteral",
"javascript:DirectiveLiteral": "Keyword",
"javascript:JSXText": "StringLiteral",
"javascript:NumberLiteralTypeAnnotation": "NumericLiteral",
"javascript:NumericLiteral": "NumericLiteral",
"javascript:RegExpLiteral": "StringLiteral",
"javascript:StringLiteralTypeAnnotation": "StringLiteral",
"javascript:TypeParameter": "Identifier",
// PHP
"php:Comment": "Comment",
"php:Expr_Instanceof": "Keyword",
"php:Scalar_DNumber": "NumericLiteral",
"php:Scalar_LNumber": "NumericLiteral",
"php:Stmt_DeclareDeclare": "Identifier",
"php:Stmt_InlineHTML": "StringLiteral", // HTML Code
"php:Stmt_TraitUseAdaptation_Alias": "Identifier",
// Python
"python:Add": "Operator",
"python:And": "Operator",
"python:Assert": "Keyword",
"python:AugAssign": "Operator",
"python:Await": "Keyword",
"python:BitAnd": "Operator",
"python:BitOr": "Operator",
"python:BitXor": "Operator",
"python:Break": "Keyword",
"python:ClassDef": "Identifier",
"python:Continue": "Keyword",
"python:Delete": "Keyword",
"python:Div": "Operator",
"python:Eq": "Operator",
"python:ExceptHandler": "Identifier",
"python:Ellipsis": "Keyword",
"python:Exec": "Keyword",
"python:False": "BoolLiteral",
"python:FloorDiv": "Operator",
"python:For": "Keyword",
"python:For.orelse": "Keyword",
"python:Global": "Keyword",
"python:Gt": "Operator",
"python:GtE": "Operator",
"python:If": "Keyword",
"python:If.orelse": "Keyword",
"python:In": "Operator",
"python:Invert": "Operator",
"python:Is": "Operator",
"python:IsNot": "Operator",
"python:Lambda": "Keyword",
"python:LShift": "Operator",
"python:Lt": "Operator",
"python:LtE": "Operator",
"python:Mod": "Operator",
"python:MatMult": "Operator",
"python:Mult": "Operator",
"python:NoneLiteral": "NullLiteral",
"python:Nonlocal": "Keyword",
"python:Not": "Operator",
"python:NotEq": "Operator",
"python:NotIn": "Operator",
"python:Num": "NumericLiteral",
"python:Or": "Operator",
"python:Pass": "Keyword",
"python:Pow": "Operator",
"python:Print": "Keyword",
"python:Raise": "Keyword",
"python:Return": "Keyword",
"python:RShift": "Operator",
"python:Sub": "Operator",
"python:True": "BoolLiteral",
"python:Try": "Keyword",
"python:Try.else": "Keyword",
"python:Try.finalbody": "Keyword",
"python:Try.handlers": "Keyword",
"python:UAdd": "Operator",
"python:USub": "Operator",
"python:While": "Keyword",
"python:With": "Keyword",
"python:Yield": "Keyword",
"python:YieldFrom": "Keyword",
// Ruby
"ruby:and": "Operator",
"ruby:complex": "NumericLiteral",
"ruby:flip_1": "Operator",
"ruby:flip_2": "Operator",
"ruby:float": "NumericLiteral",
"ruby:int": "NumericLiteral",
"ruby:or": "Operator",
"ruby:rational": "NumericLiteral",
"ruby:send_operator": "Operator",
"ruby:send_require": "Keyword",
"ruby:send_statement": "Keyword",
"ruby:Symbol": "StringLiteral",
}