Skip to content

Commit

Permalink
Generate Java Sources from ANTLR grammars pre-compile
Browse files Browse the repository at this point in the history
  • Loading branch information
lkishalmi committed Mar 26, 2024
1 parent 39aa0fc commit ab9751f
Show file tree
Hide file tree
Showing 11 changed files with 7 additions and 12,800 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ derby.log
/java/languages.antlr/external/*.g4
/java/languages.antlr/external/LexerAdaptor.java

/ide/go.lang/src/org/antlr/parser/golang/Go*.java
/ide/languages.hcl/src/org/netbeans/modules/languages/hcl/grammar/*.java
/java/languages.antlr/src/org/antlr/parser/*/ANTLR*.java
# idea
Expand Down
8 changes: 4 additions & 4 deletions ide/go.lang/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ package org.antlr.parser.golang;
<property name="golang.outdir" location="${src.dir}/org/antlr/parser/golang"/>
<mkdir dir="${golang.outdir}"/>

<get src="https://raw.githubusercontent.com/antlr/grammars-v4/${golang.grammar.version}/golang/GoLexer.g4" dest="${golang.outdir}"/>
<get src="https://raw.githubusercontent.com/antlr/grammars-v4/${golang.grammar.version}/golang/GoParser.g4" dest="${golang.outdir}"/>
<get src="https://raw.githubusercontent.com/antlr/grammars-v4/${golang.grammar.version}/golang/GoLexer.g4" dest="${golang.outdir}/g4"/>
<get src="https://raw.githubusercontent.com/antlr/grammars-v4/${golang.grammar.version}/golang/GoParser.g4" dest="${golang.outdir}/g4"/>
<get src="https://raw.githubusercontent.com/antlr/grammars-v4/${golang.grammar.version}/golang/Java/GoParserBase.java" dest="${golang.outdir}"/>

<replace file="${golang.outdir}/GoParserBase.java">
Expand All @@ -82,14 +82,14 @@ import java.util.List;]]></replacevalue>
</replaceregexp>
</target>

<target name="generate-golang-parser" description="Regenerate the Go parser" depends="init">
<target name="generate-golang-parser" description="Regenerate the Go parser" depends="init" extensionOf="-pre-compile">
<property name="golang.outdir" location="${src.dir}/org/antlr/parser/golang"/>
<path id="antlr4.tool">
<fileset dir="../../ide/libs.antlr4.runtime/external" includes="*.jar"/>
<fileset dir="../../ide/libs.antlr3.runtime/external" includes="antlr-runtime-*.jar"/>
</path>

<java classname="org.antlr.v4.Tool" classpathref="antlr4.tool" fork="true" dir="${golang.outdir}">
<java classname="org.antlr.v4.Tool" classpathref="antlr4.tool" fork="true" dir="${golang.outdir}/g4">
<arg value="-o"/>
<arg value="${golang.outdir}"/>
<arg value="-visitor"/>
Expand Down
4 changes: 2 additions & 2 deletions ide/go.lang/licenseinfo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
-->
<licenseinfo>
<fileset>
<file>src/org/antlr/parser/golang/GoLexer.g4</file>
<file>src/org/antlr/parser/golang/GoParser.g4</file>
<file>src/org/antlr/parser/golang/g4/GoLexer.g4</file>
<file>src/org/antlr/parser/golang/g4/GoParser.g4</file>
<file>src/org/antlr/parser/golang/GoParserBase.java</file>
<license ref="BSD-antlr-go-grammar" />
</fileset>
Expand Down
899 changes: 0 additions & 899 deletions ide/go.lang/src/org/antlr/parser/golang/GoLexer.java

This file was deleted.

Loading

0 comments on commit ab9751f

Please sign in to comment.