-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(plugin): implement grammar generator
- Loading branch information
1 parent
4a70200
commit bc6e711
Showing
24 changed files
with
611 additions
and
227 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,5 +26,6 @@ style: | |
- "3" | ||
- "10" | ||
- "16" | ||
- "0x7F" | ||
ReturnCount: | ||
max: 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import java.util.Properties | ||
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion | ||
|
||
group = "io.github.tree-sitter" | ||
version = with(Properties()) { | ||
file("../gradle.properties").reader().use(::load) | ||
getProperty("project.version") | ||
} | ||
|
||
plugins { | ||
`kotlin-dsl` | ||
id("com.gradle.plugin-publish") version "1.2.1" | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
kotlin { | ||
compilerOptions { | ||
languageVersion.set(KotlinVersion.KOTLIN_1_9) | ||
} | ||
} | ||
|
||
@Suppress("UnstableApiUsage") | ||
gradlePlugin { | ||
vcsUrl = "https://github.com/tree-sitter/kotlin-tree-sitter" | ||
website = "https://github.com/tree-sitter/kotlin-tree-sitter/tree/master/plugin" | ||
plugins.create("ktreesitter") { | ||
id = "$group.${project.name}" | ||
displayName = "KTreeSitter grammar plugin" | ||
description = "A plugin that generates code for KTreeSitter grammar packages" | ||
implementationClass = "io.github.treesitter.ktreesitter.plugin.GrammarPlugin" | ||
tags = listOf("tree-sitter", "code", "generator") | ||
} | ||
} | ||
|
||
tasks.validatePlugins { | ||
enableStricterValidation.set(true) | ||
} |
16 changes: 16 additions & 0 deletions
16
...sitter-plugin/src/main/kotlin/io/github/treesitter/ktreesitter/plugin/GrammarExtension.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package io.github.treesitter.ktreesitter.plugin | ||
|
||
import java.io.File | ||
import org.gradle.api.provider.MapProperty | ||
import org.gradle.api.provider.Property | ||
|
||
abstract class GrammarExtension { | ||
abstract val baseDir: Property<File> | ||
abstract val grammarName: Property<String> | ||
abstract val files: Property<Array<File>> | ||
abstract val interopName: Property<String> | ||
abstract val libraryName: Property<String> | ||
abstract val packageName: Property<String> | ||
abstract val className: Property<String> | ||
abstract val languageMethods: MapProperty<String, String> | ||
} |
Oops, something went wrong.