// Generated by delombok at Sun Apr 02 07:47:34 ICT 2017 package ast; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Optional; import java.util.function.Function; import java.util.stream.Collectors; import ast.Ast.Atom; import ast.Ast.Doc; import ast.Ast.Mdf; import ast.Ast.NormType; import ast.Ast.Op; import ast.Ast.Path; import sugarVisitors.Desugar; import tools.Assertions; import tools.StringBuilders; //import ast.Ast.Doc; //import ast.Ast.MethodSelector; import platformSpecific.javaTranslation.Resources; public interface Ast { interface Atom { } final class Parameters { private final Optional<Expression> e; private final List<String> xs; private final List<Expression> es; @java.beans.ConstructorProperties({"e", "xs", "es"}) @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public Parameters(final Optional<Expression> e, final List<String> xs, final List<Expression> es) { this.e = e; this.xs = xs; this.es = es; } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public Optional<Expression> getE() { return this.e; } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public List<String> getXs() { return this.xs; } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public List<Expression> getEs() { return this.es; } @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public boolean equals(final java.lang.Object o) { if (o == this) return true; if (!(o instanceof Ast.Parameters)) return false; final Parameters other = (Parameters)o; final java.lang.Object this$e = this.getE(); final java.lang.Object other$e = other.getE(); if (this$e == null ? other$e != null : !this$e.equals(other$e)) return false; final java.lang.Object this$xs = this.getXs(); final java.lang.Object other$xs = other.getXs(); if (this$xs == null ? other$xs != null : !this$xs.equals(other$xs)) return false; final java.lang.Object this$es = this.getEs(); final java.lang.Object other$es = other.getEs(); if (this$es == null ? other$es != null : !this$es.equals(other$es)) return false; return true; } @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public int hashCode() { final int PRIME = 59; int result = 1; final java.lang.Object $e = this.getE(); result = result * PRIME + ($e == null ? 0 : $e.hashCode()); final java.lang.Object $xs = this.getXs(); result = result * PRIME + ($xs == null ? 0 : $xs.hashCode()); final java.lang.Object $es = this.getEs(); result = result * PRIME + ($es == null ? 0 : $es.hashCode()); return result; } @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public java.lang.String toString() { return "Ast.Parameters(e=" + this.getE() + ", xs=" + this.getXs() + ", es=" + this.getEs() + ")"; } } interface VarDec { <T> T match(Function<VarDecXE, T> xe, Function<VarDecE, T> e, Function<VarDecCE, T> ce); } final class VarDecXE implements VarDec { private final boolean isVar; private final Optional<Type> t; private final String x; private final Expression inner; public <T> T match(Function<VarDecXE, T> xe, Function<VarDecE, T> e, Function<VarDecCE, T> ce) { return xe.apply(this); } @java.beans.ConstructorProperties({"isVar", "t", "x", "inner"}) @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public VarDecXE(final boolean isVar, final Optional<Type> t, final String x, final Expression inner) { this.isVar = isVar; this.t = t; this.x = x; this.inner = inner; } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public boolean isVar() { return this.isVar; } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public Optional<Type> getT() { return this.t; } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public String getX() { return this.x; } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public Expression getInner() { return this.inner; } @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public boolean equals(final java.lang.Object o) { if (o == this) return true; if (!(o instanceof Ast.VarDecXE)) return false; final VarDecXE other = (VarDecXE)o; if (this.isVar() != other.isVar()) return false; final java.lang.Object this$t = this.getT(); final java.lang.Object other$t = other.getT(); if (this$t == null ? other$t != null : !this$t.equals(other$t)) return false; final java.lang.Object this$x = this.getX(); final java.lang.Object other$x = other.getX(); if (this$x == null ? other$x != null : !this$x.equals(other$x)) return false; final java.lang.Object this$inner = this.getInner(); final java.lang.Object other$inner = other.getInner(); if (this$inner == null ? other$inner != null : !this$inner.equals(other$inner)) return false; return true; } @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public int hashCode() { final int PRIME = 59; int result = 1; result = result * PRIME + (this.isVar() ? 79 : 97); final java.lang.Object $t = this.getT(); result = result * PRIME + ($t == null ? 0 : $t.hashCode()); final java.lang.Object $x = this.getX(); result = result * PRIME + ($x == null ? 0 : $x.hashCode()); final java.lang.Object $inner = this.getInner(); result = result * PRIME + ($inner == null ? 0 : $inner.hashCode()); return result; } @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public java.lang.String toString() { return "Ast.VarDecXE(isVar=" + this.isVar() + ", t=" + this.getT() + ", x=" + this.getX() + ", inner=" + this.getInner() + ")"; } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public VarDecXE withVar(final boolean isVar) { return this.isVar == isVar ? this : new VarDecXE(isVar, this.t, this.x, this.inner); } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public VarDecXE withT(final Optional<Type> t) { return this.t == t ? this : new VarDecXE(this.isVar, t, this.x, this.inner); } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public VarDecXE withX(final String x) { return this.x == x ? this : new VarDecXE(this.isVar, this.t, x, this.inner); } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public VarDecXE withInner(final Expression inner) { return this.inner == inner ? this : new VarDecXE(this.isVar, this.t, this.x, inner); } } final class VarDecE implements VarDec { private final Expression inner; public <T> T match(Function<VarDecXE, T> xe, Function<VarDecE, T> e, Function<VarDecCE, T> ce) { return e.apply(this); } @java.beans.ConstructorProperties({"inner"}) @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public VarDecE(final Expression inner) { this.inner = inner; } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public Expression getInner() { return this.inner; } @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public boolean equals(final java.lang.Object o) { if (o == this) return true; if (!(o instanceof Ast.VarDecE)) return false; final VarDecE other = (VarDecE)o; final java.lang.Object this$inner = this.getInner(); final java.lang.Object other$inner = other.getInner(); if (this$inner == null ? other$inner != null : !this$inner.equals(other$inner)) return false; return true; } @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public int hashCode() { final int PRIME = 59; int result = 1; final java.lang.Object $inner = this.getInner(); result = result * PRIME + ($inner == null ? 0 : $inner.hashCode()); return result; } @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public java.lang.String toString() { return "Ast.VarDecE(inner=" + this.getInner() + ")"; } } final class VarDecCE implements VarDec { private final Expression.ClassB.NestedClass inner; public <T> T match(Function<VarDecXE, T> xe, Function<VarDecE, T> e, Function<VarDecCE, T> ce) { return ce.apply(this); } @java.beans.ConstructorProperties({"inner"}) @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public VarDecCE(final Expression.ClassB.NestedClass inner) { this.inner = inner; } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public Expression.ClassB.NestedClass getInner() { return this.inner; } @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public boolean equals(final java.lang.Object o) { if (o == this) return true; if (!(o instanceof Ast.VarDecCE)) return false; final VarDecCE other = (VarDecCE)o; final java.lang.Object this$inner = this.getInner(); final java.lang.Object other$inner = other.getInner(); if (this$inner == null ? other$inner != null : !this$inner.equals(other$inner)) return false; return true; } @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public int hashCode() { final int PRIME = 59; int result = 1; final java.lang.Object $inner = this.getInner(); result = result * PRIME + ($inner == null ? 0 : $inner.hashCode()); return result; } @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public java.lang.String toString() { return "Ast.VarDecCE(inner=" + this.getInner() + ")"; } } interface Header { <T> T match(Function<ConcreteHeader, T> concreteH, Function<TraitHeader, T> traitH, Function<InterfaceHeader, T> interfH); } final class ConcreteHeader implements Header, Expression.HasPos { private final Mdf mdf; private final String name; private final List<FieldDec> fs; private final Position p; public <T> T match(Function<ConcreteHeader, T> concreteH, Function<TraitHeader, T> traitH, Function<InterfaceHeader, T> interfH) { return concreteH.apply(this); } @java.beans.ConstructorProperties({"mdf", "name", "fs", "p"}) @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public ConcreteHeader(final Mdf mdf, final String name, final List<FieldDec> fs, final Position p) { this.mdf = mdf; this.name = name; this.fs = fs; this.p = p; } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public Mdf getMdf() { return this.mdf; } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public String getName() { return this.name; } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public List<FieldDec> getFs() { return this.fs; } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public Position getP() { return this.p; } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public ConcreteHeader withMdf(final Mdf mdf) { return this.mdf == mdf ? this : new ConcreteHeader(mdf, this.name, this.fs, this.p); } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public ConcreteHeader withName(final String name) { return this.name == name ? this : new ConcreteHeader(this.mdf, name, this.fs, this.p); } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public ConcreteHeader withFs(final List<FieldDec> fs) { return this.fs == fs ? this : new ConcreteHeader(this.mdf, this.name, fs, this.p); } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public ConcreteHeader withP(final Position p) { return this.p == p ? this : new ConcreteHeader(this.mdf, this.name, this.fs, p); } @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public boolean equals(final java.lang.Object o) { if (o == this) return true; if (!(o instanceof Ast.ConcreteHeader)) return false; final ConcreteHeader other = (ConcreteHeader)o; final java.lang.Object this$mdf = this.getMdf(); final java.lang.Object other$mdf = other.getMdf(); if (this$mdf == null ? other$mdf != null : !this$mdf.equals(other$mdf)) return false; final java.lang.Object this$name = this.getName(); final java.lang.Object other$name = other.getName(); if (this$name == null ? other$name != null : !this$name.equals(other$name)) return false; final java.lang.Object this$fs = this.getFs(); final java.lang.Object other$fs = other.getFs(); if (this$fs == null ? other$fs != null : !this$fs.equals(other$fs)) return false; return true; } @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public int hashCode() { final int PRIME = 59; int result = 1; final java.lang.Object $mdf = this.getMdf(); result = result * PRIME + ($mdf == null ? 0 : $mdf.hashCode()); final java.lang.Object $name = this.getName(); result = result * PRIME + ($name == null ? 0 : $name.hashCode()); final java.lang.Object $fs = this.getFs(); result = result * PRIME + ($fs == null ? 0 : $fs.hashCode()); return result; } @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public java.lang.String toString() { return "Ast.ConcreteHeader(mdf=" + this.getMdf() + ", name=" + this.getName() + ", fs=" + this.getFs() + ")"; } } final class TraitHeader implements Header { public <T> T match(Function<ConcreteHeader, T> concreteH, Function<TraitHeader, T> traitH, Function<InterfaceHeader, T> interfH) { return traitH.apply(this); } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public TraitHeader() { } @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public boolean equals(final java.lang.Object o) { if (o == this) return true; if (!(o instanceof Ast.TraitHeader)) return false; return true; } @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public int hashCode() { int result = 1; return result; } @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public java.lang.String toString() { return "Ast.TraitHeader()"; } } final class InterfaceHeader implements Header { public <T> T match(Function<ConcreteHeader, T> concreteH, Function<TraitHeader, T> traitH, Function<InterfaceHeader, T> interfH) { return interfH.apply(this); } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public InterfaceHeader() { } @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public boolean equals(final java.lang.Object o) { if (o == this) return true; if (!(o instanceof Ast.InterfaceHeader)) return false; return true; } @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public int hashCode() { int result = 1; return result; } @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public java.lang.String toString() { return "Ast.InterfaceHeader()"; } } final class FieldDec { private final boolean isVar; private final Type t; private final String name; private final Doc doc; @java.beans.ConstructorProperties({"isVar", "t", "name", "doc"}) @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public FieldDec(final boolean isVar, final Type t, final String name, final Doc doc) { this.isVar = isVar; this.t = t; this.name = name; this.doc = doc; } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public boolean isVar() { return this.isVar; } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public Type getT() { return this.t; } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public String getName() { return this.name; } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public Doc getDoc() { return this.doc; } @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public boolean equals(final java.lang.Object o) { if (o == this) return true; if (!(o instanceof Ast.FieldDec)) return false; final FieldDec other = (FieldDec)o; if (this.isVar() != other.isVar()) return false; final java.lang.Object this$t = this.getT(); final java.lang.Object other$t = other.getT(); if (this$t == null ? other$t != null : !this$t.equals(other$t)) return false; final java.lang.Object this$name = this.getName(); final java.lang.Object other$name = other.getName(); if (this$name == null ? other$name != null : !this$name.equals(other$name)) return false; final java.lang.Object this$doc = this.getDoc(); final java.lang.Object other$doc = other.getDoc(); if (this$doc == null ? other$doc != null : !this$doc.equals(other$doc)) return false; return true; } @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public int hashCode() { final int PRIME = 59; int result = 1; result = result * PRIME + (this.isVar() ? 79 : 97); final java.lang.Object $t = this.getT(); result = result * PRIME + ($t == null ? 0 : $t.hashCode()); final java.lang.Object $name = this.getName(); result = result * PRIME + ($name == null ? 0 : $name.hashCode()); final java.lang.Object $doc = this.getDoc(); result = result * PRIME + ($doc == null ? 0 : $doc.hashCode()); return result; } @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public java.lang.String toString() { return "Ast.FieldDec(isVar=" + this.isVar() + ", t=" + this.getT() + ", name=" + this.getName() + ", doc=" + this.getDoc() + ")"; } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public FieldDec withVar(final boolean isVar) { return this.isVar == isVar ? this : new FieldDec(isVar, this.t, this.name, this.doc); } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public FieldDec withT(final Type t) { return this.t == t ? this : new FieldDec(this.isVar, t, this.name, this.doc); } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public FieldDec withName(final String name) { return this.name == name ? this : new FieldDec(this.isVar, this.t, name, this.doc); } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public FieldDec withDoc(final Doc doc) { return this.doc == doc ? this : new FieldDec(this.isVar, this.t, this.name, doc); } } interface Type { <T> T match(Function<NormType, T> normType, Function<HistoricType, T> hType); default ast.Ast.NormType getNT() { assert this instanceof ast.Ast.NormType : this; return (ast.Ast.NormType)this; } Doc getDoc(); Type withDoc(Doc doc); } final class NormType implements Type { private final Mdf mdf; private final Path path; private final Doc doc; public static final NormType mutThis0 = new NormType(Mdf.Mutable, Path.outer(0), Doc.empty()); public static final NormType immThis0 = new NormType(Mdf.Immutable, Path.outer(0), Doc.empty()); public static final NormType immVoid = new NormType(Mdf.Immutable, Path.Void(), Doc.empty()); public static final NormType immLibrary = new NormType(Mdf.Immutable, Path.Library(), Doc.empty()); public static final NormType immAny = new NormType(Mdf.Immutable, Path.Any(), Doc.empty()); public static final NormType classAny = new NormType(Mdf.Class, Path.Any(), Doc.empty()); public String toString() { return mdf.name() + "[" + this.path.toString() + "]"; } public <T> T match(Function<NormType, T> normType, Function<HistoricType, T> hType) { return normType.apply(this); } @java.beans.ConstructorProperties({"mdf", "path", "doc"}) @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public NormType(final Mdf mdf, final Path path, final Doc doc) { this.mdf = mdf; this.path = path; this.doc = doc; } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public Mdf getMdf() { return this.mdf; } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public Path getPath() { return this.path; } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public Doc getDoc() { return this.doc; } @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public boolean equals(final java.lang.Object o) { if (o == this) return true; if (!(o instanceof Ast.NormType)) return false; final NormType other = (NormType)o; final java.lang.Object this$mdf = this.getMdf(); final java.lang.Object other$mdf = other.getMdf(); if (this$mdf == null ? other$mdf != null : !this$mdf.equals(other$mdf)) return false; final java.lang.Object this$path = this.getPath(); final java.lang.Object other$path = other.getPath(); if (this$path == null ? other$path != null : !this$path.equals(other$path)) return false; final java.lang.Object this$doc = this.getDoc(); final java.lang.Object other$doc = other.getDoc(); if (this$doc == null ? other$doc != null : !this$doc.equals(other$doc)) return false; return true; } @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public int hashCode() { final int PRIME = 59; int result = 1; final java.lang.Object $mdf = this.getMdf(); result = result * PRIME + ($mdf == null ? 0 : $mdf.hashCode()); final java.lang.Object $path = this.getPath(); result = result * PRIME + ($path == null ? 0 : $path.hashCode()); final java.lang.Object $doc = this.getDoc(); result = result * PRIME + ($doc == null ? 0 : $doc.hashCode()); return result; } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public NormType withMdf(final Mdf mdf) { return this.mdf == mdf ? this : new NormType(mdf, this.path, this.doc); } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public NormType withPath(final Path path) { return this.path == path ? this : new NormType(this.mdf, path, this.doc); } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public NormType withDoc(final Doc doc) { return this.doc == doc ? this : new NormType(this.mdf, this.path, doc); } } final class MethodSelectorX { private final MethodSelector ms; private final String x; @java.beans.ConstructorProperties({"ms", "x"}) @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public MethodSelectorX(final MethodSelector ms, final String x) { this.ms = ms; this.x = x; } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public MethodSelector getMs() { return this.ms; } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public String getX() { return this.x; } @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public boolean equals(final java.lang.Object o) { if (o == this) return true; if (!(o instanceof Ast.MethodSelectorX)) return false; final MethodSelectorX other = (MethodSelectorX)o; final java.lang.Object this$ms = this.getMs(); final java.lang.Object other$ms = other.getMs(); if (this$ms == null ? other$ms != null : !this$ms.equals(other$ms)) return false; final java.lang.Object this$x = this.getX(); final java.lang.Object other$x = other.getX(); if (this$x == null ? other$x != null : !this$x.equals(other$x)) return false; return true; } @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public int hashCode() { final int PRIME = 59; int result = 1; final java.lang.Object $ms = this.getMs(); result = result * PRIME + ($ms == null ? 0 : $ms.hashCode()); final java.lang.Object $x = this.getX(); result = result * PRIME + ($x == null ? 0 : $x.hashCode()); return result; } @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public java.lang.String toString() { return "Ast.MethodSelectorX(ms=" + this.getMs() + ", x=" + this.getX() + ")"; } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public MethodSelectorX withMs(final MethodSelector ms) { return this.ms == ms ? this : new MethodSelectorX(ms, this.x); } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public MethodSelectorX withX(final String x) { return this.x == x ? this : new MethodSelectorX(this.ms, x); } } final class HistoricType implements Type { private final Path path; private final List<MethodSelectorX> selectors; private final Doc doc; public <T> T match(Function<NormType, T> normType, Function<HistoricType, T> hType) { return hType.apply(this); } @java.beans.ConstructorProperties({"path", "selectors", "doc"}) @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public HistoricType(final Path path, final List<MethodSelectorX> selectors, final Doc doc) { this.path = path; this.selectors = selectors; this.doc = doc; } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public Path getPath() { return this.path; } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public List<MethodSelectorX> getSelectors() { return this.selectors; } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public Doc getDoc() { return this.doc; } @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public boolean equals(final java.lang.Object o) { if (o == this) return true; if (!(o instanceof Ast.HistoricType)) return false; final HistoricType other = (HistoricType)o; final java.lang.Object this$path = this.getPath(); final java.lang.Object other$path = other.getPath(); if (this$path == null ? other$path != null : !this$path.equals(other$path)) return false; final java.lang.Object this$selectors = this.getSelectors(); final java.lang.Object other$selectors = other.getSelectors(); if (this$selectors == null ? other$selectors != null : !this$selectors.equals(other$selectors)) return false; final java.lang.Object this$doc = this.getDoc(); final java.lang.Object other$doc = other.getDoc(); if (this$doc == null ? other$doc != null : !this$doc.equals(other$doc)) return false; return true; } @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public int hashCode() { final int PRIME = 59; int result = 1; final java.lang.Object $path = this.getPath(); result = result * PRIME + ($path == null ? 0 : $path.hashCode()); final java.lang.Object $selectors = this.getSelectors(); result = result * PRIME + ($selectors == null ? 0 : $selectors.hashCode()); final java.lang.Object $doc = this.getDoc(); result = result * PRIME + ($doc == null ? 0 : $doc.hashCode()); return result; } @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public java.lang.String toString() { return "Ast.HistoricType(path=" + this.getPath() + ", selectors=" + this.getSelectors() + ", doc=" + this.getDoc() + ")"; } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public HistoricType withPath(final Path path) { return this.path == path ? this : new HistoricType(path, this.selectors, this.doc); } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public HistoricType withSelectors(final List<MethodSelectorX> selectors) { return this.selectors == selectors ? this : new HistoricType(this.path, selectors, this.doc); } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public HistoricType withDoc(final Doc doc) { return this.doc == doc ? this : new HistoricType(this.path, this.selectors, doc); } } final class FreeType implements Type { public <T> T match(Function<NormType, T> normType, Function<HistoricType, T> hType) { throw tools.Assertions.codeNotReachable(); } public Doc getDoc() { return Doc.empty(); } public Type withDoc(Doc doc) { return this; } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public FreeType() { } @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public boolean equals(final java.lang.Object o) { if (o == this) return true; if (!(o instanceof Ast.FreeType)) return false; return true; } @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public int hashCode() { int result = 1; return result; } @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public java.lang.String toString() { return "Ast.FreeType()"; } } final class MethodSelector { private final String name; private final long uniqueNum; public boolean isUnique() { return uniqueNum != -1; } private final List<String> names; public static MethodSelector of(String name, List<String> names) { int index = name.lastIndexOf("_$_"); long uniqueNum = C.sToNumber(name, index); if (uniqueNum != -1) { name = name.substring(0, index); } names = java.util.Collections.unmodifiableList(names); MethodSelector res = new MethodSelector(name, uniqueNum, names); assert res.invariant(); return res; } public boolean isOperator() { return this.name.startsWith("#");//for now, to improve later } public boolean invariant() { // not good enought, it can also be empty or operator // assert checkX(name,true); assert !name.contains("\t") : name; if (!(name.isEmpty() && this.uniqueNum == -1)) { assert checkX(Desugar.desugarName(name), true); } for (String n : names) { assert checkX(n, false); } return true; } public String toSrcEquivalent() { String result = "ast.Ast.MethodSelector.of(\"" + nameToS() + "\",java.util.Arrays.asList("; result += String.join(",", tools.Map.of(ni -> "\"" + ni + "\"", names)); return result + "))"; } public String nameToS() { if (uniqueNum == -1) { return name; } return name + "_$_" + uniqueNum; } public String toString() { String nameU = nameToS(); if (nameU.isEmpty() && names.isEmpty()) { return "()"; } if (names.isEmpty()) { return nameU + "()"; } StringBuilder result = new StringBuilder(); result.append(nameU + "("); tools.StringBuilders.formatSequence(result, names.iterator(), ",", result::append); result.append(")"); return result.toString(); } public static MethodSelector parse(String s) { if (s.equals("()")) { return MethodSelector.of(Desugar.desugarName(""), Collections.emptyList()); } String name = s; List<String> xs = new ArrayList<String>(); assert !s.isEmpty(); char last = s.charAt(s.length() - 1); if (last != ')') { throw new Resources.Error("InvalidSelector: " + s); } int i = s.indexOf('('); if (i == -1) { throw new Resources.Error("InvalidSelector: " + s); } name = s.substring(0, i); String parenthesis = s.substring(i + 1, s.length() - 1).trim(); if (!parenthesis.isEmpty()) { String[] names = parenthesis.split(",");// single representation // required for (String si : names) { if (!checkX(si, false)) { throw new Resources.Error("InvalidSelector: " + s); } if (xs.contains(si)) { throw new Resources.Error("InvalidSelector: " + s + " a parameter is repeted: " + si); } xs.add(si); } } name = Desugar.desugarName(name); if (!checkX(name, true)) { throw new Resources.Error("InvalidSelector: " + s); } return MethodSelector.of(name, xs); } public static boolean checkX(String s, boolean allowHash) { if (s.isEmpty()) { return false; } char c0 = s.charAt(0); if (allowHash && c0 == '#') { if (s.length() == 1) { return false; } char c1 = s.charAt(1); if (c1 == '#') { return false; } //return checkX(s.substring(1), allowHash); } for (char c : s.toCharArray()) { if (allowHash && c == '#') { continue; } if (ast.PathAux.isValidPathChar(c)) { continue; } return false; } return c0 == '_' || c0 == '#' || (c0 >= 'a' && c0 <= 'z'); } @java.beans.ConstructorProperties({"name", "uniqueNum", "names"}) @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public MethodSelector(final String name, final long uniqueNum, final List<String> names) { this.name = name; this.uniqueNum = uniqueNum; this.names = names; } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public String getName() { return this.name; } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public long getUniqueNum() { return this.uniqueNum; } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public List<String> getNames() { return this.names; } @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public boolean equals(final java.lang.Object o) { if (o == this) return true; if (!(o instanceof Ast.MethodSelector)) return false; final MethodSelector other = (MethodSelector)o; final java.lang.Object this$name = this.getName(); final java.lang.Object other$name = other.getName(); if (this$name == null ? other$name != null : !this$name.equals(other$name)) return false; if (this.getUniqueNum() != other.getUniqueNum()) return false; final java.lang.Object this$names = this.getNames(); final java.lang.Object other$names = other.getNames(); if (this$names == null ? other$names != null : !this$names.equals(other$names)) return false; return true; } @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public int hashCode() { final int PRIME = 59; int result = 1; final java.lang.Object $name = this.getName(); result = result * PRIME + ($name == null ? 0 : $name.hashCode()); final long $uniqueNum = this.getUniqueNum(); result = result * PRIME + (int)($uniqueNum >>> 32 ^ $uniqueNum); final java.lang.Object $names = this.getNames(); result = result * PRIME + ($names == null ? 0 : $names.hashCode()); return result; } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public MethodSelector withName(final String name) { return this.name == name ? this : new MethodSelector(name, this.uniqueNum, this.names); } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public MethodSelector withUniqueNum(final long uniqueNum) { return this.uniqueNum == uniqueNum ? this : new MethodSelector(this.name, uniqueNum, this.names); } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public MethodSelector withNames(final List<String> names) { return this.names == names ? this : new MethodSelector(this.name, this.uniqueNum, names); } } final class MethodType { private final boolean refine; private final Mdf mdf; private final List<Type> ts; private final Type returnType; private final List<Type> exceptions; @Override public String toString() { String res = this.mdf + ":" + ts.stream().map(e -> e.toString()).collect(Collectors.joining(",")) + "->" + returnType; if (!exceptions.isEmpty()) { res = res + " exceptions:" + exceptions.stream().map(e -> e.toString()).collect(Collectors.joining(",")); } return res; } @java.beans.ConstructorProperties({"refine", "mdf", "ts", "returnType", "exceptions"}) @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public MethodType(final boolean refine, final Mdf mdf, final List<Type> ts, final Type returnType, final List<Type> exceptions) { this.refine = refine; this.mdf = mdf; this.ts = ts; this.returnType = returnType; this.exceptions = exceptions; } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public boolean isRefine() { return this.refine; } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public Mdf getMdf() { return this.mdf; } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public List<Type> getTs() { return this.ts; } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public Type getReturnType() { return this.returnType; } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public List<Type> getExceptions() { return this.exceptions; } @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public boolean equals(final java.lang.Object o) { if (o == this) return true; if (!(o instanceof Ast.MethodType)) return false; final MethodType other = (MethodType)o; if (this.isRefine() != other.isRefine()) return false; final java.lang.Object this$mdf = this.getMdf(); final java.lang.Object other$mdf = other.getMdf(); if (this$mdf == null ? other$mdf != null : !this$mdf.equals(other$mdf)) return false; final java.lang.Object this$ts = this.getTs(); final java.lang.Object other$ts = other.getTs(); if (this$ts == null ? other$ts != null : !this$ts.equals(other$ts)) return false; final java.lang.Object this$returnType = this.getReturnType(); final java.lang.Object other$returnType = other.getReturnType(); if (this$returnType == null ? other$returnType != null : !this$returnType.equals(other$returnType)) return false; final java.lang.Object this$exceptions = this.getExceptions(); final java.lang.Object other$exceptions = other.getExceptions(); if (this$exceptions == null ? other$exceptions != null : !this$exceptions.equals(other$exceptions)) return false; return true; } @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public int hashCode() { final int PRIME = 59; int result = 1; result = result * PRIME + (this.isRefine() ? 79 : 97); final java.lang.Object $mdf = this.getMdf(); result = result * PRIME + ($mdf == null ? 0 : $mdf.hashCode()); final java.lang.Object $ts = this.getTs(); result = result * PRIME + ($ts == null ? 0 : $ts.hashCode()); final java.lang.Object $returnType = this.getReturnType(); result = result * PRIME + ($returnType == null ? 0 : $returnType.hashCode()); final java.lang.Object $exceptions = this.getExceptions(); result = result * PRIME + ($exceptions == null ? 0 : $exceptions.hashCode()); return result; } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public MethodType withRefine(final boolean refine) { return this.refine == refine ? this : new MethodType(refine, this.mdf, this.ts, this.returnType, this.exceptions); } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public MethodType withMdf(final Mdf mdf) { return this.mdf == mdf ? this : new MethodType(this.refine, mdf, this.ts, this.returnType, this.exceptions); } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public MethodType withTs(final List<Type> ts) { return this.ts == ts ? this : new MethodType(this.refine, this.mdf, ts, this.returnType, this.exceptions); } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public MethodType withReturnType(final Type returnType) { return this.returnType == returnType ? this : new MethodType(this.refine, this.mdf, this.ts, returnType, this.exceptions); } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public MethodType withExceptions(final List<Type> exceptions) { return this.exceptions == exceptions ? this : new MethodType(this.refine, this.mdf, this.ts, this.returnType, exceptions); } } final class C { private final String inner; private final long uniqueNum; public boolean isUnique() { return uniqueNum != -1; } public C(String inner, long uniqueNum) { this.inner = inner; this.uniqueNum = uniqueNum; assert PathAux.isValidClassName(inner); } public static long sToNumber(String name, int index) { if (index == -1) { return -1L; } String numS = name.substring(index + 3, name.length()); try { long num = Long.parseLong(numS); return num; } catch (NumberFormatException nfe) { return -1L; } } public static C of(String name) { int index = name.lastIndexOf("_$_"); long uniqueNum = sToNumber(name, index); if (uniqueNum == -1) { return new C(name, -1); } return new C(name.substring(0, index), uniqueNum); } public String toString() { if (uniqueNum == -1) { return inner; } return inner + "_$_" + uniqueNum; } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public String getInner() { return this.inner; } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public long getUniqueNum() { return this.uniqueNum; } @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public boolean equals(final java.lang.Object o) { if (o == this) return true; if (!(o instanceof Ast.C)) return false; final C other = (C)o; final java.lang.Object this$inner = this.getInner(); final java.lang.Object other$inner = other.getInner(); if (this$inner == null ? other$inner != null : !this$inner.equals(other$inner)) return false; if (this.getUniqueNum() != other.getUniqueNum()) return false; return true; } @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public int hashCode() { final int PRIME = 59; int result = 1; final java.lang.Object $inner = this.getInner(); result = result * PRIME + ($inner == null ? 0 : $inner.hashCode()); final long $uniqueNum = this.getUniqueNum(); result = result * PRIME + (int)($uniqueNum >>> 32 ^ $uniqueNum); return result; } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public C withInner(final String inner) { return this.inner == inner ? this : new C(inner, this.uniqueNum); } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public C withUniqueNum(final long uniqueNum) { return this.uniqueNum == uniqueNum ? this : new C(this.inner, uniqueNum); } } //------------------- abstract class Path { public static Path sugarParse(List<String> rowData) { Path res = PathSugar._instance(rowData); if (res != null) { return res; } return parse(rowData); } public static Path sugarParse(String path) { List<String> rowData = Arrays.asList(path.split("\\.")); return sugarParse(rowData); } public static Path parse(List<String> rowData) { Path res = PathPrimitive._parsePrimitive(rowData); if (res != null) { return res; } res = PathCore._parsePathCode(rowData); if (res != null) { return res; } throw Assertions.codeNotReachable("InvalidPath: " + rowData); //this does not accept the sugarPath } public static Path parse(String path) { List<String> rowData = Arrays.asList(path.split("\\.")); return parse(rowData); } public static Path outer(int n, List<C> cs) { return PathCore.instance(n, cs); } public static Path outer(int n) { return PathCore.instance(n, Collections.emptyList()); } public static Path Void() { return PathPrimitive._Void; } public static Path Any() { return PathPrimitive._Any; } public static Path Library() { return PathPrimitive._Library; } public NormType toImmNT() { return new NormType(Mdf.Immutable, this, Doc.empty()); } public boolean isPrimitive() { return false; } public boolean isCore() { return false; } public String toString() { return sugarVisitors.ToFormattedText.of(this); } public Path popC() { throw Assertions.codeNotReachable("path.pocC on not core:" + this); } public Path pushC(C c) { throw Assertions.codeNotReachable("path.pushC on not core:" + this); } public List<C> getCBar() { throw Assertions.codeNotReachable("path.getCBar on not core:" + this); } public Path setNewOuter(int n) { throw Assertions.codeNotReachable("path.setNewOuter on not core:" + this); } public int outerNumber() { throw Assertions.codeNotReachable("path.outerNumber on not core:" + this); } public List<C> sugarNames() { throw Assertions.codeNotReachable("path.outerNumber on not core:" + this); } } //----------------------------- /*to string manually defined so @ToString(exclude = "p") not needed*/ final class Doc implements Expression.HasPos { private final boolean multiline; private final String s; private final List<Object> annotations; private final List<String> parameters; private final Position p; public List<Path> getPaths() { List<Path> result = new ArrayList<>(); for (Object o : annotations) { if (o instanceof Path) { result.add((Path)o); } } return result; } public String _getParameterFor(Object annotation) { int i = annotations.indexOf(annotation); if (i == -1) { return null; } return parameters.get(i); } public Doc withNewlineTerminator() { if (s.endsWith("\n")) { return this; } return this.withS(s + "\n"); } /*public boolean isPrivate() { if (this.annotations.contains("private")) { return true; } // if(this.toString().startsWith("@private")){return true;} return false; }*/ //public static Doc getPrivate(){return privateInstance;} //private static final Doc privateInstance=Doc.factory(true,"@private"); public static Doc factory(Path single) { return new Doc(true, "%s\n", Collections.singletonList((Object)single), Collections.singletonList(""), Position.noInfo); } public static Doc factory(boolean multiline, String s) { return factory(multiline, s, Position.noInfo); } public static Doc factory(boolean multiline, String s, Position pos) { if (!multiline & !s.endsWith("\n")) { s += "\n"; } List<Object> annotations = new ArrayList<>(); List<String> parameters = new ArrayList<>(); StringBuilder sb = new StringBuilder(); for (int i = 0; i < s.length(); i++) { char ci = s.charAt(i); if (ci == '%') { sb.append('%'); sb.append('%');//NOTE: this is to allow String.format in toString continue; } if (ci != '@') { sb.append(ci); continue; } else { // ci=='@' char next = '\n'; if (i + 1 < s.length()) { next = s.charAt(i + 1); } if (next == '.' || PathAux.isValidPathChar(next)) { sb.append("%s"); i = readAnnotation(s, i + 1, annotations); readParameter(s, i + 1, parameters); } else { throw Assertions.codeNotReachable("invalid use of @ in |" + next + "| " + s); } // if(!PathAux.isValidPathStart(next)){sb.append(ci);continue;} } } return new Doc(multiline, sb.toString(), annotations, parameters, pos); } private static final Doc empty = new Doc(true, "", Collections.emptyList(), Collections.emptyList(), Position.noInfo); public static Doc empty() { return empty; } public Doc withAnnotations(final List<Object> ann) { //customized to make the string change not break the parameters structure assert ann.size() == this.annotations.size(); assert ann.stream().allMatch(Doc::isValidAnnotation) : // ""; Doc tmp = new Doc(this.multiline, this.s, ann, this.parameters, this.p); assert Doc.factory(this.multiline, tmp.toStringWeak()).equals(tmp) : // ""; return tmp; } public static boolean isValidAnnotation(Object o) { if (o instanceof Path) { return true; } if (!(o instanceof String)) { return false; } String s = (String)o; if (s.isEmpty()) { return true; } if (PathAux.isValidPathStart(s.charAt(0))) { return false; } for (char c : s.toCharArray()) { if (c == '.') { continue; } if (!PathAux.isValidPathChar(c)) { return false; } } return true; } public Doc toMultiline() { Doc tmp = new Doc(true, s, this.annotations, this.parameters, this.p); assert Doc.factory(true, tmp.toStringWeak()).equals(tmp); return tmp; } public Doc withS(final String s) { //customized to make the string change not break the parameters structure if (this.s == s || this.s.equals(s)) { return this; } Doc tmp = new Doc(this.multiline, s, this.annotations, this.parameters, this.p); return Doc.factory(this.multiline, tmp.toStringWeak()); } public String _getParameterForPlugin() { return _getParameterFor("plugin"); } public String _getParameterForPluginPart() { return _getParameterFor("pluginPart"); } public String toStringWeak() { List<Object> paths = new ArrayList<>(); for (Object pi : this.annotations) { if (pi instanceof Path) { paths.add("@" + sugarVisitors.ToFormattedText.of((Path)pi)); } else { paths.add("@" + (String)pi); } } return String.format(this.s, paths.toArray()); } public String toString() { String text = toStringWeak(); assert Doc.factory(this.multiline, text).equals(this) : // ""; return text; } public String toCodeFormattedString() { String text = toString(); if (text.isEmpty()) { return text; } if (this.multiline) { return "/*" + text + "*/"; } assert text.endsWith("\n") : "|" + text + "|"; String[] splitted = text.substring(0, text.length() - 1).split("\n", -1);//on its line for ease of testing//This was a bad move, javaSplit, you despicable bastard StringBuffer res = new StringBuffer(); { int i = -1; for (String s : splitted) { i += 1; if (s.isEmpty() && i == 0) { continue; } res.append("//"); res.append(s); res.append("\n"); } } return res.toString(); } public boolean isEmpty() { return this.s.isEmpty(); } public Doc sum(Doc that) { //be carefull, a more optimized implementation would mess up annotations as in // /*@a b*/ +/* c*/ would create annotations=[" b"] while // /*@a b c*/ would create annotations=[" b c"] String tosThis = this.toString(); String tosThat = that.toString(); return Doc.factory(true, tosThis + tosThat, this.p.sum(that.p)); } public Doc formatNewLinesAsList() { String newS = this.s.trim(); newS = newS.replace("\n", ", "); newS = "[" + newS + "]\n"; return this.withS(newS); } private static int readAnnotation(String s, int start, List<Object> paths) { boolean isPath = PathAux.isValidPathStart(s.charAt(start)); StringBuilder sb = new StringBuilder(); for (int i = start; i < s.length(); i++) { char ci = s.charAt(i); if (PathAux.isValidPathChar(ci)) { sb.append(ci); } else if (ci == '.' && isPath && i + 1 < s.length() && PathAux.isValidPathStart(s.charAt(i + 1))) { sb.append(ci); } else if (ci == '.' && !isPath) { sb.append(ci); } else { break; } } String res = sb.toString(); if (isPath) { paths.add(Path.sugarParse(res)); } else { paths.add(res); } return start + res.length() - 1; } private static void readParameter(String s, int start, List<String> parameters) { int i = s.indexOf('@', start); if (i == -1) { i = s.length(); } String par = s.substring(start, i); while (par.endsWith("\n")) { par = par.substring(0, par.length() - 1); } parameters.add(par); } @java.beans.ConstructorProperties({"multiline", "s", "annotations", "parameters", "p"}) @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public Doc(final boolean multiline, final String s, final List<Object> annotations, final List<String> parameters, final Position p) { this.multiline = multiline; this.s = s; this.annotations = annotations; this.parameters = parameters; this.p = p; } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public boolean isMultiline() { return this.multiline; } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public String getS() { return this.s; } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public List<Object> getAnnotations() { return this.annotations; } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public List<String> getParameters() { return this.parameters; } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public Position getP() { return this.p; } @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public boolean equals(final java.lang.Object o) { if (o == this) return true; if (!(o instanceof Ast.Doc)) return false; final Doc other = (Doc)o; if (this.isMultiline() != other.isMultiline()) return false; final java.lang.Object this$s = this.getS(); final java.lang.Object other$s = other.getS(); if (this$s == null ? other$s != null : !this$s.equals(other$s)) return false; final java.lang.Object this$annotations = this.getAnnotations(); final java.lang.Object other$annotations = other.getAnnotations(); if (this$annotations == null ? other$annotations != null : !this$annotations.equals(other$annotations)) return false; final java.lang.Object this$parameters = this.getParameters(); final java.lang.Object other$parameters = other.getParameters(); if (this$parameters == null ? other$parameters != null : !this$parameters.equals(other$parameters)) return false; return true; } @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public int hashCode() { final int PRIME = 59; int result = 1; result = result * PRIME + (this.isMultiline() ? 79 : 97); final java.lang.Object $s = this.getS(); result = result * PRIME + ($s == null ? 0 : $s.hashCode()); final java.lang.Object $annotations = this.getAnnotations(); result = result * PRIME + ($annotations == null ? 0 : $annotations.hashCode()); final java.lang.Object $parameters = this.getParameters(); result = result * PRIME + ($parameters == null ? 0 : $parameters.hashCode()); return result; } } enum SignalKind { Error("error"), Exception("exception"), Return("return"); public final String content; SignalKind(String content) { this.content = content; } public static SignalKind fromString(String s) { for (SignalKind sk : SignalKind.values()) { if (sk.content.equals(s)) return sk; } throw tools.Assertions.codeNotReachable(); } } enum Mdf { Immutable(""), Mutable("mut"), Readable("read"), Lent("lent"), Capsule("capsule"), Class("class"), ImmutableFwd("fwd"), ImmutablePFwd("%fwd"), MutableFwd("fwd mut"), MutablePFwd("%fwd mut"); public final String inner; Mdf(String inner) { this.inner = inner; } public static Mdf fromString(String s) { for (Mdf mdf : Mdf.values()) { if (mdf.inner.equals(s)) return mdf; } throw tools.Assertions.codeNotReachable(); } public static List<Mdf> muts = Arrays.asList(Mdf.Mutable, Mdf.MutablePFwd, Mdf.MutableFwd); public static List<Mdf> imms = Arrays.asList(Mdf.Immutable, Mdf.ImmutablePFwd, Mdf.ImmutableFwd); } enum OpKind { Unary, BoolOp, RelationalOp, DataOp, EqOp; } enum Op { Tilde("~", OpKind.Unary, true, true, false), // Bang("!", OpKind.Unary, true, true, false), // And("&", OpKind.BoolOp, true, true, false), // Or("|", OpKind.BoolOp, true, true, false), // LTEqual("<=", OpKind.RelationalOp, false, true, false), // GTEqual(">=", OpKind.RelationalOp, true, true, false), // LT("<", OpKind.RelationalOp, false, true, false), // GT(">", OpKind.RelationalOp, true, true, false), // LTLT("<<", OpKind.RelationalOp, false, false, false), // GTGT(">>", OpKind.RelationalOp, true, false, false), // LTLTEqual("<<=", OpKind.RelationalOp, false, true, false), // GTGTEqual(">>=", OpKind.RelationalOp, true, true, false), // EqualEqual("==", OpKind.RelationalOp, true, false, false), // BangLTEqual("!<=", OpKind.RelationalOp, false, true, true), // BangGTEqual("!>=", OpKind.RelationalOp, true, true, true), // BangLT("!<", OpKind.RelationalOp, false, true, true), // BangGT("!>", OpKind.RelationalOp, true, true, true), // BangLTLT("!<<", OpKind.RelationalOp, false, false, true), // BangGTGT("!>>", OpKind.RelationalOp, true, false, true), // BangLTLTEqual("!<<=", OpKind.RelationalOp, false, true, true), // BangGTGTEqual("!>>=", OpKind.RelationalOp, true, true, true), // BangEqual("!=", OpKind.RelationalOp, true, true, true), // Plus("+", OpKind.DataOp, true, true, false), // Minus("-", OpKind.DataOp, true, true, false), // Times("*", OpKind.DataOp, true, true, false), // Divide("/", OpKind.DataOp, true, true, false), // PlusPlus("++", OpKind.DataOp, true, false, false), // MinusMinus("--", OpKind.DataOp, true, false, false), // TimesTimes("**", OpKind.DataOp, true, false, false), // BabelFishL("<><", OpKind.DataOp, true, false, false), // BabelFishR("><>", OpKind.DataOp, false, false, false), // PlusEqual("+=", OpKind.EqOp, true, true, false), // MinusEqual("-=", OpKind.EqOp, true, true, false), // TimesEqual("*=", OpKind.EqOp, true, true, false), // DivideEqual("/=", OpKind.EqOp, true, true, false), // AndEqual("&=", OpKind.EqOp, true, true, false), // OrEqual("|=", OpKind.EqOp, true, true, false), // PlusPlusEqual("++=", OpKind.EqOp, true, true, false), // MinusMinusEqual("--=", OpKind.EqOp, true, true, false), // TimesTimesEqual("**=", OpKind.EqOp, true, true, false), // ColonEqual(":=", OpKind.EqOp, true, true, false), // BabelFishLEqual("<><=", OpKind.EqOp, true, false, false), // BabelFishREqual("><>=", OpKind.EqOp, true, false, false); // public final String inner; public final OpKind kind; public final boolean normalized;// false for <<,<, <=,<<=,><> etc public final boolean leftAssociative;// false for ++ << >> ** == public final boolean negated;//true for all starting with ! Op(String inner, OpKind kind, boolean normalized, boolean leftAssociative, boolean negated) { this.inner = inner; this.kind = kind; this.normalized = normalized; this.leftAssociative = leftAssociative; this.negated = negated; } public static Op fromString(String s) { for (Op op : Op.values()) { if (op.inner.equals(s)) return op; } throw tools.Assertions.codeNotReachable(); } public Op nonNegatedVersion() { if (!this.negated) { return this; } String ops = this.inner.substring(1); if (ops.equals("=")) { ops = "=="; } return Op.fromString(ops); } public Op normalizedVersion() { if (this.normalized) { return this; } String ops = inner.replace('<', ' ').replace('>', '<').replace(' ', '>'); return Op.fromString(ops); } } enum Stage { None(""), Less("##less"), ToIterate("##toIterateTemp"), // Meta("##meta"), Plus("##plus"), Star("##star"); // Needed("##needed"), // Needable("##needable"); public final String inner; Stage(String inner) { this.inner = inner; } public static Stage fromString(String s) { for (Stage st : Stage.values()) { if (st.inner.equals(s)) return st; } throw tools.Assertions.codeNotReachable(); } } /*public static enum Ph { None, Ph, Partial }*/ final class Position { public static final Position noInfo = new Position(null, Integer.MAX_VALUE / 2, Integer.MAX_VALUE / 2, 0, 0, null); public Position sum(Position that) { if (this == noInfo) { return that; } if (that == noInfo || that == null) { return this; } if (this._next == null) { return this.with_next(that); } return this.with_next(this._next.sum(that)); } private final String file; private final int line1; private final int pos1; private final int line2; private final int pos2; private final Position _next; public String toString() { int line1 = this.line1 - 1; int line2 = this.line2 - 1; String res = ""; if (line1 == line2) { res = "line:" + line1 + ", pos:" + pos1 + "--" + pos2; } else { res = "from line:" + line1 + "(pos:" + pos1 + ") to line:" + line2 + "(pos:" + pos2 + ")"; } if (file == null) { return "fileUnknown; " + res; } String fileName = null; // if(file!=null){fileName="..."+file.substring(file.lastIndexOf("\\"));} int pos = file.lastIndexOf("\\"); if (pos != -1) { pos = file.substring(0, pos).lastIndexOf("\\"); } fileName = "..." + ((pos == -1) ? file : file.substring(pos)); return "file: " + fileName + "; " + res; } @java.beans.ConstructorProperties({"file", "line1", "pos1", "line2", "pos2", "_next"}) @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public Position(final String file, final int line1, final int pos1, final int line2, final int pos2, final Position _next) { this.file = file; this.line1 = line1; this.pos1 = pos1; this.line2 = line2; this.pos2 = pos2; this._next = _next; } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public String getFile() { return this.file; } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public int getLine1() { return this.line1; } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public int getPos1() { return this.pos1; } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public int getLine2() { return this.line2; } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public int getPos2() { return this.pos2; } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public Position get_next() { return this._next; } @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public boolean equals(final java.lang.Object o) { if (o == this) return true; if (!(o instanceof Ast.Position)) return false; final Position other = (Position)o; final java.lang.Object this$file = this.getFile(); final java.lang.Object other$file = other.getFile(); if (this$file == null ? other$file != null : !this$file.equals(other$file)) return false; if (this.getLine1() != other.getLine1()) return false; if (this.getPos1() != other.getPos1()) return false; if (this.getLine2() != other.getLine2()) return false; if (this.getPos2() != other.getPos2()) return false; final java.lang.Object this$_next = this.get_next(); final java.lang.Object other$_next = other.get_next(); if (this$_next == null ? other$_next != null : !this$_next.equals(other$_next)) return false; return true; } @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public int hashCode() { final int PRIME = 59; int result = 1; final java.lang.Object $file = this.getFile(); result = result * PRIME + ($file == null ? 0 : $file.hashCode()); result = result * PRIME + this.getLine1(); result = result * PRIME + this.getPos1(); result = result * PRIME + this.getLine2(); result = result * PRIME + this.getPos2(); final java.lang.Object $_next = this.get_next(); result = result * PRIME + ($_next == null ? 0 : $_next.hashCode()); return result; } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public Position withFile(final String file) { return this.file == file ? this : new Position(file, this.line1, this.pos1, this.line2, this.pos2, this._next); } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public Position withLine1(final int line1) { return this.line1 == line1 ? this : new Position(this.file, line1, this.pos1, this.line2, this.pos2, this._next); } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public Position withPos1(final int pos1) { return this.pos1 == pos1 ? this : new Position(this.file, this.line1, pos1, this.line2, this.pos2, this._next); } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public Position withLine2(final int line2) { return this.line2 == line2 ? this : new Position(this.file, this.line1, this.pos1, line2, this.pos2, this._next); } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public Position withPos2(final int pos2) { return this.pos2 == pos2 ? this : new Position(this.file, this.line1, this.pos1, this.line2, pos2, this._next); } @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") public Position with_next(final Position _next) { return this._next == _next ? this : new Position(this.file, this.line1, this.pos1, this.line2, this.pos2, _next); } } interface HasPos { Position getP(); } interface HasReceiver extends HasPos, Expression { Expression getReceiver(); Expression withReceiver(Expression receiver); } }