chapi.app.analyser.KotlinAnalyserApp.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.kotlinast.AnalysisMode
import chapi.ast.kotlinast.KotlinAnalyser
import chapi.domain.core.CodeDataStruct
class KotlinAnalyserApp(config: ChapiConfig = ChapiConfig(language = Language.KOTLIN)) : BaseAnalyser(config) {
private val analyser: KotlinAnalyser by lazy { KotlinAnalyser() }
override fun analysisByFiles(files: Array): Array =
files.flatMap(::analysisByFile).toTypedArray()
override fun analysisByFile(file: AbstractFile): List {
fun postProcess(it: CodeDataStruct): CodeDataStruct = it.apply { it.FilePath = file.absolutePath }
val codeContainer = analyser.analysis(file.content, file.fileName, AnalysisMode.Full)
return codeContainer.DataStructures.map(::postProcess)
}
}