mirror of
https://github.com/ethauvin/bld-antlr4.git
synced 2025-04-25 16:57:11 -07:00
GitHub setup
This commit is contained in:
parent
c88b734e1e
commit
7394a21115
4 changed files with 117 additions and 1 deletions
30
README.md
Normal file
30
README.md
Normal file
|
@ -0,0 +1,30 @@
|
|||
# [Bld](https://github.com/rife2/rife2/wiki/What-Is-Bld) extension to generate ANTLR4 parsers
|
||||
|
||||
[](https://opensource.org/licenses/Apache-2.0)
|
||||
[](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html)
|
||||
[](https://github.com/rife2/bld-antlr4/releases/latest)
|
||||
[](https://github.com/rife2/bld-antrl4/actions/workflows/bld.yml)
|
||||
|
||||
An extension for generating Java sources from ANTLR4 parsers.
|
||||
|
||||
```java
|
||||
private final Antlr4Operation antlr4Operation_ = new Antlr4Operation();
|
||||
@BuildCommand
|
||||
public void generateGrammar()
|
||||
throws Exception {
|
||||
antlr4Operation_.executeOnce(o -> o
|
||||
.sourceDirectories(List.of(new File(srcMainDirectory(), "antlr")))
|
||||
.outputDirectory(new File(buildDirectory(), "generated"))
|
||||
.visitor()
|
||||
.longMessages());
|
||||
}
|
||||
|
||||
// compileOperation_ is part of the main project
|
||||
public void compile()
|
||||
throws Exception {
|
||||
generateGrammar();
|
||||
compileOperation_.executeOnce(o -> o
|
||||
.fromProject(this)
|
||||
.mainSourceDirectories(List.of(antlr4Operation_.outputDirectory())));
|
||||
}
|
||||
```
|
Loading…
Add table
Add a link
Reference in a new issue