Initial commit of main compiler sources (or should I say ... SAUCES!)
This commit is contained in:
5
slangc/codegraph/AbstractClassDefinition.sauce
Normal file
5
slangc/codegraph/AbstractClassDefinition.sauce
Normal file
@@ -0,0 +1,5 @@
|
||||
package slangc.codegraph;
|
||||
|
||||
public interface AbstractClassDefinition extends AbstractTypeDefinition {
|
||||
public AbstractLink getSuperClass();
|
||||
}
|
5
slangc/codegraph/AbstractConstructor.sauce
Normal file
5
slangc/codegraph/AbstractConstructor.sauce
Normal file
@@ -0,0 +1,5 @@
|
||||
package slangc.codegraph;
|
||||
|
||||
public interface AbstractConstructor extends AbstractInvokable {
|
||||
|
||||
}
|
9
slangc/codegraph/AbstractContainer.sauce
Normal file
9
slangc/codegraph/AbstractContainer.sauce
Normal file
@@ -0,0 +1,9 @@
|
||||
package slangc.codegraph;
|
||||
|
||||
public interface AbstractContainer extends AbstractNamedElement {
|
||||
public int countNamedElements();
|
||||
|
||||
public AbstractNamedElement getNamedElement(int index);
|
||||
|
||||
public ContainerType getContainerType();
|
||||
}
|
5
slangc/codegraph/AbstractEnumDefinition.sauce
Normal file
5
slangc/codegraph/AbstractEnumDefinition.sauce
Normal file
@@ -0,0 +1,5 @@
|
||||
package slangc.codegraph;
|
||||
|
||||
public interface AbstractEnumDefinition extends AbstractInterfaceDefinition {
|
||||
|
||||
}
|
5
slangc/codegraph/AbstractField.sauce
Normal file
5
slangc/codegraph/AbstractField.sauce
Normal file
@@ -0,0 +1,5 @@
|
||||
package slangc.codegraph;
|
||||
|
||||
public interface AbstractField extends AbstractNamedElement {
|
||||
|
||||
}
|
5
slangc/codegraph/AbstractInterfaceDefinition.sauce
Normal file
5
slangc/codegraph/AbstractInterfaceDefinition.sauce
Normal file
@@ -0,0 +1,5 @@
|
||||
package slangc.codegraph;
|
||||
|
||||
public interface AbstractInterfaceDefinition {
|
||||
|
||||
}
|
5
slangc/codegraph/AbstractInvokable.sauce
Normal file
5
slangc/codegraph/AbstractInvokable.sauce
Normal file
@@ -0,0 +1,5 @@
|
||||
package slangc.codegraph;
|
||||
|
||||
public interface AbstractInvokable extends AbstractMember {
|
||||
|
||||
}
|
7
slangc/codegraph/AbstractLink.sauce
Normal file
7
slangc/codegraph/AbstractLink.sauce
Normal file
@@ -0,0 +1,7 @@
|
||||
package slangc.codegraph;
|
||||
|
||||
public interface AbstractLink {
|
||||
boolean isResolved();
|
||||
String getTargetName();
|
||||
AbstractNamedElement getTarget();
|
||||
}
|
7
slangc/codegraph/AbstractMember.sauce
Normal file
7
slangc/codegraph/AbstractMember.sauce
Normal file
@@ -0,0 +1,7 @@
|
||||
package slangc.codegraph;
|
||||
|
||||
public interface AbstractMember extends AbstractNamedElement {
|
||||
public MemberType getMemberType();
|
||||
|
||||
public boolean isStatic();
|
||||
}
|
5
slangc/codegraph/AbstractMethod.sauce
Normal file
5
slangc/codegraph/AbstractMethod.sauce
Normal file
@@ -0,0 +1,5 @@
|
||||
package slangc.codegraph;
|
||||
|
||||
public interface AbstractMethod extends AbstractInvokable {
|
||||
|
||||
}
|
15
slangc/codegraph/AbstractNamedElement.sauce
Normal file
15
slangc/codegraph/AbstractNamedElement.sauce
Normal file
@@ -0,0 +1,15 @@
|
||||
package slangc.codegraph;
|
||||
|
||||
public interface AbstractNamedElement {
|
||||
|
||||
public AbstractContainer getEnclosingContainer();
|
||||
public String getSimpleName();
|
||||
public String getFullName();
|
||||
|
||||
public AbstractTypeDefinition getType();
|
||||
public AbstractPackage getPackage();
|
||||
public AbstractSet getSet();
|
||||
public AbstractWorld getWorld();
|
||||
|
||||
public Object getCompilerObject();
|
||||
}
|
5
slangc/codegraph/AbstractPackage.sauce
Normal file
5
slangc/codegraph/AbstractPackage.sauce
Normal file
@@ -0,0 +1,5 @@
|
||||
package slangc.codegraph;
|
||||
|
||||
public interface AbstractPackage extends AbstractContainer {
|
||||
|
||||
}
|
11
slangc/codegraph/AbstractSet.sauce
Normal file
11
slangc/codegraph/AbstractSet.sauce
Normal file
@@ -0,0 +1,11 @@
|
||||
package slangc.codegraph;
|
||||
|
||||
/**
|
||||
* Represents a set of packages (either an already-compiled set, or a set of sourceFile packages being compiled or analysed).
|
||||
*
|
||||
* @author Zak
|
||||
*
|
||||
*/
|
||||
public interface AbstractSet extends AbstractContainer {
|
||||
|
||||
}
|
5
slangc/codegraph/AbstractTagDefinition.sauce
Normal file
5
slangc/codegraph/AbstractTagDefinition.sauce
Normal file
@@ -0,0 +1,5 @@
|
||||
package slangc.codegraph;
|
||||
|
||||
public interface AbstractTagDefinition extends AbstractTypeDefinition {
|
||||
|
||||
}
|
10
slangc/codegraph/AbstractTypeDefinition.sauce
Normal file
10
slangc/codegraph/AbstractTypeDefinition.sauce
Normal file
@@ -0,0 +1,10 @@
|
||||
package slangc.codegraph;
|
||||
|
||||
public interface AbstractTypeDefinition extends AbstractContainer {
|
||||
|
||||
public TypeType getTypeType();
|
||||
|
||||
public int countInheritedInterfaces();
|
||||
|
||||
public AbstractLink getInheritedInterface(int index);
|
||||
}
|
5
slangc/codegraph/AbstractWorld.sauce
Normal file
5
slangc/codegraph/AbstractWorld.sauce
Normal file
@@ -0,0 +1,5 @@
|
||||
package slangc.codegraph;
|
||||
|
||||
public interface AbstractWorld extends AbstractContainer {
|
||||
|
||||
}
|
8
slangc/codegraph/ContainerType.sauce
Normal file
8
slangc/codegraph/ContainerType.sauce
Normal file
@@ -0,0 +1,8 @@
|
||||
package slangc.codegraph;
|
||||
|
||||
public enum ContainerType {
|
||||
WORLD,
|
||||
SET,
|
||||
PACKAGE,
|
||||
TYPE
|
||||
}
|
21
slangc/codegraph/DynamicClassDefinition.sauce
Normal file
21
slangc/codegraph/DynamicClassDefinition.sauce
Normal file
@@ -0,0 +1,21 @@
|
||||
package slangc.codegraph;
|
||||
|
||||
public class DynamicClassDefinition extends DynamicType implements AbstractClassDefinition {
|
||||
private DynamicLink superClass = null;
|
||||
|
||||
public DynamicClassDefinition() {
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public TypeType getTypeType() {
|
||||
return TypeType.CLASS;
|
||||
}
|
||||
|
||||
public DynamicLink getSuperClass() {
|
||||
return superClass;
|
||||
}
|
||||
|
||||
public void setSuperClass(DynamicLink superClass) {
|
||||
this.superClass = superClass;
|
||||
}
|
||||
}
|
9
slangc/codegraph/DynamicConstructor.sauce
Normal file
9
slangc/codegraph/DynamicConstructor.sauce
Normal file
@@ -0,0 +1,9 @@
|
||||
package slangc.codegraph;
|
||||
|
||||
public class DynamicConstructor extends DynamicInvokable implements AbstractConstructor {
|
||||
|
||||
public DynamicConstructor() {
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
}
|
31
slangc/codegraph/DynamicContainer.sauce
Normal file
31
slangc/codegraph/DynamicContainer.sauce
Normal file
@@ -0,0 +1,31 @@
|
||||
package slangc.codegraph;
|
||||
|
||||
public abstract class DynamicContainer extends DynamicNamedElement implements AbstractContainer {
|
||||
private DynamicNamedElement[] elements = new DynamicNamedElement[0];
|
||||
|
||||
public DynamicContainer() {
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public int countNamedElements() {
|
||||
return elements.length;
|
||||
}
|
||||
|
||||
public DynamicNamedElement getNamedElement(int index) {
|
||||
if (index < 0 || index > elements.length) {
|
||||
return null;
|
||||
} else {
|
||||
return elements[index];
|
||||
}
|
||||
}
|
||||
|
||||
public void appendNamedElement(DynamicNamedElement e) {
|
||||
DynamicNamedElement[] nelem = new DynamicNamedElement[elements.length + 1];
|
||||
for (int i = 0; i < elements.length; i++) {
|
||||
nelem[i] = elements[i];
|
||||
}
|
||||
nelem[nelem.length - 1] = e;
|
||||
elements = nelem;
|
||||
e.setEnclosingContainer(this);
|
||||
}
|
||||
}
|
13
slangc/codegraph/DynamicEnumDefinition.sauce
Normal file
13
slangc/codegraph/DynamicEnumDefinition.sauce
Normal file
@@ -0,0 +1,13 @@
|
||||
package slangc.codegraph;
|
||||
|
||||
public class DynamicEnumDefinition extends DynamicInterfaceDefinition implements AbstractEnumDefinition {
|
||||
|
||||
public DynamicEnumDefinition() {
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public TypeType getTypeType() {
|
||||
return TypeType.ENUM;
|
||||
}
|
||||
|
||||
}
|
9
slangc/codegraph/DynamicField.sauce
Normal file
9
slangc/codegraph/DynamicField.sauce
Normal file
@@ -0,0 +1,9 @@
|
||||
package slangc.codegraph;
|
||||
|
||||
public class DynamicField extends DynamicNamedElement implements AbstractField {
|
||||
|
||||
public DynamicField() {
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
}
|
13
slangc/codegraph/DynamicInterfaceDefinition.sauce
Normal file
13
slangc/codegraph/DynamicInterfaceDefinition.sauce
Normal file
@@ -0,0 +1,13 @@
|
||||
package slangc.codegraph;
|
||||
|
||||
public class DynamicInterfaceDefinition extends DynamicType implements AbstractInterfaceDefinition {
|
||||
|
||||
public DynamicInterfaceDefinition() {
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public TypeType getTypeType() {
|
||||
return TypeType.INTERFACE;
|
||||
}
|
||||
|
||||
}
|
19
slangc/codegraph/DynamicInvokable.sauce
Normal file
19
slangc/codegraph/DynamicInvokable.sauce
Normal file
@@ -0,0 +1,19 @@
|
||||
package slangc.codegraph;
|
||||
|
||||
public abstract class DynamicInvokable extends DynamicNamedElement implements AbstractInvokable {
|
||||
|
||||
public DynamicInvokable() {
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public MemberType getMemberType() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isStatic() {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
10
slangc/codegraph/DynamicLink.sauce
Normal file
10
slangc/codegraph/DynamicLink.sauce
Normal file
@@ -0,0 +1,10 @@
|
||||
package slangc.codegraph;
|
||||
|
||||
public abstract class DynamicLink implements AbstractLink {
|
||||
|
||||
public DynamicLink() {
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
|
||||
}
|
10
slangc/codegraph/DynamicMethod.sauce
Normal file
10
slangc/codegraph/DynamicMethod.sauce
Normal file
@@ -0,0 +1,10 @@
|
||||
package slangc.codegraph;
|
||||
|
||||
public class DynamicMethod extends DynamicInvokable implements AbstractMethod {
|
||||
|
||||
public DynamicMethod() {
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
|
||||
}
|
87
slangc/codegraph/DynamicNamedElement.sauce
Normal file
87
slangc/codegraph/DynamicNamedElement.sauce
Normal file
@@ -0,0 +1,87 @@
|
||||
package slangc.codegraph;
|
||||
|
||||
public class DynamicNamedElement implements AbstractNamedElement {
|
||||
private AbstractContainer container = null;
|
||||
private String name = "";
|
||||
private Object compilerObject = null;
|
||||
|
||||
public void setEnclosingContainer(AbstractContainer container) {
|
||||
if (this.container != null) {
|
||||
throw new Error("Container is already set.");
|
||||
}
|
||||
|
||||
this.container = container;
|
||||
}
|
||||
|
||||
public AbstractContainer getEnclosingContainer() {
|
||||
return container;
|
||||
}
|
||||
|
||||
public void setSimpleName(String name) {
|
||||
if (!this.name.equals("")) {
|
||||
throw new Error("SimpleName is already set.");
|
||||
}
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getSimpleName() {
|
||||
// TODO Auto-generated method stub
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getFullName() {
|
||||
if (container != null && container != getSet()) {
|
||||
return container.getFullName() + "." + getSimpleName();
|
||||
} else {
|
||||
return getSimpleName();
|
||||
}
|
||||
}
|
||||
|
||||
public AbstractTypeDefinition getType() {
|
||||
if (this instanceof AbstractTypeDefinition) {
|
||||
return (AbstractTypeDefinition) this;
|
||||
} else if (container != null) {
|
||||
return container.getType();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public AbstractPackage getPackage() {
|
||||
if (this instanceof AbstractPackage) {
|
||||
return (AbstractPackage) this;
|
||||
} else if (container != null) {
|
||||
return container.getPackage();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public AbstractSet getSet() {
|
||||
if (this instanceof AbstractSet) {
|
||||
return (AbstractSet) this;
|
||||
} else if (container != null) {
|
||||
return container.getSet();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public AbstractWorld getWorld() {
|
||||
if (this instanceof AbstractWorld) {
|
||||
return (AbstractWorld) this;
|
||||
} else if (container != null) {
|
||||
return container.getWorld();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public Object getCompilerObject() {
|
||||
return compilerObject;
|
||||
}
|
||||
|
||||
public void setCompilerObject(Object compilerObject) {
|
||||
this.compilerObject = compilerObject;
|
||||
}
|
||||
}
|
12
slangc/codegraph/DynamicPackage.sauce
Normal file
12
slangc/codegraph/DynamicPackage.sauce
Normal file
@@ -0,0 +1,12 @@
|
||||
package slangc.codegraph;
|
||||
|
||||
public class DynamicPackage extends DynamicContainer implements AbstractPackage {
|
||||
|
||||
public DynamicPackage() {
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public ContainerType getContainerType() {
|
||||
return ContainerType.PACKAGE;
|
||||
}
|
||||
}
|
12
slangc/codegraph/DynamicSet.sauce
Normal file
12
slangc/codegraph/DynamicSet.sauce
Normal file
@@ -0,0 +1,12 @@
|
||||
package slangc.codegraph;
|
||||
|
||||
public class DynamicSet extends DynamicContainer implements AbstractSet {
|
||||
|
||||
public DynamicSet() {
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public ContainerType getContainerType() {
|
||||
return ContainerType.SET;
|
||||
}
|
||||
}
|
13
slangc/codegraph/DynamicTagDefinition.sauce
Normal file
13
slangc/codegraph/DynamicTagDefinition.sauce
Normal file
@@ -0,0 +1,13 @@
|
||||
package slangc.codegraph;
|
||||
|
||||
public class DynamicTagDefinition extends DynamicInterfaceDefinition implements AbstractTagDefinition {
|
||||
|
||||
public DynamicTagDefinition() {
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public TypeType getTypeType() {
|
||||
return TypeType.TAG;
|
||||
}
|
||||
|
||||
}
|
35
slangc/codegraph/DynamicType.sauce
Normal file
35
slangc/codegraph/DynamicType.sauce
Normal file
@@ -0,0 +1,35 @@
|
||||
package slangc.codegraph;
|
||||
|
||||
public abstract class DynamicType extends DynamicContainer implements AbstractTypeDefinition {
|
||||
private DynamicLink[] interfaces = new DynamicLink[0];
|
||||
|
||||
public DynamicType() {
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public ContainerType getContainerType() {
|
||||
return ContainerType.TYPE;
|
||||
}
|
||||
|
||||
|
||||
public int countInheritedInterfaces() {
|
||||
return interfaces.length;
|
||||
}
|
||||
|
||||
public DynamicLink getInheritedInterface(int index) {
|
||||
if (index < 0 || index > interfaces.length) {
|
||||
return null;
|
||||
} else {
|
||||
return interfaces[index];
|
||||
}
|
||||
}
|
||||
|
||||
public void appendInheritedInterface(DynamicLink iface) {
|
||||
DynamicLink[] nifcs = new DynamicLink[interfaces.length + 1];
|
||||
for (int i = 0; i < interfaces.length; i++) {
|
||||
nifcs[i] = interfaces[i];
|
||||
}
|
||||
nifcs[nifcs.length - 1] = iface;
|
||||
interfaces = nifcs;
|
||||
}
|
||||
}
|
13
slangc/codegraph/DynamicWorld.sauce
Normal file
13
slangc/codegraph/DynamicWorld.sauce
Normal file
@@ -0,0 +1,13 @@
|
||||
package slangc.codegraph;
|
||||
|
||||
public class DynamicWorld extends DynamicContainer implements AbstractWorld {
|
||||
|
||||
public DynamicWorld() {
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public ContainerType getContainerType() {
|
||||
return ContainerType.WORLD;
|
||||
}
|
||||
|
||||
}
|
8
slangc/codegraph/MemberType.sauce
Normal file
8
slangc/codegraph/MemberType.sauce
Normal file
@@ -0,0 +1,8 @@
|
||||
package slangc.codegraph;
|
||||
|
||||
public enum MemberType {
|
||||
FIELD,
|
||||
METHOD,
|
||||
CONSTRUCTOR,
|
||||
TYPE
|
||||
}
|
9
slangc/codegraph/TypeType.sauce
Normal file
9
slangc/codegraph/TypeType.sauce
Normal file
@@ -0,0 +1,9 @@
|
||||
package slangc.codegraph;
|
||||
|
||||
public enum TypeType {
|
||||
UNINITIALISED,
|
||||
CLASS,
|
||||
INTERFACE,
|
||||
ENUM,
|
||||
TAG
|
||||
}
|
Reference in New Issue
Block a user