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

chapi.app.analyser.KotlinAnalyserApp.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.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)
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy