chapi.app.analyser.CSharpAnalyserApp.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of chapi-application Show documentation
Show all versions of chapi-application Show documentation
Chapi is A common language meta information convertor, convert different languages to same meta-data model
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()
}
}