The Gradle Grammar-Kit Plugin automates generating lexers and parsers to support building custom language plugins for IntelliJ-based IDEs when using Grammar-Kit.
The plugin does not support two-pass generation. Therefore, it does not support method mixins.
Please see CONTRIBUTING on how to submit feedback and contribute to this project.
Before visiting the Issue Tracker, update both plugin and Gradle to the latest versions.
UsageTo enable this plugin in your Gradle-based project, register the plugin in the Gradle build script's plugins
section:
plugins { id("org.jetbrains.grammarkit") version "2022.3.2.2" }
plugins { id "org.jetbrains.grammarkit" version "2022.3.2.2" }
This project requires Gradle 7.4 or newer, however, it is recommended to use the latest Gradle available. See Gradle Installation guide.
ConfigurationSee also Usage Examples below.
Grammar-Kit ExtensionAfter the Gradle Grammar-Kit Plugin is applied, the grammarKit
extension can be used to configure the plugin and common settings of the provided tasks.
In most cases, explicit configuration can be omitted.
Example:
grammarKit { jflexRelease.set("1.7.0-1") grammarKitRelease.set("2021.1.2") }
grammarKit { jflexRelease = "1.7.0-1" grammarKitRelease = "2021.1.2" }
grammarKitReleaseThe release version of the Grammar-Kit to use.
String
2022.3.2
The version of the IntelliJ-patched JFlex, a fork of JFlex lexer generator for IntelliJ Platform API.
String
1.9.2
An optional IntelliJ IDEA version to build the classpath for GenerateParser
and GenerateLexer
tasks.
If provided, grammarKitRelease
and jflexRelease
properties are ignored as both dependencies will be provided from the given IntelliJ IDEA release.
String
null
The generateLexer
task generates a lexer for the given grammar.
The following sections describe task configuration options. See also Grammar-Kit Extension for common configuration.
sourceFileThe source .*flex file to generate the lexer from.
yes
String
The path to the target directory for the generated lexer.
yes
String
An optional path to the skeleton file to use for the generated lexer. The path will be provided as --skel
option. By default, it uses the idea-flex.skeleton skeleton file.
String
null
Purge old files from the target directory before generating the lexer.
Boolean
false
The generateParser
task generates a parser for the given grammar.
The following sections describe task configuration options. See also Grammar-Kit Extension for common configuration.
sourceFileThe source .bnf file to generate the parser from.
yes
String
The path to the target directory for the generated parser.
String
null
The location of the generated parser class, relative to the targetRootOutputDir
.
yes
String
The location of the generated PSI files, relative to the targetRootOutputDir
.
yes
String
Purge old files from the target directory before generating the parser.
Boolean
false
30 April 2025
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4