diff --git a/pom.xml b/pom.xml
index a4f803401d6..ac8b5bd79c4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -31,7 +31,7 @@
7.5.0
3.9.8
org.rascalmpl.shell.RascalShell
- 2
+ 3
11
0.28.9-BOOT1
diff --git a/src/org/rascalmpl/ast/Expression.java b/src/org/rascalmpl/ast/Expression.java
index 9d066321bfa..1babdf54a65 100644
--- a/src/org/rascalmpl/ast/Expression.java
+++ b/src/org/rascalmpl/ast/Expression.java
@@ -33,13 +33,6 @@ public boolean hasArguments() {
public java.util.List getArguments() {
throw new UnsupportedOperationException();
}
- public boolean hasElements() {
- return false;
- }
-
- public java.util.List getElements() {
- throw new UnsupportedOperationException();
- }
public boolean hasElements0() {
return false;
}
@@ -6395,15 +6388,15 @@ public boolean isTuple() {
}
static public class Tuple extends Expression {
- // Production: sig("Tuple",[arg("java.util.List\","elements")],breakable=false)
+ // Production: sig("Tuple",[arg("java.util.List\","elements0")],breakable=false)
- private final java.util.List elements;
+ private final java.util.List elements0;
- public Tuple(ISourceLocation src, IConstructor node , java.util.List elements) {
+ public Tuple(ISourceLocation src, IConstructor node , java.util.List elements0) {
super(src, node);
- this.elements = elements;
+ this.elements0 = elements0;
}
@Override
@@ -6423,7 +6416,7 @@ protected void addForLineNumber(int $line, java.util.List $result)
}
ISourceLocation $l;
- for (AbstractAST $elem : elements) {
+ for (AbstractAST $elem : elements0) {
$l = $elem.getLocation();
if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) {
$elem.addForLineNumber($line, $result);
@@ -6441,28 +6434,28 @@ public boolean equals(Object o) {
return false;
}
Tuple tmp = (Tuple) o;
- return true && tmp.elements.equals(this.elements) ;
+ return true && tmp.elements0.equals(this.elements0) ;
}
@Override
public int hashCode() {
- return 599 + 863 * elements.hashCode() ;
+ return 599 + 863 * elements0.hashCode() ;
}
@Override
- public java.util.List getElements() {
- return this.elements;
+ public java.util.List getElements0() {
+ return this.elements0;
}
@Override
- public boolean hasElements() {
+ public boolean hasElements0() {
return true;
}
@Override
public Object clone() {
- return newInstance(getClass(), src, (IConstructor) null , clone(elements));
+ return newInstance(getClass(), src, (IConstructor) null , clone(elements0));
}
}
diff --git a/src/org/rascalmpl/interpreter/utils/IUPTRAstToSymbolConstructor.java b/src/org/rascalmpl/interpreter/utils/IUPTRAstToSymbolConstructor.java
index 900708bace3..3d7485eb447 100644
--- a/src/org/rascalmpl/interpreter/utils/IUPTRAstToSymbolConstructor.java
+++ b/src/org/rascalmpl/interpreter/utils/IUPTRAstToSymbolConstructor.java
@@ -109,7 +109,7 @@ public IConstructor visitExpressionCallOrTree(CallOrTree x) {
if (name.equals("seq")) {
IList list = vf.list();
Expression.List arg = (List) x.getArguments().get(0);
- for (Expression y: arg.getElements()) {
+ for (Expression y: arg.getElements0()) {
list = list.append(y.accept(this));
}
return vf.constructor(RascalValueFactory.Symbol_Seq, list);
@@ -124,7 +124,7 @@ public IConstructor visitExpressionCallOrTree(CallOrTree x) {
if (name.equals("alt")) {
ISet set = vf.set();
Expression.Set arg = (Set) x.getArguments().get(0);
- for(Expression y: arg.getElements()){
+ for(Expression y: arg.getElements0()){
set = set.insert(y.accept(this));
}
return vf.constructor(RascalValueFactory.Symbol_Alt, set);
@@ -134,7 +134,7 @@ public IConstructor visitExpressionCallOrTree(CallOrTree x) {
java.util.List args = x.getArguments();
IConstructor head = args.get(0).accept(this);
IList rest = vf.list();
- for (Expression arg: ((Expression.List)args.get(1)).getElements()) {
+ for (Expression arg: ((Expression.List)args.get(1)).getElements0()) {
rest = rest.append(arg.accept(this));
}
return vf.constructor(RascalValueFactory.Symbol_Tuple, head, rest);
@@ -171,7 +171,7 @@ public IConstructor visitExpressionCallOrTree(CallOrTree x) {
IConstructor arg = x.getArguments().get(0).accept(this);
Expression.List args = (Expression.List) x.getArguments().get(1);
IList seps = vf.list();
- for (Expression elem: args.getElements()) {
+ for (Expression elem: args.getElements0()) {
seps = seps.append(elem.accept(this));
}
return vf.constructor(RascalValueFactory.Symbol_IterStarSeps, arg, seps);
@@ -181,7 +181,7 @@ public IConstructor visitExpressionCallOrTree(CallOrTree x) {
IConstructor arg = x.getArguments().get(0).accept(this);
Expression.List args = (Expression.List) x.getArguments().get(1);
IList seps = vf.list();
- for (Expression elem: args.getElements()) {
+ for (Expression elem: args.getElements0()) {
seps = seps.append(elem.accept(this));
}
return vf.constructor(RascalValueFactory.Symbol_IterSeps, arg, seps);
@@ -192,7 +192,7 @@ public IConstructor visitExpressionCallOrTree(CallOrTree x) {
StringConstant.Lexical sort = (org.rascalmpl.ast.StringConstant.Lexical)
x.getArguments().get(0).getLiteral().getStringLiteral().getConstant();
IList rest = vf.list();
- for (Expression arg: ((Expression.List)args.get(1)).getElements()) {
+ for (Expression arg: ((Expression.List)args.get(1)).getElements0()) {
rest = rest.append(arg.accept(this));
}
return vf.constructor(RascalValueFactory.Symbol_ParameterizedSort, vf.string(sort.getString()), rest);
@@ -209,7 +209,7 @@ public IConstructor visitExpressionCallOrTree(CallOrTree x) {
if (name.equals("char-class")) {
java.util.List args = x.getArguments();
IList ranges = vf.list();
- for (Expression arg: ((Expression.List)args.get(0)).getElements()) {
+ for (Expression arg: ((Expression.List)args.get(0)).getElements0()) {
ranges = ranges.append(arg.accept(this));
}
return vf.constructor(RascalValueFactory.Symbol_CharClass, ranges);
diff --git a/src/org/rascalmpl/library/List.rsc b/src/org/rascalmpl/library/List.rsc
index 2f05b116005..7d81d546a67 100644
--- a/src/org/rascalmpl/library/List.rsc
+++ b/src/org/rascalmpl/library/List.rsc
@@ -96,8 +96,17 @@ dup([3, 1, 5, 3, 1, 7, 1, 2]);
list[&T] dup(list[&T] lst)
= ([] | (ix in it) ? it : it + [ix] | &T ix <- lst);
-@deprecated{Use a list index instead}
@javaClass{org.rascalmpl.library.Prelude}
+@synopsis{A function that implements `lst[index]`}
+@description{
+The expression `lst[index]` has the same semantics as calling `elementAt(index)`.
+}
+@benefits{
+* ((elementAt)) can be passed a function argument.
+}
+@pitfalls{
+* `lst[index]` is significantly faster than `elementAt(index)`
+}
java &T elementAt(list[&T] lst, int index);
@@ -431,9 +440,10 @@ permutations([1,2,3]);
set[list[&T]] permutations(list[&T] lst) =
permutationsBag(distribution(lst));
-private set[list[&T]] permutationsBag(map[&T element, int occurs] b) =
- isEmpty(b) ? {[]} :
- { [e] + rest | e <- b, rest <- permutationsBag(removeFromBag(b,e))};
+private set[list[&T]] permutationsBag(map[&T element, int occurs] b)
+ = isEmpty(b)
+ ? {[]}
+ : { [e] + rest | e <- b, rest <- permutationsBag(removeFromBag(b,e))};
@synopsis{Pop top element from list, return a tuple.}
@@ -480,9 +490,10 @@ list[&T] push(&T elem, list[&T] lst) = [elem] + lst;
@synopsis{Apply a function to successive elements of list and combine the results.}
-@deprecated{This function is deprecated. Use a reducer expression instead, like `(init | f(it, e) | e <- lst)`.}
@description{
Apply the function `fn` to successive elements of list `lst` starting with `unit`.
+The function application `reducer(lst, add, 0)` has the same semantics
+as the expression `(0 | add(it, e) | e <- lst)`.
}
@examples{
```rascal-shell
@@ -491,16 +502,24 @@ int add(int x, int y) { return x + y; }
reducer([10, 20, 30, 40], add, 0);
```
}
-&T reducer(list[&T] lst, &T (&T, &T) fn, &T unit) = (unit | fn(it, elm) | elm <- lst);
+@benefits{
+* reducer can be passed as a function argument
+}
+@pitfalls{
+* a reducer expression can be a lot faster
+* reducer expressions are more versatile (allowing multiple generators and filters)
+}
+&T reducer(list[&T] lst, &T (&T, &T) fn, &T unit)
+ = (unit | fn(it, elm) | elm <- lst);
-list[&T] remove(list[&T] lst, int indexToDelete) =
- [ lst[i] | i <- index(lst), i != indexToDelete ];
+list[&T] remove(list[&T] lst, int indexToDelete)
+ = [ lst[i] | i <- index(lst), i != indexToDelete ];
-private map[&T element, int occurs] removeFromBag(map[&T element, int occurs] b, &T el) =
- removeFromBag(b,el,1);
+private map[&T element, int occurs] removeFromBag(map[&T element, int occurs] b, &T el)
+ = removeFromBag(b,el,1);
-private map[&T element, int occurs] removeFromBag(map[&T element, int occurs] b, &T el, int nr) =
- !(b[el] ?) ? b : (b[el] <= nr ? b - (el : b[el]) : b + (el : b[el] - nr));
+private map[&T element, int occurs] removeFromBag(map[&T element, int occurs] b, &T el, int nr)
+ = !(b[el] ?) ? b : (b[el] <= nr ? b - (el : b[el]) : b + (el : b[el] - nr));
@synopsis{Reverse a list.}
diff --git a/src/org/rascalmpl/library/Prelude.java b/src/org/rascalmpl/library/Prelude.java
index d873d1e01f3..75f95c58cd6 100644
--- a/src/org/rascalmpl/library/Prelude.java
+++ b/src/org/rascalmpl/library/Prelude.java
@@ -263,7 +263,7 @@ public IValue incrementDays(IDateTime dt, IInteger n)
return incrementDate(dt, Calendar.DAY_OF_MONTH, "days", n);
}
- private String getTZString(int hourOffset, int minuteOffset) {
+ public static String getTZString(int hourOffset, int minuteOffset) {
String tzString = "GMT" +
((hourOffset < 0 || (0 == hourOffset && minuteOffset < 0)) ? "-" : "+") +
String.format("%02d",hourOffset >= 0 ? hourOffset : hourOffset * -1) +
@@ -629,7 +629,7 @@ private Calendar getCalendarForTime(IDateTime inputTime) {
}
}
- private Calendar getCalendarForDateTime(IDateTime inputDateTime) {
+ public static Calendar getCalendarForDateTime(IDateTime inputDateTime) {
if (inputDateTime.isDateTime()) {
Calendar cal = Calendar.getInstance(TimeZone.getTimeZone(getTZString(inputDateTime.getTimezoneOffsetHours(),inputDateTime.getTimezoneOffsetMinutes())),Locale.getDefault());
cal.setLenient(false);
diff --git a/src/org/rascalmpl/library/lang/json/Factory.java b/src/org/rascalmpl/library/lang/json/Factory.java
deleted file mode 100644
index ef2c12b958e..00000000000
--- a/src/org/rascalmpl/library/lang/json/Factory.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package org.rascalmpl.library.lang.json;
-
-import io.usethesource.vallang.type.Type;
-import io.usethesource.vallang.type.TypeFactory;
-import io.usethesource.vallang.type.TypeStore;
-
-public class Factory {
- private static final TypeFactory tf = TypeFactory.getInstance();
- private static final TypeStore json = new TypeStore();
-
- public static final Type JSON = tf.abstractDataType(json, "JSON");
-
- public static final Type JSON_null = tf.constructor(json, JSON, "null");
-
- public static final Type JSON_object = tf.constructor(json, JSON, "object",
- tf.mapType(tf.stringType(), JSON), "properties");
-
- public static final Type JSON_array = tf.constructor(json, JSON, "array",
- tf.listType(JSON), "values");
-
- public static final Type JSON_number = tf.constructor(json, JSON, "number", tf.realType(), "n");
- public static final Type JSON_string = tf.constructor(json, JSON, "string", tf.stringType(), "s");
- public static final Type JSON_boolean = tf.constructor(json, JSON, "boolean", tf.boolType(), "b");
-
- public static final Type JSON_ivalue = tf.constructor(json, JSON, "ivalue", tf.valueType(), "v");
-
-
-
-}
diff --git a/src/org/rascalmpl/library/lang/json/IO.java b/src/org/rascalmpl/library/lang/json/IO.java
index 43d8fd3ece4..c96dd763cb0 100644
--- a/src/org/rascalmpl/library/lang/json/IO.java
+++ b/src/org/rascalmpl/library/lang/json/IO.java
@@ -23,8 +23,6 @@
import java.util.stream.Collectors;
import org.rascalmpl.debug.IRascalMonitor;
import org.rascalmpl.exceptions.RuntimeExceptionFactory;
-import org.rascalmpl.library.lang.json.internal.IValueAdapter;
-import org.rascalmpl.library.lang.json.internal.JSONReadingTypeVisitor;
import org.rascalmpl.library.lang.json.internal.JsonValueReader;
import org.rascalmpl.library.lang.json.internal.JsonValueWriter;
import org.rascalmpl.types.ReifiedType;
@@ -45,13 +43,8 @@
import io.usethesource.vallang.type.Type;
import io.usethesource.vallang.type.TypeStore;
-import com.google.gson.FieldNamingPolicy;
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-import com.google.gson.reflect.TypeToken;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
-import com.ibm.icu.text.DateFormat;
public class IO {
private final IRascalValueFactory values;
@@ -62,48 +55,7 @@ public IO(IRascalValueFactory values, IRascalMonitor monitor) {
this.values = values;
this.monitor = monitor;
}
-
- public IString toJSON(IValue value) {
- return toJSON(value, this.values.bool(false));
- }
-
- public IString toJSON(IValue value, IBool compact) {
- IValueAdapter adap = new IValueAdapter(compact.getValue());
- Gson gson = new GsonBuilder()
- .registerTypeAdapter(IValue.class, adap)
- .enableComplexMapKeySerialization()
- .setDateFormat(DateFormat.LONG)
- .setFieldNamingPolicy(FieldNamingPolicy.UPPER_CAMEL_CASE)
- .setVersion(1.0)
- .disableHtmlEscaping()
- .create();
- try {
- String json = gson.toJson(value, new TypeToken() {}.getType());
- return values.string(json);
- } catch (Exception e) {
- throw RuntimeExceptionFactory.io(values.string(e.getMessage()), null, null);
- }
- }
-
- public IValue fromJSON(IValue type, IString src) {
- TypeStore store = new TypeStore();
- Type start = new TypeReifier(values).valueToType((IConstructor) type, store);
- Gson gson = new GsonBuilder()
- .enableComplexMapKeySerialization()
- .setDateFormat(DateFormat.LONG)
- .setFieldNamingPolicy(FieldNamingPolicy.UPPER_CAMEL_CASE)
- .setVersion(1.0)
- .create();
- Object obj = gson.fromJson(src.getValue(), Object.class);
- try {
- return JSONReadingTypeVisitor.read(obj, values, store, start);
- }
- catch (IOException e) {
- throw RuntimeExceptionFactory.io(values.string(e.getMessage()), null, null);
- }
- }
-
public IValue readJSON(IValue type, ISourceLocation loc, IString dateTimeFormat, IBool lenient, IBool trackOrigins, IFunction parsers, IMap nulls, IBool explicitConstructorNames, IBool explicitDataTypes) {
TypeStore store = new TypeStore();
Type start = new TypeReifier(values).valueToType((IConstructor) type, store);
diff --git a/src/org/rascalmpl/library/lang/json/IO.rsc b/src/org/rascalmpl/library/lang/json/IO.rsc
index 2f40b1d4559..f66f2457deb 100644
--- a/src/org/rascalmpl/library/lang/json/IO.rsc
+++ b/src/org/rascalmpl/library/lang/json/IO.rsc
@@ -5,13 +5,65 @@
which accompanies this distribution, and is available at
http://www.eclipse.org/legal/epl-v10.html
}
-@synopsis{(De)serialization of JSON values.}
+@synopsis{Serialization of Rascal values to JSON format and deserialization back from JSON format to Rascal values.}
@contributor{Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI}
@contributor{Mark Hills - Mark.Hills@cwi.nl (CWI)}
@contributor{Arnold Lankamp - Arnold.Lankamp@cwi.nl}
@contributor{Tijs van der Storm - storm@cwi.nl (CWI)}
@contributor{Davy Landman - landman@cwi.nl (CWI)}
-
+@description{
+The pairs ((asJSON)):((parseJSON)) and ((writeJSON)):((readJSON)) are both bi-directional
+transformations between serializable Rascal values (all except function instances) and JSON strings.
+The ((asJSON)) and ((parseJSON)) work on `str` representations, while ((writeJSON)) and ((readJSON))
+stream to/from files directly.
+
+The basic principle of the bi-directional mapping is that constructors of algebraic data-types
+map one-to-one to JSON object notation, and vice versa. The other builtin Rascal data-structures
+are judiciously mapped to objects and arrays, and strings, etc. The goal is that their representation
+is natural on the receiving end (e.g. TypeScript, Javascript and Python code), without sacrificing
+on the naturalness of the Rascal representation.
+}
+@pitfalls{
+* ((asJSON)) and ((writeJSON)) are not isomorphisms. They are homomorphisms that choose
+JSON arrays or JSON objects for multiple different kinds of Rascal values. For example
+maps and nodes and ADT's are all mapped to JSON object notation (homonyms).
+* JSON is a serialization format that does not deal with programming language numerical
+encodings such as `double`, `float`` or `long`. ((writeJSON)) and ((asJSON)) might write numbers
+beyond the limits and beyond the accuracy of what the other programming language can deal with.
+You can expect errors at the time when the other language (Javascript, Python, TypeScript) reads these numbers from JSON.
+}
+@benefits{
+* Using the `expected`` type arguments of ((parseJSON)) and ((readJSON)) the homonyms created by ((asJSON)) and ((writeJSON)) can be converted back to their
+original Rascal structures. If the expected type contains only _concrete types_, and no _abstract types_ then
+then pairs ((asJSON))/((parseJSON)) and ((writeJSON))/((readJSON)) are isomorphic.
+ * The _abstract types_ are `value`, `node`, `num` or any composite type that contains it. `Maybe[value]` is an example of an abstract type.
+ * The _concrete types_ are all types which are not _abstract types_. `Maybe[int]` is an example of a concrete type.
+ * Run-time values always have concrete types, while variables in code often have abstract types.
+* If you provide `value` or `node` as an expected type, you will always get a useful representation
+on the Rascal side. It is not guaranteed to be the same representation as before.
+* ((readJSON)) and ((parseJSON)) can read numbers beyond the bounds of normal `int`, `long` and `doubles`. As
+long as the number is syntactically correct, they will bind to the right Rascal number representation.
+}
+@examples{
+This example demonstrates serializing:
+* constructors without parameters as "enums"
+* constructors with both positional fields and keyword fields
+* datetime serialization
+* integer serialization
+```rascal-shell
+import lang::json::IO;
+data Size = xxs() | xs() | s() | m() | l() | xl() | xxl();
+data Person
+ = person(str firstName, str lastName, datetime birth, int height=0, Size size = m());
+example = person("Santa", "Class", height=175, size=xxl());
+asJSON(example, dateTimeFormat="YYYY-MM-DD");
+```
+
+On the way back we can also track origins for constructors:
+```rascal-shell,continue
+parseJSON(#Person, example, trackOrigins=true)
+```
+}
module lang::json::IO
import util::Maybe;
@@ -25,20 +77,7 @@ import Exception;
}
data RuntimeException(str cause="", str path="");
-@javaClass{org.rascalmpl.library.lang.json.IO}
-@synopsis{Maps any Rascal value to a JSON string}
-@deprecated{use ((writeJSON))}
-public java str toJSON(value v);
-
-@javaClass{org.rascalmpl.library.lang.json.IO}
-@synopsis{Maps any Rascal value to a JSON string, optionally in compact form.}
-@deprecated{use ((asJSON))}
-public java str toJSON(value v, bool compact);
-
-@javaClass{org.rascalmpl.library.lang.json.IO}
-@deprecated{use ((readJSON))}
-@synopsis{Parses a JSON string and maps it to the requested type of Rascal value.}
-public java &T fromJSON(type[&T] typ, str src);
+private str DEFAULT_DATETIME_FORMAT = "yyyy-MM-dd\'T\'HH:mm:ssZ";
@javaClass{org.rascalmpl.library.lang.json.IO}
@synopsis{reads JSON values from a stream}
@@ -60,7 +99,7 @@ First the expected type is used as a literal lookup, and then each value is test
java &T readJSON(
type[&T] expected,
loc src,
- str dateTimeFormat = "yyyy-MM-dd\'T\'HH:mm:ssZZZZZ",
+ str dateTimeFormat = DEFAULT_DATETIME_FORMAT,
bool lenient=false,
bool trackOrigins=false,
JSONParser[value] parser = (type[value] _, str _) { throw ""; },
@@ -89,7 +128,7 @@ In general the translation behaves as the same as for ((readJSON)).}
java &T parseJSON(
type[&T] expected,
str src,
- str dateTimeFormat = "yyyy-MM-dd\'T\'HH:mm:ssZZZZZ",
+ str dateTimeFormat = DEFAULT_DATETIME_FORMAT,
bool lenient=false,
bool trackOrigins=false,
JSONParser[value] parser = (type[value] _, str _) { throw ""; },
@@ -121,7 +160,7 @@ For `real` numbers that are larger than JVM's double you get "negative infinity"
}
java void writeJSON(loc target, value val,
bool unpackedLocations=false,
- str dateTimeFormat="yyyy-MM-dd\'T\'HH:mm:ssZZZZZ",
+ str dateTimeFormat=DEFAULT_DATETIME_FORMAT,
bool dateTimeAsInt=false,
int indent=0,
bool dropOrigins=true,
@@ -136,7 +175,7 @@ java void writeJSON(loc target, value val,
@description{
This function uses `writeJSON` and stores the result in a string.
}
-java str asJSON(value val, bool unpackedLocations=false, str dateTimeFormat="yyyy-MM-dd\'T\'HH:mm:ssZZZZZ", bool dateTimeAsInt=false, int indent = 0, bool dropOrigins=true, JSONFormatter[value] formatter = str (value _) { fail; }, bool explicitConstructorNames=false, bool explicitDataTypes=false);
+java str asJSON(value val, bool unpackedLocations=false, str dateTimeFormat=DEFAULT_DATETIME_FORMAT, bool dateTimeAsInt=false, int indent = 0, bool dropOrigins=true, JSONFormatter[value] formatter = str (value _) { fail; }, bool explicitConstructorNames=false, bool explicitDataTypes=false);
@synopsis{((writeJSON)) and ((asJSON)) uses `Formatter` functions to flatten structured data to strings, on-demand}
@description{
diff --git a/src/org/rascalmpl/library/lang/json/internal/IValueAdapter.java b/src/org/rascalmpl/library/lang/json/internal/IValueAdapter.java
deleted file mode 100644
index 2cf2c78d2b9..00000000000
--- a/src/org/rascalmpl/library/lang/json/internal/IValueAdapter.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package org.rascalmpl.library.lang.json.internal;
-
-import java.io.IOException;
-
-import io.usethesource.vallang.IValue;
-
-import com.google.gson.TypeAdapter;
-import com.google.gson.stream.JsonReader;
-import com.google.gson.stream.JsonWriter;
-
-public class IValueAdapter extends TypeAdapter {
- private final boolean compact;
-
- @Override
- public void write(JsonWriter out, IValue value) throws IOException {
- value.accept(new JSONWritingValueVisitor(out, compact));
- }
-
- @Override
- public IValue read(JsonReader in) throws IOException {
- throw new AssertionError("should not be used");
- }
-
- public IValueAdapter(boolean compact) {
- this.compact = compact;
- }
-}
diff --git a/src/org/rascalmpl/library/lang/json/internal/JSONReadingTypeVisitor.java b/src/org/rascalmpl/library/lang/json/internal/JSONReadingTypeVisitor.java
deleted file mode 100644
index bd867b68f0e..00000000000
--- a/src/org/rascalmpl/library/lang/json/internal/JSONReadingTypeVisitor.java
+++ /dev/null
@@ -1,713 +0,0 @@
-package org.rascalmpl.library.lang.json.internal;
-
-import static org.rascalmpl.library.lang.json.Factory.JSON;
-import static org.rascalmpl.library.lang.json.Factory.JSON_array;
-import static org.rascalmpl.library.lang.json.Factory.JSON_boolean;
-import static org.rascalmpl.library.lang.json.Factory.JSON_ivalue;
-import static org.rascalmpl.library.lang.json.Factory.JSON_null;
-import static org.rascalmpl.library.lang.json.Factory.JSON_number;
-import static org.rascalmpl.library.lang.json.Factory.JSON_object;
-import static org.rascalmpl.library.lang.json.Factory.JSON_string;
-
-import java.io.IOException;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.Stack;
-
-import org.rascalmpl.interpreter.asserts.NotYetImplemented;
-import org.rascalmpl.types.NonTerminalType;
-import org.rascalmpl.values.RascalValueFactory;
-
-import io.usethesource.vallang.IBool;
-import io.usethesource.vallang.IConstructor;
-import io.usethesource.vallang.IDateTime;
-import io.usethesource.vallang.IExternalValue;
-import io.usethesource.vallang.IInteger;
-import io.usethesource.vallang.IList;
-import io.usethesource.vallang.IListWriter;
-import io.usethesource.vallang.IMap;
-import io.usethesource.vallang.IMapWriter;
-import io.usethesource.vallang.INode;
-import io.usethesource.vallang.IRational;
-import io.usethesource.vallang.IReal;
-import io.usethesource.vallang.ISet;
-import io.usethesource.vallang.ISetWriter;
-import io.usethesource.vallang.ISourceLocation;
-import io.usethesource.vallang.IString;
-import io.usethesource.vallang.ITuple;
-import io.usethesource.vallang.IValue;
-import io.usethesource.vallang.IValueFactory;
-import io.usethesource.vallang.IWithKeywordParameters;
-import io.usethesource.vallang.type.ITypeVisitor;
-import io.usethesource.vallang.type.Type;
-import io.usethesource.vallang.type.TypeFactory;
-import io.usethesource.vallang.type.TypeStore;
-import io.usethesource.vallang.visitors.IValueVisitor;
-
-@SuppressWarnings("rawtypes")
-public class JSONReadingTypeVisitor implements ITypeVisitor {
-
- private static final TypeFactory tf = TypeFactory.getInstance();
- private final IValueFactory vf;
- private final TypeStore ts;
- private final Stack