diff --git a/chapi-parser-cmake/README.md b/chapi-parser-cmake/README.md new file mode 100644 index 00000000..51a2cf72 --- /dev/null +++ b/chapi-parser-cmake/README.md @@ -0,0 +1,2 @@ +# CMakefile + diff --git a/chapi-parser-cmake/src/main/kotlin/chapi/parser/cmake/CMakeAnalyser.kt b/chapi-parser-cmake/src/main/kotlin/chapi/parser/cmake/CMakeAnalyser.kt index 30beb719..5d0693b6 100644 --- a/chapi-parser-cmake/src/main/kotlin/chapi/parser/cmake/CMakeAnalyser.kt +++ b/chapi-parser-cmake/src/main/kotlin/chapi/parser/cmake/CMakeAnalyser.kt @@ -9,6 +9,16 @@ import org.antlr.v4.runtime.tree.ParseTreeWalker /** * The `CMakeAnalyser` class is a CMakelists.txt parser that implements the `Analyser` interface. * It provides a method to analyze the given code and extract relevant information from it. + * + * ```kotlin + * val cmakeCode = """ + * cmake_minimum_required(VERSION 3.0) + * project(HelloWorld) + * add_executable(HelloWorld HelloWorld.cpp) + * """.trimIndent() + * val container = CMakeAnalyser().analysis(cmakeCode, "CMakeLists.txt") + * println(container.Fields.size) // 3 + * ``` */ class CMakeAnalyser : Analyser { override fun analysis(code: String, filePath: String): CodeContainer { diff --git a/chapi-parser-cmake/src/test/kotlin/chapi/parser/cmake/CMakeBasicListenerTest.kt b/chapi-parser-cmake/src/test/kotlin/chapi/parser/cmake/CMakeBasicListenerTest.kt index 51fc13d6..0e4acdc7 100644 --- a/chapi-parser-cmake/src/test/kotlin/chapi/parser/cmake/CMakeBasicListenerTest.kt +++ b/chapi-parser-cmake/src/test/kotlin/chapi/parser/cmake/CMakeBasicListenerTest.kt @@ -1,6 +1,5 @@ package chapi.parser.cmake; -import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Test