MCPcopy Index your code
hub / github.com/boyter/scc / processLanguageFeature

Function processLanguageFeature

processor/processor.go:374–438  ·  view source on GitHub ↗
(name string, value Language)

Source from the content-addressed store, hash-verified

372}
373
374func processLanguageFeature(name string, value Language) {
375 complexityTrie := &Trie{}
376 slCommentTrie := &Trie{}
377 mlCommentTrie := &Trie{}
378 stringTrie := &Trie{}
379 tokenTrie := &Trie{}
380
381 complexityMask := byte(0)
382 singleLineCommentMask := byte(0)
383 multiLineCommentMask := byte(0)
384 stringMask := byte(0)
385 processMask := byte(0)
386
387 for _, v := range value.ComplexityChecks {
388 complexityMask |= v[0]
389 complexityTrie.Insert(TComplexity, []byte(v))
390 if !Complexity {
391 tokenTrie.Insert(TComplexity, []byte(v))
392 }
393 }
394 if !Complexity {
395 processMask |= complexityMask
396 }
397
398 for _, v := range value.LineComment {
399 singleLineCommentMask |= v[0]
400 slCommentTrie.Insert(TSlcomment, []byte(v))
401 tokenTrie.Insert(TSlcomment, []byte(v))
402 }
403 processMask |= singleLineCommentMask
404
405 for _, v := range value.MultiLine {
406 multiLineCommentMask |= v[0][0]
407 mlCommentTrie.InsertClose(TMlcomment, []byte(v[0]), []byte(v[1]))
408 tokenTrie.InsertClose(TMlcomment, []byte(v[0]), []byte(v[1]))
409 }
410 processMask |= multiLineCommentMask
411
412 for _, v := range value.Quotes {
413 stringMask |= v.Start[0]
414 stringTrie.InsertClose(TString, []byte(v.Start), []byte(v.End))
415 tokenTrie.InsertClose(TString, []byte(v.Start), []byte(v.End))
416 }
417 processMask |= stringMask
418
419 LanguageFeaturesMutex.Lock()
420 LanguageFeatures[name] = LanguageFeature{
421 Complexity: complexityTrie,
422 MultiLineComments: mlCommentTrie,
423 MultiLine: value.MultiLine,
424 SingleLineComments: slCommentTrie,
425 LineComment: value.LineComment,
426 Strings: stringTrie,
427 Tokens: tokenTrie,
428 Nested: value.NestedMultiLine,
429 ComplexityCheckMask: complexityMask,
430 MultiLineCommentMask: multiLineCommentMask,
431 SingleLineCommentMask: singleLineCommentMask,

Callers 2

ProcessConstantsFunction · 0.85
LoadLanguageFeatureFunction · 0.85

Calls 2

InsertMethod · 0.95
InsertCloseMethod · 0.95

Tested by

no test coverage detected