Skip to content

Commit

Permalink
Generate Java Sources from JSON grammars pre-compile
Browse files Browse the repository at this point in the history
  • Loading branch information
vieiro committed Mar 30, 2024
1 parent c347ece commit 1bfd7f9
Show file tree
Hide file tree
Showing 17 changed files with 32 additions and 1,464 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -113,5 +113,8 @@ derby.log
/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

/webcommon/javascript2.json/src/org/netbeans/modules/javascript2/json/parser/Json*.java

# idea
.idea
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@
import java.util.List;
import org.antlr.v4.runtime.ParserRuleContext;
import org.netbeans.api.lexer.TokenSequence;
import org.netbeans.modules.javascript2.json.parser.JsonBaseVisitor;
import org.netbeans.modules.javascript2.json.parser.JsonParser;
import org.netbeans.modules.javascript2.lexer.api.JsTokenId;

import static org.netbeans.modules.javascript2.editor.formatter.TokenUtils.*;
import org.netbeans.modules.javascript2.json.parser.JsonParserBaseVisitor;

/**
*
* @author Dusan Balek
*/
public class JsonFormatVisitor extends JsonBaseVisitor<Void> {
public class JsonFormatVisitor extends JsonParserBaseVisitor<Void> {

private final TokenUtils tokenUtils;

Expand Down
2 changes: 1 addition & 1 deletion webcommon/javascript2.json/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<description>Builds, tests, and runs the project org.netbeans.modules.javascript2.json</description>
<import file="../../nbbuild/templates/projectized.xml"/>

<target name="generate-antlr-parser" description="Regenerate the JSON parser" depends="init">
<target name="generate-antlr-parser" description="Regenerate the JSON parser" depends="init" extensionOf="-pre-compile">
<property name="antlr.outdir" location="${src.dir}/org/netbeans/modules/javascript2/json/parser"/>
<path id="antlr4.tool">
<fileset dir="../../ide/libs.antlr4.runtime/external" includes="*.jar"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#Signature file v4.1
#Version 1.26
#Version 1.28

CLSS public java.lang.Object
cons public init()
Expand Down Expand Up @@ -333,14 +333,6 @@ meth public void removePropertyChangeListener(java.beans.PropertyChangeListener)
supr java.lang.Object
hfds delegates,listeners,listens,pcl

CLSS public org.netbeans.modules.javascript2.json.parser.JsonBaseListener
cons public init()
supr org.netbeans.modules.javascript2.json.parser.JsonParserBaseListener

CLSS public org.netbeans.modules.javascript2.json.parser.JsonBaseVisitor<%0 extends java.lang.Object>
cons public init()
supr org.netbeans.modules.javascript2.json.parser.JsonParserBaseVisitor<{org.netbeans.modules.javascript2.json.parser.JsonBaseVisitor%0}>

CLSS public org.netbeans.modules.javascript2.json.parser.JsonLexer
cons public init(org.antlr.v4.runtime.CharStream)
cons public init(org.antlr.v4.runtime.CharStream,boolean)
Expand Down Expand Up @@ -402,9 +394,6 @@ meth public int hashCode()
supr java.lang.Object
hfds atnState

CLSS public abstract interface org.netbeans.modules.javascript2.json.parser.JsonListener
intf org.netbeans.modules.javascript2.json.parser.JsonParserListener

CLSS public org.netbeans.modules.javascript2.json.parser.JsonParser
cons public init(org.antlr.v4.runtime.TokenStream)
fld protected final static org.antlr.v4.runtime.atn.PredictionContextCache _sharedContextCache
Expand Down Expand Up @@ -597,9 +586,6 @@ meth public abstract {org.netbeans.modules.javascript2.json.parser.JsonParserVis
meth public abstract {org.netbeans.modules.javascript2.json.parser.JsonParserVisitor%0} visitPair(org.netbeans.modules.javascript2.json.parser.JsonParser$PairContext)
meth public abstract {org.netbeans.modules.javascript2.json.parser.JsonParserVisitor%0} visitValue(org.netbeans.modules.javascript2.json.parser.JsonParser$ValueContext)

CLSS public abstract interface org.netbeans.modules.javascript2.json.parser.JsonVisitor<%0 extends java.lang.Object>
intf org.netbeans.modules.javascript2.json.parser.JsonParserVisitor<{org.netbeans.modules.javascript2.json.parser.JsonVisitor%0}>

CLSS public org.netbeans.modules.javascript2.json.parser.ParseTreeToXml
cons public init(org.netbeans.modules.javascript2.json.parser.JsonLexer,org.netbeans.modules.javascript2.json.parser.JsonParser)
anno 1 org.netbeans.api.annotations.common.NonNull()
Expand All @@ -614,7 +600,7 @@ meth public org.w3c.dom.Document visitValue(org.netbeans.modules.javascript2.jso
meth public static java.lang.String stringify(org.w3c.dom.Document) throws java.io.IOException
anno 0 org.netbeans.api.annotations.common.NonNull()
anno 1 org.netbeans.api.annotations.common.NonNull()
supr org.netbeans.modules.javascript2.json.parser.JsonBaseVisitor<org.w3c.dom.Document>
supr org.netbeans.modules.javascript2.json.parser.JsonParserBaseVisitor<org.w3c.dom.Document>
hfds currentNode,doc,lexer,parser

CLSS public abstract interface org.netbeans.modules.javascript2.json.spi.JsonOptionsQueryImplementation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,16 @@
package org.netbeans.modules.javascript2.json.parser;

/**
* This class provides an empty implementation of {@link JsonListener},
* which can be extended to create a listener which only needs to handle a subset
* of the available methods.
* This class provides an empty implementation of {@link JsonListener}, which
* can be extended to create a listener which only needs to handle a subset of
* the available methods.
*
* @deprecated This class is deprecated since Antlr4.13.1. Use
* JsonParserBaseListener instead.
* @see JsonParserBaseListener
*
*/
@Deprecated
@SuppressWarnings("CheckReturnValue")
public class JsonBaseListener extends JsonParserBaseListener {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,18 @@
package org.netbeans.modules.javascript2.json.parser;

/**
* This class provides an empty implementation of {@link JsonVisitor},
* which can be extended to create a visitor which only needs to handle a subset
* of the available methods.
* This class provides an empty implementation of {@link JsonVisitor}, which can
* be extended to create a visitor which only needs to handle a subset of the
* available methods.
*
*
* @param <T> The return type of the visit operation. Use {@link Void} for
* operations with no return type.
* @deprecated This class is deprecated since Antlr4.13.1. Use
* JsonParserBaseVisitor instead.
* @see JsonParserBaseVisitor
*/
@Deprecated
@SuppressWarnings("CheckReturnValue")
public class JsonBaseVisitor<T> extends JsonParserBaseVisitor<T> {
}
}
Loading

0 comments on commit 1bfd7f9

Please sign in to comment.