在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):JetBrains/gradle-grammar-kit-plugin开源软件地址(OpenSource Url):https://github.com/JetBrains/gradle-grammar-kit-plugin开源编程语言(OpenSource Language):Kotlin 93.3%开源软件介绍(OpenSource Introduction):gradle-grammarkit-plugin
This Gradle plugin automates generating lexers and parsers to support custom language development in IntelliJ plugins when using Grammar-Kit. NB: The plugin does not support two-pass generation. Therefore, it does not support method mixins. UsageLoading and applying the pluginGroovy – plugins {
id "org.jetbrains.grammarkit" version "..."
} Kotlin DSL – plugins {
id("org.jetbrains.grammarkit") version "..."
} ConfigurationGlobal configuration allows you to select necessary JFlex and Grammar-Kit versions. Groovy – grammarKit {
// Version of IntelliJ patched JFlex (see the link below), Default is 1.7.0-1
jflexRelease = "1.7.0-1"
// Release version, tag, or short commit hash of Grammar-Kit to use (see link below). By default, the latest available is used.
grammarKitRelease = "2021.1.2"
// Optionally provide an IntelliJ version to build the classpath for GenerateParser/GenerateLexer tasks
intellijRelease = "203.7717.81"
} Kotlin DSL – grammarKit {
// Version of IntelliJ patched JFlex (see the link below), Default is 1.7.0-1
jflexRelease.set("1.7.0-1")
// Release version, tag, or short commit hash of Grammar-Kit to use (see link below). Default is 2021.1.2
grammarKitRelease.set("2021.1.2")
// Optionally provide an IntelliJ version to build the classpath for GenerateParser/GenerateLexer tasks
intellijRelease.set("203.7717.81")
} TasksGenerating lexerGroovy – generateLexer {
// source flex file
source = "grammar/Perl.flex"
// target directory for lexer
targetDir = "gen/com/perl5/lang/perl/lexer/"
// target classname, target file will be targetDir/targetClass.java
targetClass = "PerlLexer"
// optional, path to the task-specific skeleton file. Default: none
skeleton = new File("/some/specific/skeleton")
// if set, plugin will remove a lexer output file before generating new one. Default: false
purgeOldFiles = true
} Kotlin DSL – generateLexer {
// source flex file
source.set("grammar/Perl.flex")
// target directory for lexer
targetDir.set("gen/com/perl5/lang/perl/lexer/")
// target classname, target file will be targetDir/targetClass.java
targetClass.set("PerlLexer")
// optional, path to the task-specific skeleton file. Default: none
skeleton.set(File("/some/specific/skeleton"))
// if set, plugin will remove a lexer output file before generating new one. Default: false
purgeOldFiles.set(true)
} Generating parserGroovy – generateParser {
// source bnf file
source = "grammar/Perl5.bnf"
// optional, task-specific root for the generated files. Default: none
targetRoot = "gen"
// path to a parser file, relative to the targetRoot
pathToParser = "/com/perl5/lang/perl/parser/PerlParserGenerated.java"
// path to a directory with generated psi files, relative to the targetRoot
pathToPsiRoot = "/com/perl5/lang/perl/psi"
// if set, the plugin will remove a parser output file and psi output directory before generating new ones. Default: false
purgeOldFiles = true
} Kotlin DSL – generateParser {
// source bnf file
source.set("grammar/Perl5.bnf")
// optional, task-specific root for the generated files. Default: none
targetRoot.set("gen")
// path to a parser file, relative to the targetRoot
pathToParser.set("/com/perl5/lang/perl/parser/PerlParserGenerated.java")
// path to a directory with generated psi files, relative to the targetRoot
pathToPsiRoot.set("/com/perl5/lang/perl/psi")
// if set, the plugin will remove a parser output file and psi output directory before generating new ones. Default: false
purgeOldFiles.set(true)
} LinksUsage examples |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论