All Downloads are FREE. Search and download functionalities are using the official Maven repository.

chapi.app.analyser.CSharpAnalyserApp.kt Maven / Gradle / Ivy

Go to download

Chapi is A common language meta information convertor, convert different languages to same meta-data model

There is a newer version: 1.5.10
Show newest version
package chapi.app.analyser

import chapi.app.analyser.config.ChapiConfig
import chapi.app.analyser.config.Language
import chapi.app.analyser.support.AbstractFile
import chapi.app.analyser.support.BaseAnalyser
import chapi.ast.csharpast.CSharpAnalyser
import chapi.domain.core.CodeDataStruct

class CSharpAnalyserApp(var config: ChapiConfig = ChapiConfig(language = Language.CSharp)) : BaseAnalyser(config) {
    private val analyser: CSharpAnalyser by lazy { CSharpAnalyser() }

    override fun analysisByFiles(files: Array): Array =
        files.flatMap(::analysisByFile).toTypedArray()

    override fun analysisByFile(file: AbstractFile): List {
        println("processing file: ${file.absolutePath}")
        val codeContainer = analyser.analysis(file.content, file.fileName)

        return codeContainer.Containers.flatMap { container ->
            container.DataStructures.map {
                it.apply {
                    it.Imports = codeContainer.Imports
                    it.FilePath = file.absolutePath
                }
            }
        }.toList()
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy