Skip to content

Commit

Permalink
feat(cmake): add CMakefile example and usage in CMakeAnalyser #24
Browse files Browse the repository at this point in the history
This commit adds a CMakefile example and demonstrates the usage of the CMakeAnalyser class in the README.md file. The example shows how to analyze a CMakeLists.txt file and extract relevant information using the CMakeAnalyser class.
  • Loading branch information
phodal committed Jan 30, 2024
1 parent 7c35520 commit 6ee6974
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
2 changes: 2 additions & 0 deletions chapi-parser-cmake/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# CMakefile

Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -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

Expand Down

0 comments on commit 6ee6974

Please sign in to comment.