project renamed to wson

This commit is contained in:
2021-01-13 08:47:02 +01:00
parent f96ab24ad7
commit 6422a91568
71 changed files with 462 additions and 494 deletions

18
antlr/build.sbt Normal file
View File

@@ -0,0 +1,18 @@
organization := (organization in LocalRootProject).value
name := "worth-antlr"
version := (version in LocalRootProject).value
resourceDirectory := (resourceDirectory in(LocalRootProject, Test)).value
antlr4Version in Antlr4 := Versions.antlr
antlr4PackageName in Antlr4 := Some("net.woggioni.worth.antlr")
skip in publish := true
libraryDependencies += "org.projectlombok" % "lombok" % Versions.lombok % Provided
libraryDependencies += "com.fasterxml.jackson.core" % "jackson-databind" % Versions.jackson % Test
libraryDependencies += "org.tukaani" % "xz" % Versions.xz % Test
libraryDependencies += "org.antlr" % "antlr4" % Versions.antlr % Test
libraryDependencies += "org.antlr" % "antlr4-runtime" % Versions.antlr % Test
libraryDependencies += "net.aichler" % "jupiter-interface" % JupiterKeys.jupiterVersion.value % Test
libraryDependencies += "org.junit.jupiter" % "junit-jupiter-params" % JupiterKeys.junitJupiterVersion.value % Test
enablePlugins(JupiterPlugin)

View File

@@ -1,7 +1,7 @@
package net.woggioni.worth.antlr;
package net.woggioni.wson.antlr;
import net.woggioni.worth.serialization.ValueParser;
import net.woggioni.worth.xface.Value;
import net.woggioni.wson.serialization.ValueParser;
import net.woggioni.wson.xface.Value;
import org.antlr.v4.runtime.ParserRuleContext;
import org.antlr.v4.runtime.tree.ErrorNode;
import org.antlr.v4.runtime.tree.TerminalNode;

View File

@@ -1,25 +1,25 @@
package net.woggioni.worth.antlr;
package net.woggioni.wson.antlr;
import lombok.SneakyThrows;
import net.woggioni.worth.serialization.JsonBombTest;
import net.woggioni.worth.serialization.json.JSONDumper;
import net.woggioni.worth.xface.Value;
import net.woggioni.wson.serialization.json.JSONDumper;
import net.woggioni.wson.xface.Value;
import org.antlr.v4.runtime.CharStream;
import org.antlr.v4.runtime.CharStreams;
import org.antlr.v4.runtime.CodePointCharStream;
import org.antlr.v4.runtime.CommonTokenStream;
import org.antlr.v4.runtime.tree.ParseTreeWalker;
import org.junit.Test;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import java.io.InputStreamReader;
import static net.woggioni.worth.serialization.JsonBombTest.infiniteJson;
import static net.woggioni.wson.test.JsonBomb.infiniteJson;
public class ParseTest {
@Test
@SneakyThrows
public void test(){
public void test() {
CodePointCharStream inputStream = CharStreams.fromReader(new InputStreamReader(getClass().getResourceAsStream("/test.json")));
JSONLexer lexer = new JSONLexer(inputStream);
CommonTokenStream commonTokenStream = new CommonTokenStream(lexer);
@@ -31,13 +31,14 @@ public class ParseTest {
new JSONDumper().dump(result, System.out);
}
@Test(expected = OutOfMemoryError.class)
@Test
@Disabled
@SneakyThrows
public void antlr() {
CharStream inputStream = CharStreams.fromReader(new InputStreamReader(infiniteJson()));
JSONLexer lexer = new JSONLexer(inputStream);
CommonTokenStream commonTokenStream = new CommonTokenStream(lexer);
net.woggioni.worth.antlr.JSONParser parser = new net.woggioni.worth.antlr.JSONParser(commonTokenStream);
net.woggioni.wson.antlr.JSONParser parser = new net.woggioni.wson.antlr.JSONParser(commonTokenStream);
JSONListenerImpl listener = new JSONListenerImpl();
ParseTreeWalker walker = new ParseTreeWalker();
walker.walk(listener, parser.json());

View File

@@ -1,23 +1,23 @@
package net.woggioni.worth.serialization.json;
package net.woggioni.wson.serialization.json;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.SneakyThrows;
import net.woggioni.jwo.Chronometer;
import net.woggioni.worth.antlr.JSONLexer;
import net.woggioni.worth.antlr.JSONListenerImpl;
import net.woggioni.worth.serialization.binary.JBONDumper;
import net.woggioni.worth.serialization.binary.JBONParser;
import net.woggioni.worth.value.ObjectValue;
import net.woggioni.worth.xface.Dumper;
import net.woggioni.worth.xface.Parser;
import net.woggioni.worth.xface.Value;
import net.woggioni.wson.antlr.JSONLexer;
import net.woggioni.wson.antlr.JSONListenerImpl;
import net.woggioni.wson.serialization.binary.JBONDumper;
import net.woggioni.wson.serialization.binary.JBONParser;
import net.woggioni.wson.value.ObjectValue;
import net.woggioni.wson.xface.Dumper;
import net.woggioni.wson.xface.Parser;
import net.woggioni.wson.xface.Value;
import org.antlr.v4.runtime.CharStream;
import org.antlr.v4.runtime.CharStreams;
import org.antlr.v4.runtime.CommonTokenStream;
import org.antlr.v4.runtime.tree.ParseTreeWalker;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.tukaani.xz.XZInputStream;
import java.io.BufferedInputStream;
@@ -44,7 +44,7 @@ public class PerformanceTest {
}
@Test
@Ignore
@Disabled
@SneakyThrows
public void profilerTest() {
while (true) {
@@ -86,7 +86,7 @@ public class PerformanceTest {
CharStream inputStream = CharStreams.fromReader(new InputStreamReader(smallTestData()));
JSONLexer lexer = new JSONLexer(inputStream);
CommonTokenStream commonTokenStream = new CommonTokenStream(lexer);
net.woggioni.worth.antlr.JSONParser parser = new net.woggioni.worth.antlr.JSONParser(commonTokenStream);
net.woggioni.wson.antlr.JSONParser parser = new net.woggioni.wson.antlr.JSONParser(commonTokenStream);
JSONListenerImpl listener = new JSONListenerImpl();
ParseTreeWalker walker = new ParseTreeWalker();
walker.walk(listener, parser.json());
@@ -98,7 +98,7 @@ public class PerformanceTest {
}
@Test
@Ignore
@Disabled
@SneakyThrows
public void hugeJSONTest() {
double jacksonTime, worthTime, antlrTime;
@@ -132,7 +132,7 @@ public class PerformanceTest {
CharStream inputStream = CharStreams.fromReader(new InputStreamReader(is));
JSONLexer lexer = new JSONLexer(inputStream);
CommonTokenStream commonTokenStream = new CommonTokenStream(lexer);
net.woggioni.worth.antlr.JSONParser parser = new net.woggioni.worth.antlr.JSONParser(commonTokenStream);
net.woggioni.wson.antlr.JSONParser parser = new net.woggioni.wson.antlr.JSONParser(commonTokenStream);
JSONListenerImpl listener = new JSONListenerImpl();
ParseTreeWalker walker = new ParseTreeWalker();
walker.walk(listener, parser.json());
@@ -142,9 +142,9 @@ public class PerformanceTest {
}
@Test
@Ignore
@Disabled
@SneakyThrows
public void tess() {
public void test() {
Value value;
try(InputStream is = extractTestData()) {
Parser parser = JSONParser.newInstance();