This commit is contained in:
JanUlrich 2016-12-15 17:07:17 +01:00
commit 76880708a1
126 changed files with 27429 additions and 18996 deletions

View File

@ -6,5 +6,6 @@
<classpathentry kind="lib" path="lib/bcel-6.1-SNAPSHOT.jar" sourcepath="lib/bcel-6.1-SNAPSHOT-sources.jar"/>
<classpathentry kind="lib" path="lib/guava-10.0.1.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry kind="lib" path="lib/antlr-complete.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -1,5 +1,6 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8

View File

@ -1,24 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'>
<appender name="CONSOLE" class="de.dhbwstuttgart.logger.ConsoleAppender">
<param name="Target" value="System.out"/>
<layout class="de.dhbwstuttgart.logger.PatternLayout">
<param name="ConversionPattern" value="%-15C{1} %-5p [%-9c] %m%n"/>
</layout>
</appender>
<logger name="trtest">
<level value="DEBUG"/>
<appender-ref ref="CONSOLE"/>
</logger>
<logger name="funcTest">
<level value="DEBUG"/>
<appender-ref ref="CONSOLE"/>
</logger>
</log4j:configuration>

View File

@ -1,3 +0,0 @@
class Matrix{
<A extends B, C extends B> String op = "String";
}

View File

@ -1,3 +0,0 @@
class FieldInitializationTest{
String var = "hallo";
}

View File

@ -1,3 +0,0 @@
class Test{
<A> A var;
}

View File

@ -1,4 +0,0 @@
import java.util.*;
class ImportTest{
}

View File

@ -100,7 +100,7 @@ var activeTableTab = "activeTableTab";
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>de.dhbwstuttgart.parser.JavaClassName</li>
<li>de.dhbwstuttgart.typecheck.JavaClassName</li>
</ul>
</li>
</ul>

View File

@ -3,7 +3,7 @@
<html lang="de">
<head>
<!-- Generated by javadoc (1.8.0_05) on Tue May 12 19:56:24 CEST 2015 -->
<title>Uses of Class de.dhbwstuttgart.parser.JavaClassName</title>
<title>Uses of Class de.dhbwstuttgart.typecheck.JavaClassName</title>
<meta name="date" content="2015-05-12">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../script.js"></script>
@ -70,7 +70,7 @@
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h2 title="Uses of Class de.dhbwstuttgart.parser.JavaClassName" class="title">Uses of Class<br>de.dhbwstuttgart.parser.JavaClassName</h2>
<h2 title="Uses of Class de.dhbwstuttgart.typecheck.JavaClassName" class="title">Uses of Class<br>de.dhbwstuttgart.parser.JavaClassName</h2>
</div>
<div class="classUseContainer">
<ul class="blockList">

View File

@ -112,7 +112,7 @@ var activeTableTab = "activeTableTab";
<li><a href="../../../../de/dhbwstuttgart/syntaxtree/type/GenericTypeVar.html" title="class in de.dhbwstuttgart.syntaxtree.type">de.dhbwstuttgart.syntaxtree.type.GenericTypeVar</a></li>
<li>
<ul class="inheritance">
<li>de.dhbwstuttgart.syntaxtree.type.BoundedGenericTypeVar</li>
<li>de.dhbwstuttgart.syntaxtree.GenericTypeVar</li>
</ul>
</li>
</ul>

View File

@ -3,7 +3,7 @@
<html lang="de">
<head>
<!-- Generated by javadoc (1.8.0_05) on Tue May 12 19:56:24 CEST 2015 -->
<title>Uses of Class de.dhbwstuttgart.syntaxtree.type.BoundedGenericTypeVar</title>
<title>Uses of Class de.dhbwstuttgart.syntaxtree.GenericTypeVar</title>
<meta name="date" content="2015-05-12">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../../script.js"></script>
@ -70,7 +70,7 @@
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h2 title="Uses of Class de.dhbwstuttgart.syntaxtree.type.BoundedGenericTypeVar" class="title">Uses of Class<br>de.dhbwstuttgart.syntaxtree.type.BoundedGenericTypeVar</h2>
<h2 title="Uses of Class de.dhbwstuttgart.syntaxtree.GenericTypeVar" class="title">Uses of Class<br>de.dhbwstuttgart.syntaxtree.BoundedGenericTypeVar</h2>
</div>
<div class="classUseContainer">
<ul class="blockList">

BIN
lib/antlr-complete.jar Executable file

Binary file not shown.

View File

@ -1,10 +1,7 @@
package de.dhbwstuttgart.bytecode;
import de.dhbwstuttgart.syntaxtree.type.BoundedGenericTypeVar;
import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar;
import de.dhbwstuttgart.syntaxtree.type.ObjectType;
import de.dhbwstuttgart.syntaxtree.GenericTypeVar;
import de.dhbwstuttgart.syntaxtree.type.RefType;
import de.dhbwstuttgart.syntaxtree.type.Type;
import de.dhbwstuttgart.typeinference.exceptions.NotImplementedException;
public class BytecodeTypeFactory {
@ -12,7 +9,7 @@ public class BytecodeTypeFactory {
/**
* @see https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-FieldType
*/
public static String generateFieldDescriptor(Type t){
public static String generateFieldDescriptor(RefType t){
String ret = "";
if(t instanceof RefType){
ret += "L" + t.getName().toString().replace('.', '/') + ";";
@ -40,15 +37,15 @@ public class BytecodeTypeFactory {
return ret;
}
public static String generateSuperClassSignature(Type superClass){
public static String generateSuperClassSignature(RefType superClass){
String ret = "";
//TODO:
throw new NotImplementedException();
}
private static String generateTypeParameter(GenericTypeVar gtv){
String ret = gtv.get_Name() + ":";
for(ObjectType t : gtv.getBounds()){
String ret = gtv.getName() + ":";
for(RefType t : gtv.getBounds()){
ret += generateReferenceTypeSignature(t);
ret += ":";
}
@ -66,17 +63,16 @@ public class BytecodeTypeFactory {
/**
* @see https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-ReferenceTypeSignature
*/
private static String generateReferenceTypeSignature(Type t){
private static String generateReferenceTypeSignature(RefType t){
if(t instanceof RefType)return generateReferenceTypeSignature((RefType)t);
if(t instanceof GenericTypeVar)return generateReferenceTypeSignature((GenericTypeVar)t);
throw new NotImplementedException();
}
private static String generateReferenceTypeSignature(RefType t){
String ret = "L" + t.get_Name();
String ret = "L" + t.getName();
if(t.getParaList() != null && t.getParaList().size() > 0){
ret += "<";
for(Type p : t.getParaList()){
for(RefType p : t.getParaList()){
ret += generateReferenceTypeSignature(p);
}
ret+=">";

View File

@ -3,15 +3,12 @@ package de.dhbwstuttgart.bytecode;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Vector;
import org.apache.bcel.classfile.BootstrapMethod;
import org.apache.bcel.classfile.BootstrapMethods;
import org.apache.bcel.classfile.ConstantPool;
import org.apache.bcel.classfile.InnerClass;
import org.apache.bcel.classfile.InnerClasses;
import org.apache.bcel.classfile.JavaClass;
@ -20,14 +17,12 @@ import org.apache.bcel.classfile.Signature;
import org.apache.bcel.generic.ClassGen;
import org.apache.bcel.generic.ConstantPoolGen;
import de.dhbwstuttgart.parser.JavaClassName;
import de.dhbwstuttgart.typecheck.JavaClassName;
import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar;
import de.dhbwstuttgart.syntaxtree.type.RefType;
import de.dhbwstuttgart.syntaxtree.type.Type;
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
import de.dhbwstuttgart.typeinference.Menge;
import de.dhbwstuttgart.typeinference.ResultSet;
import de.dhbwstuttgart.typeinference.TypeinferenceResultSet;
import de.dhbwstuttgart.typeinference.TypeinferenceResults;
import de.dhbwstuttgart.typeinference.exceptions.DebugException;

View File

@ -1,5 +1,6 @@
package de.dhbwstuttgart.bytecode;
import java.awt.List;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
@ -65,10 +66,11 @@ public class MethodGenerator extends MethodGen{
//TODO: Das ist schlecht! Der Parser oder der Typinferenzalgorithmus muss dafür sorgen, dass sich in jeder Methode ein Return befindet.
if (block.get_Statement().size() == 0) { il.append(factory.createReturn( org.apache.bcel.generic.Type.VOID)); }
else {
if (!(block.get_Statement().lastElement() instanceof Return) &&
this.getType().equals(org.apache.bcel.generic.Type.VOID)) {
il.append(factory.createReturn( org.apache.bcel.generic.Type.VOID));
}
java.util.List<Statement> stmts = block.get_Statement();
if (!(stmts.get(stmts.size()-1) instanceof Return) &&
this.getType().equals(org.apache.bcel.generic.Type.VOID)) {
il.append(factory.createReturn( org.apache.bcel.generic.Type.VOID));
}
}
method.getInstructionList().setPositions();

View File

@ -1,209 +0,0 @@
// ino.module.AClassOrInterface.8526.package
package de.dhbwstuttgart.core;
// ino.end
// ino.module.AClassOrInterface.8526.import
import de.dhbwstuttgart.typeinference.Menge;
import de.dhbwstuttgart.logger.Logger;
// ino.end
import de.dhbwstuttgart.parser.JavaClassName;
import de.dhbwstuttgart.syntaxtree.Interface;
import de.dhbwstuttgart.syntaxtree.misc.UsedId;
import de.dhbwstuttgart.syntaxtree.modifier.Modifiers;
import de.dhbwstuttgart.syntaxtree.type.RefType;
import de.dhbwstuttgart.syntaxtree.type.Type;
// ino.class.AClassOrInterface.21186.description type=javadoc
/**
* Superklasse von Class und Interface. Beinhaltet gemeinsame Attribute
* der beiden Objekte.
*
* @author Juergen Schmiing
*
*/
// ino.end
// ino.class.AClassOrInterface.21186.declaration
public interface AClassOrInterface
// ino.end
// ino.class.AClassOrInterface.21186.body
{
public JavaClassName getName();
public Menge<Type> getSuperInterfaces();
public void setSuperInterfaces(Menge<Type> Menge);
/*
// ino.attribute.inferencelog.21189.decldescription type=javadoc
// ino.end
// ino.attribute.inferencelog.21189.declaration
protected static Logger inferencelog = Logger.getLogger("inference");
// ino.end
// ino.attribute.codegenlog.21192.declaration
protected static Logger codegenlog = Logger.getLogger("codegen");
// ino.end
// ino.attribute.parserlog.21195.declaration
protected static Logger parserlog = Logger.getLogger("parser");
// ino.end
// ino.attribute.pkgName.21198.decldescription type=line
// Package-Name
// ino.end
// ino.attribute.pkgName.21198.declaration
protected UsedId pkgName;
// ino.end
// ino.attribute.modifiers.21201.decldescription type=line
// Class/Interface-Name und Access-Modifiers
// ino.end
// ino.attribute.modifiers.21201.declaration
protected Modifiers modifiers;
// ino.end
// ino.attribute.name.21204.declaration
protected String name;
// ino.end
// ino.attribute.superif.21207.decldescription type=line
// Superinterfaces. Interfaces erweitern die Liste,
// Klassen implementieren die Liste.
// ino.end
// ino.attribute.superif.21207.declaration
private Menge<UsedId> superif = new Menge<UsedId>();
// ino.end
// ino.method.AClassOrInterface.21210.defdescription type=line
// Konstruktoren
// ino.end
// ino.method.AClassOrInterface.21210.definition
public AClassOrInterface()
// ino.end
// ino.method.AClassOrInterface.21210.body
{}
// ino.end
// ino.method.AClassOrInterface.21213.definition
public AClassOrInterface(String strName)
// ino.end
// ino.method.AClassOrInterface.21213.body
{
name = strName;
}
// ino.end
// ino.method.AClassOrInterface.21216.definition
public AClassOrInterface(String strName, Modifiers mod)
// ino.end
// ino.method.AClassOrInterface.21216.body
{
name = strName;
this.modifiers = mod;
}
// ino.end
// ino.method.getPackageName.21219.defdescription type=line
// Handling fuer Packages
// ino.end
// ino.method.getPackageName.21219.definition
public UsedId getPackageName()
// ino.end
// ino.method.getPackageName.21219.body
{
return pkgName;
}
// ino.end
// ino.method.setPackageName.21222.definition
public void setPackageName(UsedId pkgName)
// ino.end
// ino.method.setPackageName.21222.body
{
this.pkgName = pkgName;
}
// ino.end
// ino.method.getName.21225.definition
public String getName()
// ino.end
// ino.method.getName.21225.body
{
return name;
}
// ino.end
// ino.method.setName.21228.definition
public void setName(String strName)
// ino.end
// ino.method.setName.21228.body
{
name = strName;
}
// ino.end
// ino.method.setModifiers.21231.definition
public void setModifiers(Modifiers mod)
// ino.end
// ino.method.setModifiers.21231.body
{
this.modifiers = mod;
}
// ino.end
// ino.method.getModifiers.21234.definition
public Modifiers getModifiers()
// ino.end
// ino.method.getModifiers.21234.body
{
return this.modifiers;
}
// ino.end
// ino.method.getAccessFlags.21237.defdescription type=javadoc
// ino.end
// ino.method.getAccessFlags.21237.definition
public short getAccessFlags()
// ino.end
// ino.method.getAccessFlags.21237.body
{
short ret = 0;
if (modifiers != null) {
ret = modifiers.calculate_access_flags();
}
//if (ret != 0)
// return ret;
//else
// return (short) 32;
//feda 04.07.07 wird bei der Codegenerierung des Class File beachtet.
return ret;
}
// ino.end
// ino.method.getSuperInterfaces.21240.definition
public Menge<UsedId> getSuperInterfaces()
// ino.end
// ino.method.getSuperInterfaces.21240.body
{
return superif;
}
// ino.end
// ino.method.setSuperInterfaces.21243.definition
public void setSuperInterfaces(Menge<UsedId> superif)
// ino.end
// ino.method.setSuperInterfaces.21243.body
{
this.superif = superif;
}
// ino.end
// ino.method.codegen.21246.declaration
public abstract void codegen(SourceFile sf)
throws JVMCodeException;
// ino.end
*/
}
// ino.end

View File

@ -1,17 +1,7 @@
// ino.module.IItemWithOffset.8527.package
package de.dhbwstuttgart.core;
// ino.end
// ino.class.IItemWithOffset.21249.declaration
public interface IItemWithOffset
// ino.end
// ino.class.IItemWithOffset.21249.body
{
// ino.method.getOffset.21252.declaration
public int getOffset();
// ino.end
// ino.method.getVariableLength.21255.declaration
public int getVariableLength();
// ino.end
}
// ino.end

View File

@ -13,18 +13,12 @@ import de.dhbwstuttgart.typeinference.Menge;
import de.dhbwstuttgart.logger.Logger;
import de.dhbwstuttgart.logger.LoggerConfiguration;
import de.dhbwstuttgart.logger.Section;
import de.dhbwstuttgart.parser.JavaParser;
import de.dhbwstuttgart.parser.Scanner;
import de.dhbwstuttgart.parser.JavaParser.yyException;
import de.dhbwstuttgart.syntaxtree.Class;
import de.dhbwstuttgart.syntaxtree.ClassBody;
import de.dhbwstuttgart.syntaxtree.FormalParameter;
import de.dhbwstuttgart.syntaxtree.ImportDeclarations;
import de.dhbwstuttgart.syntaxtree.Method;
import de.dhbwstuttgart.syntaxtree.ParameterList;
import de.dhbwstuttgart.syntaxtree.SourceFile;
import de.dhbwstuttgart.syntaxtree.misc.DeclId;
import de.dhbwstuttgart.syntaxtree.misc.UsedId;
import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar;
import de.dhbwstuttgart.syntaxtree.type.IMatchable;
import de.dhbwstuttgart.syntaxtree.type.ITypeContainer;

View File

@ -1,3 +0,0 @@
JavaLexer.java
JavaParser.java

View File

@ -1,26 +0,0 @@
package de.dhbwstuttgart.parser;
import de.dhbwstuttgart.typeinference.Menge;
import de.dhbwstuttgart.syntaxtree.type.ObjectType;
import de.dhbwstuttgart.syntaxtree.type.RefType;
import de.dhbwstuttgart.syntaxtree.type.Type;
public class BoundedClassIdentifierList extends Menge<ObjectType>{
private int endOffset;
private Menge<ObjectType> list;
public BoundedClassIdentifierList(Menge<ObjectType> list, int endOffset){
this.endOffset = endOffset;
this.addAll(list);
}
public int getEndOffset() {
return endOffset;
}
public void addOffsetOff(RefType refType) {
this.endOffset = refType.getOffset() + refType.getName().toString().length();
}
}

View File

@ -1,97 +0,0 @@
// ino.module.ClassAndParameter.8613.package
package de.dhbwstuttgart.parser;
// ino.end
// ino.module.ClassAndParameter.8613.import
import de.dhbwstuttgart.typeinference.Menge;
import de.dhbwstuttgart.syntaxtree.type.ParaList;
import de.dhbwstuttgart.syntaxtree.type.Type;
// ino.class.ClassAndParameter.24323.description type=javadoc
/**
* Hilfskonstrukt, um die Grammatik fuer einen Klassenheader
* ueberschaubar zu halten. Klassenname und optionale Generics
* werden hiermit kombiniert und sofort nach dem Parsen in der
* Klasse Class zueruck aufgeloest.
* @author SCJU
*
*/
// ino.end
// ino.class.ClassAndParameter.24323.declaration
public class ClassAndParameter
// ino.end
// ino.class.ClassAndParameter.24323.body
{
// ino.attribute.name.24326.declaration
private String name;
// ino.end
// ino.attribute.plist.24329.declaration
private ParaList plist;
// ino.end
// ino.method.ClassAndParameter.24332.definition
public ClassAndParameter(String name)
// ino.end
// ino.method.ClassAndParameter.24332.body
{
this.name = name;
}
// ino.end
// ino.method.ClassAndParameter.24335.definition
public ClassAndParameter(String name, ParaList plist)
// ino.end
// ino.method.ClassAndParameter.24335.body
{
this.name = name;
this.plist = plist;
}
// ino.end
// ino.method.getParaMenge.24338.definition
public Menge<Type> getParaMenge()
// ino.end
// ino.method.getParaMenge.24338.body
{
if (plist == null) return null;
return plist.get_ParaList();
}
// ino.end
// ino.method.getName.24341.definition
public String getName()
// ino.end
// ino.method.getName.24341.body
{
return name;
}
// ino.end
// ino.method.setName.24344.definition
public void setName(String name)
// ino.end
// ino.method.setName.24344.body
{
this.name = name;
}
// ino.end
// ino.method.getParalist.24347.definition
public ParaList getParalist()
// ino.end
// ino.method.getParalist.24347.body
{
return plist;
}
// ino.end
// ino.method.setParalist.24350.definition
public void setParalist(ParaList plist)
// ino.end
// ino.method.setParalist.24350.body
{
this.plist = plist;
}
// ino.end
}
// ino.end

View File

@ -0,0 +1,24 @@
package de.dhbwstuttgart.parser;
import org.antlr.v4.runtime.tree.*;
import de.dhbwstuttgart.syntaxtree.*;
public class CompilationUnitEvaluator extends Java8BaseListener{
@Override
public void enterCompilationUnit(Java8Parser.CompilationUnitContext ctx) {
System.out.println("SourceFile(");
}
@Override
public void exitCompilationUnit(Java8Parser.CompilationUnitContext ctx) {
System.out.println(")");
}
@Override
public void enterPackageDeclaration(Java8Parser.PackageDeclarationContext ctx) {
System.out.println("package(");
}
@Override
public void exitPackageDeclaration(Java8Parser.PackageDeclarationContext ctx) {
System.out.println(ctx.Identifier());
System.out.println(")");
}
}

View File

@ -1,26 +0,0 @@
package de.dhbwstuttgart.parser;
import de.dhbwstuttgart.typeinference.Menge;
import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar;
import de.dhbwstuttgart.typeinference.exceptions.DebugException;
public class GenericVarDeclarationList {
private Menge<GenericTypeVar> elements = new Menge<>();
public void addElement(GenericTypeVar e){
elements.addElement(e);
}
public int getEndOffset() {
int ret;
if(elements.isEmpty())throw new DebugException("Es wurde eine GenericVarDeclarationList ohne Elemente geparst");
ret = elements.lastElement().getEndOffset();
return ret;
}
public Menge<GenericTypeVar> getElements(){
return elements;
}
}

View File

@ -1,98 +0,0 @@
// ino.module.InterfaceAndParameter.8614.package
package de.dhbwstuttgart.parser;
// ino.end
// ino.module.InterfaceAndParameter.8614.import
import de.dhbwstuttgart.typeinference.Menge;
import de.dhbwstuttgart.syntaxtree.type.ParaList;
import de.dhbwstuttgart.syntaxtree.type.Type;
// ino.class.InterfaceAndParameter.24353.description type=javadoc
/**
* Hilfskonstrukt, um die Grammatik fuer einen Interfaceheader
* ueberschaubar zu halten. Interface und optionale Generics
* werden hiermit kombiniert und sofort nach dem Parsen in der
* Klasse Interface zueruck aufgeloest.
* @author HOTI
*
*/
// ino.end
// ino.class.InterfaceAndParameter.24353.declaration
public class InterfaceAndParameter
// ino.end
// ino.class.InterfaceAndParameter.24353.body
{
// ino.attribute.name.24356.declaration
private String name;
// ino.end
// ino.attribute.plist.24359.declaration
private ParaList plist=new ParaList();
// ino.end
// ino.method.InterfaceAndParameter.24362.definition
public InterfaceAndParameter(String name)
// ino.end
// ino.method.InterfaceAndParameter.24362.body
{
this.name = name;
}
// ino.end
// ino.method.InterfaceAndParameter.24365.definition
public InterfaceAndParameter(String name, ParaList plist)
// ino.end
// ino.method.InterfaceAndParameter.24365.body
{
this.name = name;
this.plist = plist;
}
// ino.end
// ino.method.getParaMenge.24368.definition
public Menge<Type> getParaMenge()
// ino.end
// ino.method.getParaMenge.24368.body
{
if (plist == null) return null;
return plist.get_ParaList();
}
// ino.end
// ino.method.getName.24371.definition
public String getName()
// ino.end
// ino.method.getName.24371.body
{
return name;
}
// ino.end
// ino.method.setName.24374.definition
public void setName(String name)
// ino.end
// ino.method.setName.24374.body
{
this.name = name;
}
// ino.end
// ino.method.getParalist.24377.definition
public ParaList getParalist()
// ino.end
// ino.method.getParalist.24377.body
{
return plist;
}
// ino.end
// ino.method.setParalist.24380.definition
public void setParalist(ParaList plist)
// ino.end
// ino.method.setParalist.24380.body
{
this.plist = plist;
}
// ino.end
}
// ino.end

View File

@ -1,54 +0,0 @@
// ino.module.InterfaceList.8615.package
package de.dhbwstuttgart.parser;
// ino.end
// ino.module.InterfaceList.8615.import
import de.dhbwstuttgart.typeinference.Menge;
import de.dhbwstuttgart.syntaxtree.Interface;
import de.dhbwstuttgart.syntaxtree.misc.UsedId;
import de.dhbwstuttgart.syntaxtree.type.RefType;
import de.dhbwstuttgart.syntaxtree.type.Type;
// ino.class.InterfaceList.24383.description type=javadoc
/**
* Hilfskonstrukt fuer die Grammatik, um ungepruefte
* Typcasts fuer Mengeen zu umgehen. Wird nuer fuer den
* Parser benoetigt.
* @author SCJU
*
*/
// ino.end
// ino.class.InterfaceList.24383.declaration
public class InterfaceList
// ino.end
// ino.class.InterfaceList.24383.body
{
// ino.attribute.superif.24386.declaration
private Menge<UsedId> superif = new Menge<UsedId>();
// ino.end
// ino.method.addInterface.24389.definition
public void addInterface(UsedId uid)
// ino.end
// ino.method.addInterface.24389.body
{
superif.addElement(uid);
}
// ino.end
// ino.method.getMenge.24392.definition
public Menge<Type> getTypeMenge()
// ino.end
// ino.method.getMenge.24392.body
{
Menge<Type> ret = new Menge<>();
for(UsedId name : superif){
ret.add(new Interface(name.get_Name_1Element(), name.getOffset()).getType());
}
return ret;
}
// ino.end
}
// ino.end

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,205 @@
ABSTRACT=1
ASSERT=2
BOOLEAN=3
BREAK=4
BYTE=5
CASE=6
CATCH=7
CHAR=8
CLASS=9
CONST=10
CONTINUE=11
DEFAULT=12
DO=13
DOUBLE=14
ELSE=15
ENUM=16
EXTENDS=17
FINAL=18
FINALLY=19
FLOAT=20
FOR=21
IF=22
GOTO=23
IMPLEMENTS=24
IMPORT=25
INSTANCEOF=26
INT=27
INTERFACE=28
LONG=29
NATIVE=30
NEW=31
PACKAGE=32
PRIVATE=33
PROTECTED=34
PUBLIC=35
RETURN=36
SHORT=37
STATIC=38
STRICTFP=39
SUPER=40
SWITCH=41
SYNCHRONIZED=42
THIS=43
THROW=44
THROWS=45
TRANSIENT=46
TRY=47
VOID=48
VOLATILE=49
WHILE=50
IntegerLiteral=51
FloatingPointLiteral=52
BooleanLiteral=53
CharacterLiteral=54
StringLiteral=55
NullLiteral=56
LPAREN=57
RPAREN=58
LBRACE=59
RBRACE=60
LBRACK=61
RBRACK=62
SEMI=63
COMMA=64
DOT=65
ASSIGN=66
GT=67
LT=68
BANG=69
TILDE=70
QUESTION=71
COLON=72
EQUAL=73
LE=74
GE=75
NOTEQUAL=76
AND=77
OR=78
INC=79
DEC=80
ADD=81
SUB=82
MUL=83
DIV=84
BITAND=85
BITOR=86
CARET=87
MOD=88
ARROW=89
COLONCOLON=90
ADD_ASSIGN=91
SUB_ASSIGN=92
MUL_ASSIGN=93
DIV_ASSIGN=94
AND_ASSIGN=95
OR_ASSIGN=96
XOR_ASSIGN=97
MOD_ASSIGN=98
LSHIFT_ASSIGN=99
RSHIFT_ASSIGN=100
URSHIFT_ASSIGN=101
Identifier=102
AT=103
ELLIPSIS=104
WS=105
COMMENT=106
LINE_COMMENT=107
'abstract'=1
'assert'=2
'boolean'=3
'break'=4
'byte'=5
'case'=6
'catch'=7
'char'=8
'class'=9
'const'=10
'continue'=11
'default'=12
'do'=13
'double'=14
'else'=15
'enum'=16
'extends'=17
'final'=18
'finally'=19
'float'=20
'for'=21
'if'=22
'goto'=23
'implements'=24
'import'=25
'instanceof'=26
'int'=27
'interface'=28
'long'=29
'native'=30
'new'=31
'package'=32
'private'=33
'protected'=34
'public'=35
'return'=36
'short'=37
'static'=38
'strictfp'=39
'super'=40
'switch'=41
'synchronized'=42
'this'=43
'throw'=44
'throws'=45
'transient'=46
'try'=47
'void'=48
'volatile'=49
'while'=50
'null'=56
'('=57
')'=58
'{'=59
'}'=60
'['=61
']'=62
';'=63
','=64
'.'=65
'='=66
'>'=67
'<'=68
'!'=69
'~'=70
'?'=71
':'=72
'=='=73
'<='=74
'>='=75
'!='=76
'&&'=77
'||'=78
'++'=79
'--'=80
'+'=81
'-'=82
'*'=83
'/'=84
'&'=85
'|'=86
'^'=87
'%'=88
'->'=89
'::'=90
'+='=91
'-='=92
'*='=93
'/='=94
'&='=95
'|='=96
'^='=97
'%='=98
'<<='=99
'>>='=100
'>>>='=101
'@'=103
'...'=104

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,584 @@
// Generated from Java8.g4 by ANTLR 4.5.3
package de.dhbwstuttgart.parser;
import org.antlr.v4.runtime.Lexer;
import org.antlr.v4.runtime.CharStream;
import org.antlr.v4.runtime.Token;
import org.antlr.v4.runtime.TokenStream;
import org.antlr.v4.runtime.*;
import org.antlr.v4.runtime.atn.*;
import org.antlr.v4.runtime.dfa.DFA;
import org.antlr.v4.runtime.misc.*;
@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"})
public class Java8Lexer extends Lexer {
static { RuntimeMetaData.checkVersion("4.5.3", RuntimeMetaData.VERSION); }
protected static final DFA[] _decisionToDFA;
protected static final PredictionContextCache _sharedContextCache =
new PredictionContextCache();
public static final int
ABSTRACT=1, ASSERT=2, BOOLEAN=3, BREAK=4, BYTE=5, CASE=6, CATCH=7, CHAR=8,
CLASS=9, CONST=10, CONTINUE=11, DEFAULT=12, DO=13, DOUBLE=14, ELSE=15,
ENUM=16, EXTENDS=17, FINAL=18, FINALLY=19, FLOAT=20, FOR=21, IF=22, GOTO=23,
IMPLEMENTS=24, IMPORT=25, INSTANCEOF=26, INT=27, INTERFACE=28, LONG=29,
NATIVE=30, NEW=31, PACKAGE=32, PRIVATE=33, PROTECTED=34, PUBLIC=35, RETURN=36,
SHORT=37, STATIC=38, STRICTFP=39, SUPER=40, SWITCH=41, SYNCHRONIZED=42,
THIS=43, THROW=44, THROWS=45, TRANSIENT=46, TRY=47, VOID=48, VOLATILE=49,
WHILE=50, IntegerLiteral=51, FloatingPointLiteral=52, BooleanLiteral=53,
CharacterLiteral=54, StringLiteral=55, NullLiteral=56, LPAREN=57, RPAREN=58,
LBRACE=59, RBRACE=60, LBRACK=61, RBRACK=62, SEMI=63, COMMA=64, DOT=65,
ASSIGN=66, GT=67, LT=68, BANG=69, TILDE=70, QUESTION=71, COLON=72, EQUAL=73,
LE=74, GE=75, NOTEQUAL=76, AND=77, OR=78, INC=79, DEC=80, ADD=81, SUB=82,
MUL=83, DIV=84, BITAND=85, BITOR=86, CARET=87, MOD=88, ARROW=89, COLONCOLON=90,
ADD_ASSIGN=91, SUB_ASSIGN=92, MUL_ASSIGN=93, DIV_ASSIGN=94, AND_ASSIGN=95,
OR_ASSIGN=96, XOR_ASSIGN=97, MOD_ASSIGN=98, LSHIFT_ASSIGN=99, RSHIFT_ASSIGN=100,
URSHIFT_ASSIGN=101, Identifier=102, AT=103, ELLIPSIS=104, WS=105, COMMENT=106,
LINE_COMMENT=107;
public static String[] modeNames = {
"DEFAULT_MODE"
};
public static final String[] ruleNames = {
"ABSTRACT", "ASSERT", "BOOLEAN", "BREAK", "BYTE", "CASE", "CATCH", "CHAR",
"CLASS", "CONST", "CONTINUE", "DEFAULT", "DO", "DOUBLE", "ELSE", "ENUM",
"EXTENDS", "FINAL", "FINALLY", "FLOAT", "FOR", "IF", "GOTO", "IMPLEMENTS",
"IMPORT", "INSTANCEOF", "INT", "INTERFACE", "LONG", "NATIVE", "NEW", "PACKAGE",
"PRIVATE", "PROTECTED", "PUBLIC", "RETURN", "SHORT", "STATIC", "STRICTFP",
"SUPER", "SWITCH", "SYNCHRONIZED", "THIS", "THROW", "THROWS", "TRANSIENT",
"TRY", "VOID", "VOLATILE", "WHILE", "IntegerLiteral", "DecimalIntegerLiteral",
"HexIntegerLiteral", "OctalIntegerLiteral", "BinaryIntegerLiteral", "IntegerTypeSuffix",
"DecimalNumeral", "Digits", "Digit", "NonZeroDigit", "DigitsAndUnderscores",
"DigitOrUnderscore", "Underscores", "HexNumeral", "HexDigits", "HexDigit",
"HexDigitsAndUnderscores", "HexDigitOrUnderscore", "OctalNumeral", "OctalDigits",
"OctalDigit", "OctalDigitsAndUnderscores", "OctalDigitOrUnderscore", "BinaryNumeral",
"BinaryDigits", "BinaryDigit", "BinaryDigitsAndUnderscores", "BinaryDigitOrUnderscore",
"FloatingPointLiteral", "DecimalFloatingPointLiteral", "ExponentPart",
"ExponentIndicator", "SignedInteger", "Sign", "FloatTypeSuffix", "HexadecimalFloatingPointLiteral",
"HexSignificand", "BinaryExponent", "BinaryExponentIndicator", "BooleanLiteral",
"CharacterLiteral", "SingleCharacter", "StringLiteral", "StringCharacters",
"StringCharacter", "EscapeSequence", "OctalEscape", "ZeroToThree", "UnicodeEscape",
"NullLiteral", "LPAREN", "RPAREN", "LBRACE", "RBRACE", "LBRACK", "RBRACK",
"SEMI", "COMMA", "DOT", "ASSIGN", "GT", "LT", "BANG", "TILDE", "QUESTION",
"COLON", "EQUAL", "LE", "GE", "NOTEQUAL", "AND", "OR", "INC", "DEC", "ADD",
"SUB", "MUL", "DIV", "BITAND", "BITOR", "CARET", "MOD", "ARROW", "COLONCOLON",
"ADD_ASSIGN", "SUB_ASSIGN", "MUL_ASSIGN", "DIV_ASSIGN", "AND_ASSIGN",
"OR_ASSIGN", "XOR_ASSIGN", "MOD_ASSIGN", "LSHIFT_ASSIGN", "RSHIFT_ASSIGN",
"URSHIFT_ASSIGN", "Identifier", "JavaLetter", "JavaLetterOrDigit", "AT",
"ELLIPSIS", "WS", "COMMENT", "LINE_COMMENT"
};
private static final String[] _LITERAL_NAMES = {
null, "'abstract'", "'assert'", "'boolean'", "'break'", "'byte'", "'case'",
"'catch'", "'char'", "'class'", "'const'", "'continue'", "'default'",
"'do'", "'double'", "'else'", "'enum'", "'extends'", "'final'", "'finally'",
"'float'", "'for'", "'if'", "'goto'", "'implements'", "'import'", "'instanceof'",
"'int'", "'interface'", "'long'", "'native'", "'new'", "'package'", "'private'",
"'protected'", "'public'", "'return'", "'short'", "'static'", "'strictfp'",
"'super'", "'switch'", "'synchronized'", "'this'", "'throw'", "'throws'",
"'transient'", "'try'", "'void'", "'volatile'", "'while'", null, null,
null, null, null, "'null'", "'('", "')'", "'{'", "'}'", "'['", "']'",
"';'", "','", "'.'", "'='", "'>'", "'<'", "'!'", "'~'", "'?'", "':'",
"'=='", "'<='", "'>='", "'!='", "'&&'", "'||'", "'++'", "'--'", "'+'",
"'-'", "'*'", "'/'", "'&'", "'|'", "'^'", "'%'", "'->'", "'::'", "'+='",
"'-='", "'*='", "'/='", "'&='", "'|='", "'^='", "'%='", "'<<='", "'>>='",
"'>>>='", null, "'@'", "'...'"
};
private static final String[] _SYMBOLIC_NAMES = {
null, "ABSTRACT", "ASSERT", "BOOLEAN", "BREAK", "BYTE", "CASE", "CATCH",
"CHAR", "CLASS", "CONST", "CONTINUE", "DEFAULT", "DO", "DOUBLE", "ELSE",
"ENUM", "EXTENDS", "FINAL", "FINALLY", "FLOAT", "FOR", "IF", "GOTO", "IMPLEMENTS",
"IMPORT", "INSTANCEOF", "INT", "INTERFACE", "LONG", "NATIVE", "NEW", "PACKAGE",
"PRIVATE", "PROTECTED", "PUBLIC", "RETURN", "SHORT", "STATIC", "STRICTFP",
"SUPER", "SWITCH", "SYNCHRONIZED", "THIS", "THROW", "THROWS", "TRANSIENT",
"TRY", "VOID", "VOLATILE", "WHILE", "IntegerLiteral", "FloatingPointLiteral",
"BooleanLiteral", "CharacterLiteral", "StringLiteral", "NullLiteral",
"LPAREN", "RPAREN", "LBRACE", "RBRACE", "LBRACK", "RBRACK", "SEMI", "COMMA",
"DOT", "ASSIGN", "GT", "LT", "BANG", "TILDE", "QUESTION", "COLON", "EQUAL",
"LE", "GE", "NOTEQUAL", "AND", "OR", "INC", "DEC", "ADD", "SUB", "MUL",
"DIV", "BITAND", "BITOR", "CARET", "MOD", "ARROW", "COLONCOLON", "ADD_ASSIGN",
"SUB_ASSIGN", "MUL_ASSIGN", "DIV_ASSIGN", "AND_ASSIGN", "OR_ASSIGN", "XOR_ASSIGN",
"MOD_ASSIGN", "LSHIFT_ASSIGN", "RSHIFT_ASSIGN", "URSHIFT_ASSIGN", "Identifier",
"AT", "ELLIPSIS", "WS", "COMMENT", "LINE_COMMENT"
};
public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES);
/**
* @deprecated Use {@link #VOCABULARY} instead.
*/
@Deprecated
public static final String[] tokenNames;
static {
tokenNames = new String[_SYMBOLIC_NAMES.length];
for (int i = 0; i < tokenNames.length; i++) {
tokenNames[i] = VOCABULARY.getLiteralName(i);
if (tokenNames[i] == null) {
tokenNames[i] = VOCABULARY.getSymbolicName(i);
}
if (tokenNames[i] == null) {
tokenNames[i] = "<INVALID>";
}
}
}
@Override
@Deprecated
public String[] getTokenNames() {
return tokenNames;
}
@Override
public Vocabulary getVocabulary() {
return VOCABULARY;
}
public Java8Lexer(CharStream input) {
super(input);
_interp = new LexerATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache);
}
@Override
public String getGrammarFileName() { return "Java8.g4"; }
@Override
public String[] getRuleNames() { return ruleNames; }
@Override
public String getSerializedATN() { return _serializedATN; }
@Override
public String[] getModeNames() { return modeNames; }
@Override
public ATN getATN() { return _ATN; }
@Override
public boolean sempred(RuleContext _localctx, int ruleIndex, int predIndex) {
switch (ruleIndex) {
case 146:
return JavaLetter_sempred((RuleContext)_localctx, predIndex);
case 147:
return JavaLetterOrDigit_sempred((RuleContext)_localctx, predIndex);
}
return true;
}
private boolean JavaLetter_sempred(RuleContext _localctx, int predIndex) {
switch (predIndex) {
case 0:
return Character.isJavaIdentifierStart(_input.LA(-1));
case 1:
return Character.isJavaIdentifierStart(Character.toCodePoint((char)_input.LA(-2), (char)_input.LA(-1)));
}
return true;
}
private boolean JavaLetterOrDigit_sempred(RuleContext _localctx, int predIndex) {
switch (predIndex) {
case 2:
return Character.isJavaIdentifierPart(_input.LA(-1));
case 3:
return Character.isJavaIdentifierPart(Character.toCodePoint((char)_input.LA(-2), (char)_input.LA(-1)));
}
return true;
}
public static final String _serializedATN =
"\3\u0430\ud6d1\u8206\uad2d\u4417\uaef1\u8d80\uaadd\2m\u0448\b\1\4\2\t"+
"\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\4\t\t\t\4\n\t\n\4\13"+
"\t\13\4\f\t\f\4\r\t\r\4\16\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22\t\22"+
"\4\23\t\23\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t\27\4\30\t\30\4\31\t\31"+
"\4\32\t\32\4\33\t\33\4\34\t\34\4\35\t\35\4\36\t\36\4\37\t\37\4 \t \4!"+
"\t!\4\"\t\"\4#\t#\4$\t$\4%\t%\4&\t&\4\'\t\'\4(\t(\4)\t)\4*\t*\4+\t+\4"+
",\t,\4-\t-\4.\t.\4/\t/\4\60\t\60\4\61\t\61\4\62\t\62\4\63\t\63\4\64\t"+
"\64\4\65\t\65\4\66\t\66\4\67\t\67\48\t8\49\t9\4:\t:\4;\t;\4<\t<\4=\t="+
"\4>\t>\4?\t?\4@\t@\4A\tA\4B\tB\4C\tC\4D\tD\4E\tE\4F\tF\4G\tG\4H\tH\4I"+
"\tI\4J\tJ\4K\tK\4L\tL\4M\tM\4N\tN\4O\tO\4P\tP\4Q\tQ\4R\tR\4S\tS\4T\tT"+
"\4U\tU\4V\tV\4W\tW\4X\tX\4Y\tY\4Z\tZ\4[\t[\4\\\t\\\4]\t]\4^\t^\4_\t_\4"+
"`\t`\4a\ta\4b\tb\4c\tc\4d\td\4e\te\4f\tf\4g\tg\4h\th\4i\ti\4j\tj\4k\t"+
"k\4l\tl\4m\tm\4n\tn\4o\to\4p\tp\4q\tq\4r\tr\4s\ts\4t\tt\4u\tu\4v\tv\4"+
"w\tw\4x\tx\4y\ty\4z\tz\4{\t{\4|\t|\4}\t}\4~\t~\4\177\t\177\4\u0080\t\u0080"+
"\4\u0081\t\u0081\4\u0082\t\u0082\4\u0083\t\u0083\4\u0084\t\u0084\4\u0085"+
"\t\u0085\4\u0086\t\u0086\4\u0087\t\u0087\4\u0088\t\u0088\4\u0089\t\u0089"+
"\4\u008a\t\u008a\4\u008b\t\u008b\4\u008c\t\u008c\4\u008d\t\u008d\4\u008e"+
"\t\u008e\4\u008f\t\u008f\4\u0090\t\u0090\4\u0091\t\u0091\4\u0092\t\u0092"+
"\4\u0093\t\u0093\4\u0094\t\u0094\4\u0095\t\u0095\4\u0096\t\u0096\4\u0097"+
"\t\u0097\4\u0098\t\u0098\4\u0099\t\u0099\4\u009a\t\u009a\3\2\3\2\3\2\3"+
"\2\3\2\3\2\3\2\3\2\3\2\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\4\3\4\3\4\3\4\3\4"+
"\3\4\3\4\3\4\3\5\3\5\3\5\3\5\3\5\3\5\3\6\3\6\3\6\3\6\3\6\3\7\3\7\3\7\3"+
"\7\3\7\3\b\3\b\3\b\3\b\3\b\3\b\3\t\3\t\3\t\3\t\3\t\3\n\3\n\3\n\3\n\3\n"+
"\3\n\3\13\3\13\3\13\3\13\3\13\3\13\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3\f"+
"\3\r\3\r\3\r\3\r\3\r\3\r\3\r\3\r\3\16\3\16\3\16\3\17\3\17\3\17\3\17\3"+
"\17\3\17\3\17\3\20\3\20\3\20\3\20\3\20\3\21\3\21\3\21\3\21\3\21\3\22\3"+
"\22\3\22\3\22\3\22\3\22\3\22\3\22\3\23\3\23\3\23\3\23\3\23\3\23\3\24\3"+
"\24\3\24\3\24\3\24\3\24\3\24\3\24\3\25\3\25\3\25\3\25\3\25\3\25\3\26\3"+
"\26\3\26\3\26\3\27\3\27\3\27\3\30\3\30\3\30\3\30\3\30\3\31\3\31\3\31\3"+
"\31\3\31\3\31\3\31\3\31\3\31\3\31\3\31\3\32\3\32\3\32\3\32\3\32\3\32\3"+
"\32\3\33\3\33\3\33\3\33\3\33\3\33\3\33\3\33\3\33\3\33\3\33\3\34\3\34\3"+
"\34\3\34\3\35\3\35\3\35\3\35\3\35\3\35\3\35\3\35\3\35\3\35\3\36\3\36\3"+
"\36\3\36\3\36\3\37\3\37\3\37\3\37\3\37\3\37\3\37\3 \3 \3 \3 \3!\3!\3!"+
"\3!\3!\3!\3!\3!\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3#\3#\3#\3#\3#\3#\3#\3"+
"#\3#\3#\3$\3$\3$\3$\3$\3$\3$\3%\3%\3%\3%\3%\3%\3%\3&\3&\3&\3&\3&\3&\3"+
"\'\3\'\3\'\3\'\3\'\3\'\3\'\3(\3(\3(\3(\3(\3(\3(\3(\3(\3)\3)\3)\3)\3)\3"+
")\3*\3*\3*\3*\3*\3*\3*\3+\3+\3+\3+\3+\3+\3+\3+\3+\3+\3+\3+\3+\3,\3,\3"+
",\3,\3,\3-\3-\3-\3-\3-\3-\3.\3.\3.\3.\3.\3.\3.\3/\3/\3/\3/\3/\3/\3/\3"+
"/\3/\3/\3\60\3\60\3\60\3\60\3\61\3\61\3\61\3\61\3\61\3\62\3\62\3\62\3"+
"\62\3\62\3\62\3\62\3\62\3\62\3\63\3\63\3\63\3\63\3\63\3\63\3\64\3\64\3"+
"\64\3\64\5\64\u028d\n\64\3\65\3\65\5\65\u0291\n\65\3\66\3\66\5\66\u0295"+
"\n\66\3\67\3\67\5\67\u0299\n\67\38\38\58\u029d\n8\39\39\3:\3:\3:\5:\u02a4"+
"\n:\3:\3:\3:\5:\u02a9\n:\5:\u02ab\n:\3;\3;\5;\u02af\n;\3;\5;\u02b2\n;"+
"\3<\3<\5<\u02b6\n<\3=\3=\3>\6>\u02bb\n>\r>\16>\u02bc\3?\3?\5?\u02c1\n"+
"?\3@\6@\u02c4\n@\r@\16@\u02c5\3A\3A\3A\3A\3B\3B\5B\u02ce\nB\3B\5B\u02d1"+
"\nB\3C\3C\3D\6D\u02d6\nD\rD\16D\u02d7\3E\3E\5E\u02dc\nE\3F\3F\5F\u02e0"+
"\nF\3F\3F\3G\3G\5G\u02e6\nG\3G\5G\u02e9\nG\3H\3H\3I\6I\u02ee\nI\rI\16"+
"I\u02ef\3J\3J\5J\u02f4\nJ\3K\3K\3K\3K\3L\3L\5L\u02fc\nL\3L\5L\u02ff\n"+
"L\3M\3M\3N\6N\u0304\nN\rN\16N\u0305\3O\3O\5O\u030a\nO\3P\3P\5P\u030e\n"+
"P\3Q\3Q\3Q\5Q\u0313\nQ\3Q\5Q\u0316\nQ\3Q\5Q\u0319\nQ\3Q\3Q\3Q\5Q\u031e"+
"\nQ\3Q\5Q\u0321\nQ\3Q\3Q\3Q\5Q\u0326\nQ\3Q\3Q\3Q\5Q\u032b\nQ\3R\3R\3R"+
"\3S\3S\3T\5T\u0333\nT\3T\3T\3U\3U\3V\3V\3W\3W\3W\5W\u033e\nW\3X\3X\5X"+
"\u0342\nX\3X\3X\3X\5X\u0347\nX\3X\3X\5X\u034b\nX\3Y\3Y\3Y\3Z\3Z\3[\3["+
"\3[\3[\3[\3[\3[\3[\3[\5[\u035b\n[\3\\\3\\\3\\\3\\\3\\\3\\\3\\\3\\\5\\"+
"\u0365\n\\\3]\3]\3^\3^\5^\u036b\n^\3^\3^\3_\6_\u0370\n_\r_\16_\u0371\3"+
"`\3`\5`\u0376\n`\3a\3a\3a\3a\5a\u037c\na\3b\3b\3b\3b\3b\3b\3b\3b\3b\3"+
"b\3b\5b\u0389\nb\3c\3c\3d\3d\3d\3d\3d\3d\3d\3e\3e\3e\3e\3e\3f\3f\3g\3"+
"g\3h\3h\3i\3i\3j\3j\3k\3k\3l\3l\3m\3m\3n\3n\3o\3o\3p\3p\3q\3q\3r\3r\3"+
"s\3s\3t\3t\3u\3u\3v\3v\3v\3w\3w\3w\3x\3x\3x\3y\3y\3y\3z\3z\3z\3{\3{\3"+
"{\3|\3|\3|\3}\3}\3}\3~\3~\3\177\3\177\3\u0080\3\u0080\3\u0081\3\u0081"+
"\3\u0082\3\u0082\3\u0083\3\u0083\3\u0084\3\u0084\3\u0085\3\u0085\3\u0086"+
"\3\u0086\3\u0086\3\u0087\3\u0087\3\u0087\3\u0088\3\u0088\3\u0088\3\u0089"+
"\3\u0089\3\u0089\3\u008a\3\u008a\3\u008a\3\u008b\3\u008b\3\u008b\3\u008c"+
"\3\u008c\3\u008c\3\u008d\3\u008d\3\u008d\3\u008e\3\u008e\3\u008e\3\u008f"+
"\3\u008f\3\u008f\3\u0090\3\u0090\3\u0090\3\u0090\3\u0091\3\u0091\3\u0091"+
"\3\u0091\3\u0092\3\u0092\3\u0092\3\u0092\3\u0092\3\u0093\3\u0093\7\u0093"+
"\u040e\n\u0093\f\u0093\16\u0093\u0411\13\u0093\3\u0094\3\u0094\3\u0094"+
"\3\u0094\3\u0094\3\u0094\5\u0094\u0419\n\u0094\3\u0095\3\u0095\3\u0095"+
"\3\u0095\3\u0095\3\u0095\5\u0095\u0421\n\u0095\3\u0096\3\u0096\3\u0097"+
"\3\u0097\3\u0097\3\u0097\3\u0098\6\u0098\u042a\n\u0098\r\u0098\16\u0098"+
"\u042b\3\u0098\3\u0098\3\u0099\3\u0099\3\u0099\3\u0099\7\u0099\u0434\n"+
"\u0099\f\u0099\16\u0099\u0437\13\u0099\3\u0099\3\u0099\3\u0099\3\u0099"+
"\3\u0099\3\u009a\3\u009a\3\u009a\3\u009a\7\u009a\u0442\n\u009a\f\u009a"+
"\16\u009a\u0445\13\u009a\3\u009a\3\u009a\3\u0435\2\u009b\3\3\5\4\7\5\t"+
"\6\13\7\r\b\17\t\21\n\23\13\25\f\27\r\31\16\33\17\35\20\37\21!\22#\23"+
"%\24\'\25)\26+\27-\30/\31\61\32\63\33\65\34\67\359\36;\37= ?!A\"C#E$G"+
"%I&K\'M(O)Q*S+U,W-Y.[/]\60_\61a\62c\63e\64g\65i\2k\2m\2o\2q\2s\2u\2w\2"+
"y\2{\2}\2\177\2\u0081\2\u0083\2\u0085\2\u0087\2\u0089\2\u008b\2\u008d"+
"\2\u008f\2\u0091\2\u0093\2\u0095\2\u0097\2\u0099\2\u009b\2\u009d\2\u009f"+
"\66\u00a1\2\u00a3\2\u00a5\2\u00a7\2\u00a9\2\u00ab\2\u00ad\2\u00af\2\u00b1"+
"\2\u00b3\2\u00b5\67\u00b78\u00b9\2\u00bb9\u00bd\2\u00bf\2\u00c1\2\u00c3"+
"\2\u00c5\2\u00c7\2\u00c9:\u00cb;\u00cd<\u00cf=\u00d1>\u00d3?\u00d5@\u00d7"+
"A\u00d9B\u00dbC\u00ddD\u00dfE\u00e1F\u00e3G\u00e5H\u00e7I\u00e9J\u00eb"+
"K\u00edL\u00efM\u00f1N\u00f3O\u00f5P\u00f7Q\u00f9R\u00fbS\u00fdT\u00ff"+
"U\u0101V\u0103W\u0105X\u0107Y\u0109Z\u010b[\u010d\\\u010f]\u0111^\u0113"+
"_\u0115`\u0117a\u0119b\u011bc\u011dd\u011fe\u0121f\u0123g\u0125h\u0127"+
"\2\u0129\2\u012bi\u012dj\u012fk\u0131l\u0133m\3\2\30\4\2NNnn\3\2\63;\4"+
"\2ZZzz\5\2\62;CHch\3\2\629\4\2DDdd\3\2\62\63\4\2GGgg\4\2--//\6\2FFHHf"+
"fhh\4\2RRrr\4\2))^^\4\2$$^^\n\2$$))^^ddhhppttvv\3\2\62\65\6\2&&C\\aac"+
"|\4\2\2\u0081\ud802\udc01\3\2\ud802\udc01\3\2\udc02\ue001\7\2&&\62;C\\"+
"aac|\5\2\13\f\16\17\"\"\4\2\f\f\17\17\u0456\2\3\3\2\2\2\2\5\3\2\2\2\2"+
"\7\3\2\2\2\2\t\3\2\2\2\2\13\3\2\2\2\2\r\3\2\2\2\2\17\3\2\2\2\2\21\3\2"+
"\2\2\2\23\3\2\2\2\2\25\3\2\2\2\2\27\3\2\2\2\2\31\3\2\2\2\2\33\3\2\2\2"+
"\2\35\3\2\2\2\2\37\3\2\2\2\2!\3\2\2\2\2#\3\2\2\2\2%\3\2\2\2\2\'\3\2\2"+
"\2\2)\3\2\2\2\2+\3\2\2\2\2-\3\2\2\2\2/\3\2\2\2\2\61\3\2\2\2\2\63\3\2\2"+
"\2\2\65\3\2\2\2\2\67\3\2\2\2\29\3\2\2\2\2;\3\2\2\2\2=\3\2\2\2\2?\3\2\2"+
"\2\2A\3\2\2\2\2C\3\2\2\2\2E\3\2\2\2\2G\3\2\2\2\2I\3\2\2\2\2K\3\2\2\2\2"+
"M\3\2\2\2\2O\3\2\2\2\2Q\3\2\2\2\2S\3\2\2\2\2U\3\2\2\2\2W\3\2\2\2\2Y\3"+
"\2\2\2\2[\3\2\2\2\2]\3\2\2\2\2_\3\2\2\2\2a\3\2\2\2\2c\3\2\2\2\2e\3\2\2"+
"\2\2g\3\2\2\2\2\u009f\3\2\2\2\2\u00b5\3\2\2\2\2\u00b7\3\2\2\2\2\u00bb"+
"\3\2\2\2\2\u00c9\3\2\2\2\2\u00cb\3\2\2\2\2\u00cd\3\2\2\2\2\u00cf\3\2\2"+
"\2\2\u00d1\3\2\2\2\2\u00d3\3\2\2\2\2\u00d5\3\2\2\2\2\u00d7\3\2\2\2\2\u00d9"+
"\3\2\2\2\2\u00db\3\2\2\2\2\u00dd\3\2\2\2\2\u00df\3\2\2\2\2\u00e1\3\2\2"+
"\2\2\u00e3\3\2\2\2\2\u00e5\3\2\2\2\2\u00e7\3\2\2\2\2\u00e9\3\2\2\2\2\u00eb"+
"\3\2\2\2\2\u00ed\3\2\2\2\2\u00ef\3\2\2\2\2\u00f1\3\2\2\2\2\u00f3\3\2\2"+
"\2\2\u00f5\3\2\2\2\2\u00f7\3\2\2\2\2\u00f9\3\2\2\2\2\u00fb\3\2\2\2\2\u00fd"+
"\3\2\2\2\2\u00ff\3\2\2\2\2\u0101\3\2\2\2\2\u0103\3\2\2\2\2\u0105\3\2\2"+
"\2\2\u0107\3\2\2\2\2\u0109\3\2\2\2\2\u010b\3\2\2\2\2\u010d\3\2\2\2\2\u010f"+
"\3\2\2\2\2\u0111\3\2\2\2\2\u0113\3\2\2\2\2\u0115\3\2\2\2\2\u0117\3\2\2"+
"\2\2\u0119\3\2\2\2\2\u011b\3\2\2\2\2\u011d\3\2\2\2\2\u011f\3\2\2\2\2\u0121"+
"\3\2\2\2\2\u0123\3\2\2\2\2\u0125\3\2\2\2\2\u012b\3\2\2\2\2\u012d\3\2\2"+
"\2\2\u012f\3\2\2\2\2\u0131\3\2\2\2\2\u0133\3\2\2\2\3\u0135\3\2\2\2\5\u013e"+
"\3\2\2\2\7\u0145\3\2\2\2\t\u014d\3\2\2\2\13\u0153\3\2\2\2\r\u0158\3\2"+
"\2\2\17\u015d\3\2\2\2\21\u0163\3\2\2\2\23\u0168\3\2\2\2\25\u016e\3\2\2"+
"\2\27\u0174\3\2\2\2\31\u017d\3\2\2\2\33\u0185\3\2\2\2\35\u0188\3\2\2\2"+
"\37\u018f\3\2\2\2!\u0194\3\2\2\2#\u0199\3\2\2\2%\u01a1\3\2\2\2\'\u01a7"+
"\3\2\2\2)\u01af\3\2\2\2+\u01b5\3\2\2\2-\u01b9\3\2\2\2/\u01bc\3\2\2\2\61"+
"\u01c1\3\2\2\2\63\u01cc\3\2\2\2\65\u01d3\3\2\2\2\67\u01de\3\2\2\29\u01e2"+
"\3\2\2\2;\u01ec\3\2\2\2=\u01f1\3\2\2\2?\u01f8\3\2\2\2A\u01fc\3\2\2\2C"+
"\u0204\3\2\2\2E\u020c\3\2\2\2G\u0216\3\2\2\2I\u021d\3\2\2\2K\u0224\3\2"+
"\2\2M\u022a\3\2\2\2O\u0231\3\2\2\2Q\u023a\3\2\2\2S\u0240\3\2\2\2U\u0247"+
"\3\2\2\2W\u0254\3\2\2\2Y\u0259\3\2\2\2[\u025f\3\2\2\2]\u0266\3\2\2\2_"+
"\u0270\3\2\2\2a\u0274\3\2\2\2c\u0279\3\2\2\2e\u0282\3\2\2\2g\u028c\3\2"+
"\2\2i\u028e\3\2\2\2k\u0292\3\2\2\2m\u0296\3\2\2\2o\u029a\3\2\2\2q\u029e"+
"\3\2\2\2s\u02aa\3\2\2\2u\u02ac\3\2\2\2w\u02b5\3\2\2\2y\u02b7\3\2\2\2{"+
"\u02ba\3\2\2\2}\u02c0\3\2\2\2\177\u02c3\3\2\2\2\u0081\u02c7\3\2\2\2\u0083"+
"\u02cb\3\2\2\2\u0085\u02d2\3\2\2\2\u0087\u02d5\3\2\2\2\u0089\u02db\3\2"+
"\2\2\u008b\u02dd\3\2\2\2\u008d\u02e3\3\2\2\2\u008f\u02ea\3\2\2\2\u0091"+
"\u02ed\3\2\2\2\u0093\u02f3\3\2\2\2\u0095\u02f5\3\2\2\2\u0097\u02f9\3\2"+
"\2\2\u0099\u0300\3\2\2\2\u009b\u0303\3\2\2\2\u009d\u0309\3\2\2\2\u009f"+
"\u030d\3\2\2\2\u00a1\u032a\3\2\2\2\u00a3\u032c\3\2\2\2\u00a5\u032f\3\2"+
"\2\2\u00a7\u0332\3\2\2\2\u00a9\u0336\3\2\2\2\u00ab\u0338\3\2\2\2\u00ad"+
"\u033a\3\2\2\2\u00af\u034a\3\2\2\2\u00b1\u034c\3\2\2\2\u00b3\u034f\3\2"+
"\2\2\u00b5\u035a\3\2\2\2\u00b7\u0364\3\2\2\2\u00b9\u0366\3\2\2\2\u00bb"+
"\u0368\3\2\2\2\u00bd\u036f\3\2\2\2\u00bf\u0375\3\2\2\2\u00c1\u037b\3\2"+
"\2\2\u00c3\u0388\3\2\2\2\u00c5\u038a\3\2\2\2\u00c7\u038c\3\2\2\2\u00c9"+
"\u0393\3\2\2\2\u00cb\u0398\3\2\2\2\u00cd\u039a\3\2\2\2\u00cf\u039c\3\2"+
"\2\2\u00d1\u039e\3\2\2\2\u00d3\u03a0\3\2\2\2\u00d5\u03a2\3\2\2\2\u00d7"+
"\u03a4\3\2\2\2\u00d9\u03a6\3\2\2\2\u00db\u03a8\3\2\2\2\u00dd\u03aa\3\2"+
"\2\2\u00df\u03ac\3\2\2\2\u00e1\u03ae\3\2\2\2\u00e3\u03b0\3\2\2\2\u00e5"+
"\u03b2\3\2\2\2\u00e7\u03b4\3\2\2\2\u00e9\u03b6\3\2\2\2\u00eb\u03b8\3\2"+
"\2\2\u00ed\u03bb\3\2\2\2\u00ef\u03be\3\2\2\2\u00f1\u03c1\3\2\2\2\u00f3"+
"\u03c4\3\2\2\2\u00f5\u03c7\3\2\2\2\u00f7\u03ca\3\2\2\2\u00f9\u03cd\3\2"+
"\2\2\u00fb\u03d0\3\2\2\2\u00fd\u03d2\3\2\2\2\u00ff\u03d4\3\2\2\2\u0101"+
"\u03d6\3\2\2\2\u0103\u03d8\3\2\2\2\u0105\u03da\3\2\2\2\u0107\u03dc\3\2"+
"\2\2\u0109\u03de\3\2\2\2\u010b\u03e0\3\2\2\2\u010d\u03e3\3\2\2\2\u010f"+
"\u03e6\3\2\2\2\u0111\u03e9\3\2\2\2\u0113\u03ec\3\2\2\2\u0115\u03ef\3\2"+
"\2\2\u0117\u03f2\3\2\2\2\u0119\u03f5\3\2\2\2\u011b\u03f8\3\2\2\2\u011d"+
"\u03fb\3\2\2\2\u011f\u03fe\3\2\2\2\u0121\u0402\3\2\2\2\u0123\u0406\3\2"+
"\2\2\u0125\u040b\3\2\2\2\u0127\u0418\3\2\2\2\u0129\u0420\3\2\2\2\u012b"+
"\u0422\3\2\2\2\u012d\u0424\3\2\2\2\u012f\u0429\3\2\2\2\u0131\u042f\3\2"+
"\2\2\u0133\u043d\3\2\2\2\u0135\u0136\7c\2\2\u0136\u0137\7d\2\2\u0137\u0138"+
"\7u\2\2\u0138\u0139\7v\2\2\u0139\u013a\7t\2\2\u013a\u013b\7c\2\2\u013b"+
"\u013c\7e\2\2\u013c\u013d\7v\2\2\u013d\4\3\2\2\2\u013e\u013f\7c\2\2\u013f"+
"\u0140\7u\2\2\u0140\u0141\7u\2\2\u0141\u0142\7g\2\2\u0142\u0143\7t\2\2"+
"\u0143\u0144\7v\2\2\u0144\6\3\2\2\2\u0145\u0146\7d\2\2\u0146\u0147\7q"+
"\2\2\u0147\u0148\7q\2\2\u0148\u0149\7n\2\2\u0149\u014a\7g\2\2\u014a\u014b"+
"\7c\2\2\u014b\u014c\7p\2\2\u014c\b\3\2\2\2\u014d\u014e\7d\2\2\u014e\u014f"+
"\7t\2\2\u014f\u0150\7g\2\2\u0150\u0151\7c\2\2\u0151\u0152\7m\2\2\u0152"+
"\n\3\2\2\2\u0153\u0154\7d\2\2\u0154\u0155\7{\2\2\u0155\u0156\7v\2\2\u0156"+
"\u0157\7g\2\2\u0157\f\3\2\2\2\u0158\u0159\7e\2\2\u0159\u015a\7c\2\2\u015a"+
"\u015b\7u\2\2\u015b\u015c\7g\2\2\u015c\16\3\2\2\2\u015d\u015e\7e\2\2\u015e"+
"\u015f\7c\2\2\u015f\u0160\7v\2\2\u0160\u0161\7e\2\2\u0161\u0162\7j\2\2"+
"\u0162\20\3\2\2\2\u0163\u0164\7e\2\2\u0164\u0165\7j\2\2\u0165\u0166\7"+
"c\2\2\u0166\u0167\7t\2\2\u0167\22\3\2\2\2\u0168\u0169\7e\2\2\u0169\u016a"+
"\7n\2\2\u016a\u016b\7c\2\2\u016b\u016c\7u\2\2\u016c\u016d\7u\2\2\u016d"+
"\24\3\2\2\2\u016e\u016f\7e\2\2\u016f\u0170\7q\2\2\u0170\u0171\7p\2\2\u0171"+
"\u0172\7u\2\2\u0172\u0173\7v\2\2\u0173\26\3\2\2\2\u0174\u0175\7e\2\2\u0175"+
"\u0176\7q\2\2\u0176\u0177\7p\2\2\u0177\u0178\7v\2\2\u0178\u0179\7k\2\2"+
"\u0179\u017a\7p\2\2\u017a\u017b\7w\2\2\u017b\u017c\7g\2\2\u017c\30\3\2"+
"\2\2\u017d\u017e\7f\2\2\u017e\u017f\7g\2\2\u017f\u0180\7h\2\2\u0180\u0181"+
"\7c\2\2\u0181\u0182\7w\2\2\u0182\u0183\7n\2\2\u0183\u0184\7v\2\2\u0184"+
"\32\3\2\2\2\u0185\u0186\7f\2\2\u0186\u0187\7q\2\2\u0187\34\3\2\2\2\u0188"+
"\u0189\7f\2\2\u0189\u018a\7q\2\2\u018a\u018b\7w\2\2\u018b\u018c\7d\2\2"+
"\u018c\u018d\7n\2\2\u018d\u018e\7g\2\2\u018e\36\3\2\2\2\u018f\u0190\7"+
"g\2\2\u0190\u0191\7n\2\2\u0191\u0192\7u\2\2\u0192\u0193\7g\2\2\u0193 "+
"\3\2\2\2\u0194\u0195\7g\2\2\u0195\u0196\7p\2\2\u0196\u0197\7w\2\2\u0197"+
"\u0198\7o\2\2\u0198\"\3\2\2\2\u0199\u019a\7g\2\2\u019a\u019b\7z\2\2\u019b"+
"\u019c\7v\2\2\u019c\u019d\7g\2\2\u019d\u019e\7p\2\2\u019e\u019f\7f\2\2"+
"\u019f\u01a0\7u\2\2\u01a0$\3\2\2\2\u01a1\u01a2\7h\2\2\u01a2\u01a3\7k\2"+
"\2\u01a3\u01a4\7p\2\2\u01a4\u01a5\7c\2\2\u01a5\u01a6\7n\2\2\u01a6&\3\2"+
"\2\2\u01a7\u01a8\7h\2\2\u01a8\u01a9\7k\2\2\u01a9\u01aa\7p\2\2\u01aa\u01ab"+
"\7c\2\2\u01ab\u01ac\7n\2\2\u01ac\u01ad\7n\2\2\u01ad\u01ae\7{\2\2\u01ae"+
"(\3\2\2\2\u01af\u01b0\7h\2\2\u01b0\u01b1\7n\2\2\u01b1\u01b2\7q\2\2\u01b2"+
"\u01b3\7c\2\2\u01b3\u01b4\7v\2\2\u01b4*\3\2\2\2\u01b5\u01b6\7h\2\2\u01b6"+
"\u01b7\7q\2\2\u01b7\u01b8\7t\2\2\u01b8,\3\2\2\2\u01b9\u01ba\7k\2\2\u01ba"+
"\u01bb\7h\2\2\u01bb.\3\2\2\2\u01bc\u01bd\7i\2\2\u01bd\u01be\7q\2\2\u01be"+
"\u01bf\7v\2\2\u01bf\u01c0\7q\2\2\u01c0\60\3\2\2\2\u01c1\u01c2\7k\2\2\u01c2"+
"\u01c3\7o\2\2\u01c3\u01c4\7r\2\2\u01c4\u01c5\7n\2\2\u01c5\u01c6\7g\2\2"+
"\u01c6\u01c7\7o\2\2\u01c7\u01c8\7g\2\2\u01c8\u01c9\7p\2\2\u01c9\u01ca"+
"\7v\2\2\u01ca\u01cb\7u\2\2\u01cb\62\3\2\2\2\u01cc\u01cd\7k\2\2\u01cd\u01ce"+
"\7o\2\2\u01ce\u01cf\7r\2\2\u01cf\u01d0\7q\2\2\u01d0\u01d1\7t\2\2\u01d1"+
"\u01d2\7v\2\2\u01d2\64\3\2\2\2\u01d3\u01d4\7k\2\2\u01d4\u01d5\7p\2\2\u01d5"+
"\u01d6\7u\2\2\u01d6\u01d7\7v\2\2\u01d7\u01d8\7c\2\2\u01d8\u01d9\7p\2\2"+
"\u01d9\u01da\7e\2\2\u01da\u01db\7g\2\2\u01db\u01dc\7q\2\2\u01dc\u01dd"+
"\7h\2\2\u01dd\66\3\2\2\2\u01de\u01df\7k\2\2\u01df\u01e0\7p\2\2\u01e0\u01e1"+
"\7v\2\2\u01e18\3\2\2\2\u01e2\u01e3\7k\2\2\u01e3\u01e4\7p\2\2\u01e4\u01e5"+
"\7v\2\2\u01e5\u01e6\7g\2\2\u01e6\u01e7\7t\2\2\u01e7\u01e8\7h\2\2\u01e8"+
"\u01e9\7c\2\2\u01e9\u01ea\7e\2\2\u01ea\u01eb\7g\2\2\u01eb:\3\2\2\2\u01ec"+
"\u01ed\7n\2\2\u01ed\u01ee\7q\2\2\u01ee\u01ef\7p\2\2\u01ef\u01f0\7i\2\2"+
"\u01f0<\3\2\2\2\u01f1\u01f2\7p\2\2\u01f2\u01f3\7c\2\2\u01f3\u01f4\7v\2"+
"\2\u01f4\u01f5\7k\2\2\u01f5\u01f6\7x\2\2\u01f6\u01f7\7g\2\2\u01f7>\3\2"+
"\2\2\u01f8\u01f9\7p\2\2\u01f9\u01fa\7g\2\2\u01fa\u01fb\7y\2\2\u01fb@\3"+
"\2\2\2\u01fc\u01fd\7r\2\2\u01fd\u01fe\7c\2\2\u01fe\u01ff\7e\2\2\u01ff"+
"\u0200\7m\2\2\u0200\u0201\7c\2\2\u0201\u0202\7i\2\2\u0202\u0203\7g\2\2"+
"\u0203B\3\2\2\2\u0204\u0205\7r\2\2\u0205\u0206\7t\2\2\u0206\u0207\7k\2"+
"\2\u0207\u0208\7x\2\2\u0208\u0209\7c\2\2\u0209\u020a\7v\2\2\u020a\u020b"+
"\7g\2\2\u020bD\3\2\2\2\u020c\u020d\7r\2\2\u020d\u020e\7t\2\2\u020e\u020f"+
"\7q\2\2\u020f\u0210\7v\2\2\u0210\u0211\7g\2\2\u0211\u0212\7e\2\2\u0212"+
"\u0213\7v\2\2\u0213\u0214\7g\2\2\u0214\u0215\7f\2\2\u0215F\3\2\2\2\u0216"+
"\u0217\7r\2\2\u0217\u0218\7w\2\2\u0218\u0219\7d\2\2\u0219\u021a\7n\2\2"+
"\u021a\u021b\7k\2\2\u021b\u021c\7e\2\2\u021cH\3\2\2\2\u021d\u021e\7t\2"+
"\2\u021e\u021f\7g\2\2\u021f\u0220\7v\2\2\u0220\u0221\7w\2\2\u0221\u0222"+
"\7t\2\2\u0222\u0223\7p\2\2\u0223J\3\2\2\2\u0224\u0225\7u\2\2\u0225\u0226"+
"\7j\2\2\u0226\u0227\7q\2\2\u0227\u0228\7t\2\2\u0228\u0229\7v\2\2\u0229"+
"L\3\2\2\2\u022a\u022b\7u\2\2\u022b\u022c\7v\2\2\u022c\u022d\7c\2\2\u022d"+
"\u022e\7v\2\2\u022e\u022f\7k\2\2\u022f\u0230\7e\2\2\u0230N\3\2\2\2\u0231"+
"\u0232\7u\2\2\u0232\u0233\7v\2\2\u0233\u0234\7t\2\2\u0234\u0235\7k\2\2"+
"\u0235\u0236\7e\2\2\u0236\u0237\7v\2\2\u0237\u0238\7h\2\2\u0238\u0239"+
"\7r\2\2\u0239P\3\2\2\2\u023a\u023b\7u\2\2\u023b\u023c\7w\2\2\u023c\u023d"+
"\7r\2\2\u023d\u023e\7g\2\2\u023e\u023f\7t\2\2\u023fR\3\2\2\2\u0240\u0241"+
"\7u\2\2\u0241\u0242\7y\2\2\u0242\u0243\7k\2\2\u0243\u0244\7v\2\2\u0244"+
"\u0245\7e\2\2\u0245\u0246\7j\2\2\u0246T\3\2\2\2\u0247\u0248\7u\2\2\u0248"+
"\u0249\7{\2\2\u0249\u024a\7p\2\2\u024a\u024b\7e\2\2\u024b\u024c\7j\2\2"+
"\u024c\u024d\7t\2\2\u024d\u024e\7q\2\2\u024e\u024f\7p\2\2\u024f\u0250"+
"\7k\2\2\u0250\u0251\7|\2\2\u0251\u0252\7g\2\2\u0252\u0253\7f\2\2\u0253"+
"V\3\2\2\2\u0254\u0255\7v\2\2\u0255\u0256\7j\2\2\u0256\u0257\7k\2\2\u0257"+
"\u0258\7u\2\2\u0258X\3\2\2\2\u0259\u025a\7v\2\2\u025a\u025b\7j\2\2\u025b"+
"\u025c\7t\2\2\u025c\u025d\7q\2\2\u025d\u025e\7y\2\2\u025eZ\3\2\2\2\u025f"+
"\u0260\7v\2\2\u0260\u0261\7j\2\2\u0261\u0262\7t\2\2\u0262\u0263\7q\2\2"+
"\u0263\u0264\7y\2\2\u0264\u0265\7u\2\2\u0265\\\3\2\2\2\u0266\u0267\7v"+
"\2\2\u0267\u0268\7t\2\2\u0268\u0269\7c\2\2\u0269\u026a\7p\2\2\u026a\u026b"+
"\7u\2\2\u026b\u026c\7k\2\2\u026c\u026d\7g\2\2\u026d\u026e\7p\2\2\u026e"+
"\u026f\7v\2\2\u026f^\3\2\2\2\u0270\u0271\7v\2\2\u0271\u0272\7t\2\2\u0272"+
"\u0273\7{\2\2\u0273`\3\2\2\2\u0274\u0275\7x\2\2\u0275\u0276\7q\2\2\u0276"+
"\u0277\7k\2\2\u0277\u0278\7f\2\2\u0278b\3\2\2\2\u0279\u027a\7x\2\2\u027a"+
"\u027b\7q\2\2\u027b\u027c\7n\2\2\u027c\u027d\7c\2\2\u027d\u027e\7v\2\2"+
"\u027e\u027f\7k\2\2\u027f\u0280\7n\2\2\u0280\u0281\7g\2\2\u0281d\3\2\2"+
"\2\u0282\u0283\7y\2\2\u0283\u0284\7j\2\2\u0284\u0285\7k\2\2\u0285\u0286"+
"\7n\2\2\u0286\u0287\7g\2\2\u0287f\3\2\2\2\u0288\u028d\5i\65\2\u0289\u028d"+
"\5k\66\2\u028a\u028d\5m\67\2\u028b\u028d\5o8\2\u028c\u0288\3\2\2\2\u028c"+
"\u0289\3\2\2\2\u028c\u028a\3\2\2\2\u028c\u028b\3\2\2\2\u028dh\3\2\2\2"+
"\u028e\u0290\5s:\2\u028f\u0291\5q9\2\u0290\u028f\3\2\2\2\u0290\u0291\3"+
"\2\2\2\u0291j\3\2\2\2\u0292\u0294\5\u0081A\2\u0293\u0295\5q9\2\u0294\u0293"+
"\3\2\2\2\u0294\u0295\3\2\2\2\u0295l\3\2\2\2\u0296\u0298\5\u008bF\2\u0297"+
"\u0299\5q9\2\u0298\u0297\3\2\2\2\u0298\u0299\3\2\2\2\u0299n\3\2\2\2\u029a"+
"\u029c\5\u0095K\2\u029b\u029d\5q9\2\u029c\u029b\3\2\2\2\u029c\u029d\3"+
"\2\2\2\u029dp\3\2\2\2\u029e\u029f\t\2\2\2\u029fr\3\2\2\2\u02a0\u02ab\7"+
"\62\2\2\u02a1\u02a8\5y=\2\u02a2\u02a4\5u;\2\u02a3\u02a2\3\2\2\2\u02a3"+
"\u02a4\3\2\2\2\u02a4\u02a9\3\2\2\2\u02a5\u02a6\5\177@\2\u02a6\u02a7\5"+
"u;\2\u02a7\u02a9\3\2\2\2\u02a8\u02a3\3\2\2\2\u02a8\u02a5\3\2\2\2\u02a9"+
"\u02ab\3\2\2\2\u02aa\u02a0\3\2\2\2\u02aa\u02a1\3\2\2\2\u02abt\3\2\2\2"+
"\u02ac\u02b1\5w<\2\u02ad\u02af\5{>\2\u02ae\u02ad\3\2\2\2\u02ae\u02af\3"+
"\2\2\2\u02af\u02b0\3\2\2\2\u02b0\u02b2\5w<\2\u02b1\u02ae\3\2\2\2\u02b1"+
"\u02b2\3\2\2\2\u02b2v\3\2\2\2\u02b3\u02b6\7\62\2\2\u02b4\u02b6\5y=\2\u02b5"+
"\u02b3\3\2\2\2\u02b5\u02b4\3\2\2\2\u02b6x\3\2\2\2\u02b7\u02b8\t\3\2\2"+
"\u02b8z\3\2\2\2\u02b9\u02bb\5}?\2\u02ba\u02b9\3\2\2\2\u02bb\u02bc\3\2"+
"\2\2\u02bc\u02ba\3\2\2\2\u02bc\u02bd\3\2\2\2\u02bd|\3\2\2\2\u02be\u02c1"+
"\5w<\2\u02bf\u02c1\7a\2\2\u02c0\u02be\3\2\2\2\u02c0\u02bf\3\2\2\2\u02c1"+
"~\3\2\2\2\u02c2\u02c4\7a\2\2\u02c3\u02c2\3\2\2\2\u02c4\u02c5\3\2\2\2\u02c5"+
"\u02c3\3\2\2\2\u02c5\u02c6\3\2\2\2\u02c6\u0080\3\2\2\2\u02c7\u02c8\7\62"+
"\2\2\u02c8\u02c9\t\4\2\2\u02c9\u02ca\5\u0083B\2\u02ca\u0082\3\2\2\2\u02cb"+
"\u02d0\5\u0085C\2\u02cc\u02ce\5\u0087D\2\u02cd\u02cc\3\2\2\2\u02cd\u02ce"+
"\3\2\2\2\u02ce\u02cf\3\2\2\2\u02cf\u02d1\5\u0085C\2\u02d0\u02cd\3\2\2"+
"\2\u02d0\u02d1\3\2\2\2\u02d1\u0084\3\2\2\2\u02d2\u02d3\t\5\2\2\u02d3\u0086"+
"\3\2\2\2\u02d4\u02d6\5\u0089E\2\u02d5\u02d4\3\2\2\2\u02d6\u02d7\3\2\2"+
"\2\u02d7\u02d5\3\2\2\2\u02d7\u02d8\3\2\2\2\u02d8\u0088\3\2\2\2\u02d9\u02dc"+
"\5\u0085C\2\u02da\u02dc\7a\2\2\u02db\u02d9\3\2\2\2\u02db\u02da\3\2\2\2"+
"\u02dc\u008a\3\2\2\2\u02dd\u02df\7\62\2\2\u02de\u02e0\5\177@\2\u02df\u02de"+
"\3\2\2\2\u02df\u02e0\3\2\2\2\u02e0\u02e1\3\2\2\2\u02e1\u02e2\5\u008dG"+
"\2\u02e2\u008c\3\2\2\2\u02e3\u02e8\5\u008fH\2\u02e4\u02e6\5\u0091I\2\u02e5"+
"\u02e4\3\2\2\2\u02e5\u02e6\3\2\2\2\u02e6\u02e7\3\2\2\2\u02e7\u02e9\5\u008f"+
"H\2\u02e8\u02e5\3\2\2\2\u02e8\u02e9\3\2\2\2\u02e9\u008e\3\2\2\2\u02ea"+
"\u02eb\t\6\2\2\u02eb\u0090\3\2\2\2\u02ec\u02ee\5\u0093J\2\u02ed\u02ec"+
"\3\2\2\2\u02ee\u02ef\3\2\2\2\u02ef\u02ed\3\2\2\2\u02ef\u02f0\3\2\2\2\u02f0"+
"\u0092\3\2\2\2\u02f1\u02f4\5\u008fH\2\u02f2\u02f4\7a\2\2\u02f3\u02f1\3"+
"\2\2\2\u02f3\u02f2\3\2\2\2\u02f4\u0094\3\2\2\2\u02f5\u02f6\7\62\2\2\u02f6"+
"\u02f7\t\7\2\2\u02f7\u02f8\5\u0097L\2\u02f8\u0096\3\2\2\2\u02f9\u02fe"+
"\5\u0099M\2\u02fa\u02fc\5\u009bN\2\u02fb\u02fa\3\2\2\2\u02fb\u02fc\3\2"+
"\2\2\u02fc\u02fd\3\2\2\2\u02fd\u02ff\5\u0099M\2\u02fe\u02fb\3\2\2\2\u02fe"+
"\u02ff\3\2\2\2\u02ff\u0098\3\2\2\2\u0300\u0301\t\b\2\2\u0301\u009a\3\2"+
"\2\2\u0302\u0304\5\u009dO\2\u0303\u0302\3\2\2\2\u0304\u0305\3\2\2\2\u0305"+
"\u0303\3\2\2\2\u0305\u0306\3\2\2\2\u0306\u009c\3\2\2\2\u0307\u030a\5\u0099"+
"M\2\u0308\u030a\7a\2\2\u0309\u0307\3\2\2\2\u0309\u0308\3\2\2\2\u030a\u009e"+
"\3\2\2\2\u030b\u030e\5\u00a1Q\2\u030c\u030e\5\u00adW\2\u030d\u030b\3\2"+
"\2\2\u030d\u030c\3\2\2\2\u030e\u00a0\3\2\2\2\u030f\u0310\5u;\2\u0310\u0312"+
"\7\60\2\2\u0311\u0313\5u;\2\u0312\u0311\3\2\2\2\u0312\u0313\3\2\2\2\u0313"+
"\u0315\3\2\2\2\u0314\u0316\5\u00a3R\2\u0315\u0314\3\2\2\2\u0315\u0316"+
"\3\2\2\2\u0316\u0318\3\2\2\2\u0317\u0319\5\u00abV\2\u0318\u0317\3\2\2"+
"\2\u0318\u0319\3\2\2\2\u0319\u032b\3\2\2\2\u031a\u031b\7\60\2\2\u031b"+
"\u031d\5u;\2\u031c\u031e\5\u00a3R\2\u031d\u031c\3\2\2\2\u031d\u031e\3"+
"\2\2\2\u031e\u0320\3\2\2\2\u031f\u0321\5\u00abV\2\u0320\u031f\3\2\2\2"+
"\u0320\u0321\3\2\2\2\u0321\u032b\3\2\2\2\u0322\u0323\5u;\2\u0323\u0325"+
"\5\u00a3R\2\u0324\u0326\5\u00abV\2\u0325\u0324\3\2\2\2\u0325\u0326\3\2"+
"\2\2\u0326\u032b\3\2\2\2\u0327\u0328\5u;\2\u0328\u0329\5\u00abV\2\u0329"+
"\u032b\3\2\2\2\u032a\u030f\3\2\2\2\u032a\u031a\3\2\2\2\u032a\u0322\3\2"+
"\2\2\u032a\u0327\3\2\2\2\u032b\u00a2\3\2\2\2\u032c\u032d\5\u00a5S\2\u032d"+
"\u032e\5\u00a7T\2\u032e\u00a4\3\2\2\2\u032f\u0330\t\t\2\2\u0330\u00a6"+
"\3\2\2\2\u0331\u0333\5\u00a9U\2\u0332\u0331\3\2\2\2\u0332\u0333\3\2\2"+
"\2\u0333\u0334\3\2\2\2\u0334\u0335\5u;\2\u0335\u00a8\3\2\2\2\u0336\u0337"+
"\t\n\2\2\u0337\u00aa\3\2\2\2\u0338\u0339\t\13\2\2\u0339\u00ac\3\2\2\2"+
"\u033a\u033b\5\u00afX\2\u033b\u033d\5\u00b1Y\2\u033c\u033e\5\u00abV\2"+
"\u033d\u033c\3\2\2\2\u033d\u033e\3\2\2\2\u033e\u00ae\3\2\2\2\u033f\u0341"+
"\5\u0081A\2\u0340\u0342\7\60\2\2\u0341\u0340\3\2\2\2\u0341\u0342\3\2\2"+
"\2\u0342\u034b\3\2\2\2\u0343\u0344\7\62\2\2\u0344\u0346\t\4\2\2\u0345"+
"\u0347\5\u0083B\2\u0346\u0345\3\2\2\2\u0346\u0347\3\2\2\2\u0347\u0348"+
"\3\2\2\2\u0348\u0349\7\60\2\2\u0349\u034b\5\u0083B\2\u034a\u033f\3\2\2"+
"\2\u034a\u0343\3\2\2\2\u034b\u00b0\3\2\2\2\u034c\u034d\5\u00b3Z\2\u034d"+
"\u034e\5\u00a7T\2\u034e\u00b2\3\2\2\2\u034f\u0350\t\f\2\2\u0350\u00b4"+
"\3\2\2\2\u0351\u0352\7v\2\2\u0352\u0353\7t\2\2\u0353\u0354\7w\2\2\u0354"+
"\u035b\7g\2\2\u0355\u0356\7h\2\2\u0356\u0357\7c\2\2\u0357\u0358\7n\2\2"+
"\u0358\u0359\7u\2\2\u0359\u035b\7g\2\2\u035a\u0351\3\2\2\2\u035a\u0355"+
"\3\2\2\2\u035b\u00b6\3\2\2\2\u035c\u035d\7)\2\2\u035d\u035e\5\u00b9]\2"+
"\u035e\u035f\7)\2\2\u035f\u0365\3\2\2\2\u0360\u0361\7)\2\2\u0361\u0362"+
"\5\u00c1a\2\u0362\u0363\7)\2\2\u0363\u0365\3\2\2\2\u0364\u035c\3\2\2\2"+
"\u0364\u0360\3\2\2\2\u0365\u00b8\3\2\2\2\u0366\u0367\n\r\2\2\u0367\u00ba"+
"\3\2\2\2\u0368\u036a\7$\2\2\u0369\u036b\5\u00bd_\2\u036a\u0369\3\2\2\2"+
"\u036a\u036b\3\2\2\2\u036b\u036c\3\2\2\2\u036c\u036d\7$\2\2\u036d\u00bc"+
"\3\2\2\2\u036e\u0370\5\u00bf`\2\u036f\u036e\3\2\2\2\u0370\u0371\3\2\2"+
"\2\u0371\u036f\3\2\2\2\u0371\u0372\3\2\2\2\u0372\u00be\3\2\2\2\u0373\u0376"+
"\n\16\2\2\u0374\u0376\5\u00c1a\2\u0375\u0373\3\2\2\2\u0375\u0374\3\2\2"+
"\2\u0376\u00c0\3\2\2\2\u0377\u0378\7^\2\2\u0378\u037c\t\17\2\2\u0379\u037c"+
"\5\u00c3b\2\u037a\u037c\5\u00c7d\2\u037b\u0377\3\2\2\2\u037b\u0379\3\2"+
"\2\2\u037b\u037a\3\2\2\2\u037c\u00c2\3\2\2\2\u037d\u037e\7^\2\2\u037e"+
"\u0389\5\u008fH\2\u037f\u0380\7^\2\2\u0380\u0381\5\u008fH\2\u0381\u0382"+
"\5\u008fH\2\u0382\u0389\3\2\2\2\u0383\u0384\7^\2\2\u0384\u0385\5\u00c5"+
"c\2\u0385\u0386\5\u008fH\2\u0386\u0387\5\u008fH\2\u0387\u0389\3\2\2\2"+
"\u0388\u037d\3\2\2\2\u0388\u037f\3\2\2\2\u0388\u0383\3\2\2\2\u0389\u00c4"+
"\3\2\2\2\u038a\u038b\t\20\2\2\u038b\u00c6\3\2\2\2\u038c\u038d\7^\2\2\u038d"+
"\u038e\7w\2\2\u038e\u038f\5\u0085C\2\u038f\u0390\5\u0085C\2\u0390\u0391"+
"\5\u0085C\2\u0391\u0392\5\u0085C\2\u0392\u00c8\3\2\2\2\u0393\u0394\7p"+
"\2\2\u0394\u0395\7w\2\2\u0395\u0396\7n\2\2\u0396\u0397\7n\2\2\u0397\u00ca"+
"\3\2\2\2\u0398\u0399\7*\2\2\u0399\u00cc\3\2\2\2\u039a\u039b\7+\2\2\u039b"+
"\u00ce\3\2\2\2\u039c\u039d\7}\2\2\u039d\u00d0\3\2\2\2\u039e\u039f\7\177"+
"\2\2\u039f\u00d2\3\2\2\2\u03a0\u03a1\7]\2\2\u03a1\u00d4\3\2\2\2\u03a2"+
"\u03a3\7_\2\2\u03a3\u00d6\3\2\2\2\u03a4\u03a5\7=\2\2\u03a5\u00d8\3\2\2"+
"\2\u03a6\u03a7\7.\2\2\u03a7\u00da\3\2\2\2\u03a8\u03a9\7\60\2\2\u03a9\u00dc"+
"\3\2\2\2\u03aa\u03ab\7?\2\2\u03ab\u00de\3\2\2\2\u03ac\u03ad\7@\2\2\u03ad"+
"\u00e0\3\2\2\2\u03ae\u03af\7>\2\2\u03af\u00e2\3\2\2\2\u03b0\u03b1\7#\2"+
"\2\u03b1\u00e4\3\2\2\2\u03b2\u03b3\7\u0080\2\2\u03b3\u00e6\3\2\2\2\u03b4"+
"\u03b5\7A\2\2\u03b5\u00e8\3\2\2\2\u03b6\u03b7\7<\2\2\u03b7\u00ea\3\2\2"+
"\2\u03b8\u03b9\7?\2\2\u03b9\u03ba\7?\2\2\u03ba\u00ec\3\2\2\2\u03bb\u03bc"+
"\7>\2\2\u03bc\u03bd\7?\2\2\u03bd\u00ee\3\2\2\2\u03be\u03bf\7@\2\2\u03bf"+
"\u03c0\7?\2\2\u03c0\u00f0\3\2\2\2\u03c1\u03c2\7#\2\2\u03c2\u03c3\7?\2"+
"\2\u03c3\u00f2\3\2\2\2\u03c4\u03c5\7(\2\2\u03c5\u03c6\7(\2\2\u03c6\u00f4"+
"\3\2\2\2\u03c7\u03c8\7~\2\2\u03c8\u03c9\7~\2\2\u03c9\u00f6\3\2\2\2\u03ca"+
"\u03cb\7-\2\2\u03cb\u03cc\7-\2\2\u03cc\u00f8\3\2\2\2\u03cd\u03ce\7/\2"+
"\2\u03ce\u03cf\7/\2\2\u03cf\u00fa\3\2\2\2\u03d0\u03d1\7-\2\2\u03d1\u00fc"+
"\3\2\2\2\u03d2\u03d3\7/\2\2\u03d3\u00fe\3\2\2\2\u03d4\u03d5\7,\2\2\u03d5"+
"\u0100\3\2\2\2\u03d6\u03d7\7\61\2\2\u03d7\u0102\3\2\2\2\u03d8\u03d9\7"+
"(\2\2\u03d9\u0104\3\2\2\2\u03da\u03db\7~\2\2\u03db\u0106\3\2\2\2\u03dc"+
"\u03dd\7`\2\2\u03dd\u0108\3\2\2\2\u03de\u03df\7\'\2\2\u03df\u010a\3\2"+
"\2\2\u03e0\u03e1\7/\2\2\u03e1\u03e2\7@\2\2\u03e2\u010c\3\2\2\2\u03e3\u03e4"+
"\7<\2\2\u03e4\u03e5\7<\2\2\u03e5\u010e\3\2\2\2\u03e6\u03e7\7-\2\2\u03e7"+
"\u03e8\7?\2\2\u03e8\u0110\3\2\2\2\u03e9\u03ea\7/\2\2\u03ea\u03eb\7?\2"+
"\2\u03eb\u0112\3\2\2\2\u03ec\u03ed\7,\2\2\u03ed\u03ee\7?\2\2\u03ee\u0114"+
"\3\2\2\2\u03ef\u03f0\7\61\2\2\u03f0\u03f1\7?\2\2\u03f1\u0116\3\2\2\2\u03f2"+
"\u03f3\7(\2\2\u03f3\u03f4\7?\2\2\u03f4\u0118\3\2\2\2\u03f5\u03f6\7~\2"+
"\2\u03f6\u03f7\7?\2\2\u03f7\u011a\3\2\2\2\u03f8\u03f9\7`\2\2\u03f9\u03fa"+
"\7?\2\2\u03fa\u011c\3\2\2\2\u03fb\u03fc\7\'\2\2\u03fc\u03fd\7?\2\2\u03fd"+
"\u011e\3\2\2\2\u03fe\u03ff\7>\2\2\u03ff\u0400\7>\2\2\u0400\u0401\7?\2"+
"\2\u0401\u0120\3\2\2\2\u0402\u0403\7@\2\2\u0403\u0404\7@\2\2\u0404\u0405"+
"\7?\2\2\u0405\u0122\3\2\2\2\u0406\u0407\7@\2\2\u0407\u0408\7@\2\2\u0408"+
"\u0409\7@\2\2\u0409\u040a\7?\2\2\u040a\u0124\3\2\2\2\u040b\u040f\5\u0127"+
"\u0094\2\u040c\u040e\5\u0129\u0095\2\u040d\u040c\3\2\2\2\u040e\u0411\3"+
"\2\2\2\u040f\u040d\3\2\2\2\u040f\u0410\3\2\2\2\u0410\u0126\3\2\2\2\u0411"+
"\u040f\3\2\2\2\u0412\u0419\t\21\2\2\u0413\u0414\n\22\2\2\u0414\u0419\6"+
"\u0094\2\2\u0415\u0416\t\23\2\2\u0416\u0417\t\24\2\2\u0417\u0419\6\u0094"+
"\3\2\u0418\u0412\3\2\2\2\u0418\u0413\3\2\2\2\u0418\u0415\3\2\2\2\u0419"+
"\u0128\3\2\2\2\u041a\u0421\t\25\2\2\u041b\u041c\n\22\2\2\u041c\u0421\6"+
"\u0095\4\2\u041d\u041e\t\23\2\2\u041e\u041f\t\24\2\2\u041f\u0421\6\u0095"+
"\5\2\u0420\u041a\3\2\2\2\u0420\u041b\3\2\2\2\u0420\u041d\3\2\2\2\u0421"+
"\u012a\3\2\2\2\u0422\u0423\7B\2\2\u0423\u012c\3\2\2\2\u0424\u0425\7\60"+
"\2\2\u0425\u0426\7\60\2\2\u0426\u0427\7\60\2\2\u0427\u012e\3\2\2\2\u0428"+
"\u042a\t\26\2\2\u0429\u0428\3\2\2\2\u042a\u042b\3\2\2\2\u042b\u0429\3"+
"\2\2\2\u042b\u042c\3\2\2\2\u042c\u042d\3\2\2\2\u042d\u042e\b\u0098\2\2"+
"\u042e\u0130\3\2\2\2\u042f\u0430\7\61\2\2\u0430\u0431\7,\2\2\u0431\u0435"+
"\3\2\2\2\u0432\u0434\13\2\2\2\u0433\u0432\3\2\2\2\u0434\u0437\3\2\2\2"+
"\u0435\u0436\3\2\2\2\u0435\u0433\3\2\2\2\u0436\u0438\3\2\2\2\u0437\u0435"+
"\3\2\2\2\u0438\u0439\7,\2\2\u0439\u043a\7\61\2\2\u043a\u043b\3\2\2\2\u043b"+
"\u043c\b\u0099\2\2\u043c\u0132\3\2\2\2\u043d\u043e\7\61\2\2\u043e\u043f"+
"\7\61\2\2\u043f\u0443\3\2\2\2\u0440\u0442\n\27\2\2\u0441\u0440\3\2\2\2"+
"\u0442\u0445\3\2\2\2\u0443\u0441\3\2\2\2\u0443\u0444\3\2\2\2\u0444\u0446"+
"\3\2\2\2\u0445\u0443\3\2\2\2\u0446\u0447\b\u009a\2\2\u0447\u0134\3\2\2"+
"\28\2\u028c\u0290\u0294\u0298\u029c\u02a3\u02a8\u02aa\u02ae\u02b1\u02b5"+
"\u02bc\u02c0\u02c5\u02cd\u02d0\u02d7\u02db\u02df\u02e5\u02e8\u02ef\u02f3"+
"\u02fb\u02fe\u0305\u0309\u030d\u0312\u0315\u0318\u031d\u0320\u0325\u032a"+
"\u0332\u033d\u0341\u0346\u034a\u035a\u0364\u036a\u0371\u0375\u037b\u0388"+
"\u040f\u0418\u0420\u042b\u0435\u0443\3\b\2\2";
public static final ATN _ATN =
new ATNDeserializer().deserialize(_serializedATN.toCharArray());
static {
_decisionToDFA = new DFA[_ATN.getNumberOfDecisions()];
for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) {
_decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i);
}
}
}

View File

@ -0,0 +1,205 @@
ABSTRACT=1
ASSERT=2
BOOLEAN=3
BREAK=4
BYTE=5
CASE=6
CATCH=7
CHAR=8
CLASS=9
CONST=10
CONTINUE=11
DEFAULT=12
DO=13
DOUBLE=14
ELSE=15
ENUM=16
EXTENDS=17
FINAL=18
FINALLY=19
FLOAT=20
FOR=21
IF=22
GOTO=23
IMPLEMENTS=24
IMPORT=25
INSTANCEOF=26
INT=27
INTERFACE=28
LONG=29
NATIVE=30
NEW=31
PACKAGE=32
PRIVATE=33
PROTECTED=34
PUBLIC=35
RETURN=36
SHORT=37
STATIC=38
STRICTFP=39
SUPER=40
SWITCH=41
SYNCHRONIZED=42
THIS=43
THROW=44
THROWS=45
TRANSIENT=46
TRY=47
VOID=48
VOLATILE=49
WHILE=50
IntegerLiteral=51
FloatingPointLiteral=52
BooleanLiteral=53
CharacterLiteral=54
StringLiteral=55
NullLiteral=56
LPAREN=57
RPAREN=58
LBRACE=59
RBRACE=60
LBRACK=61
RBRACK=62
SEMI=63
COMMA=64
DOT=65
ASSIGN=66
GT=67
LT=68
BANG=69
TILDE=70
QUESTION=71
COLON=72
EQUAL=73
LE=74
GE=75
NOTEQUAL=76
AND=77
OR=78
INC=79
DEC=80
ADD=81
SUB=82
MUL=83
DIV=84
BITAND=85
BITOR=86
CARET=87
MOD=88
ARROW=89
COLONCOLON=90
ADD_ASSIGN=91
SUB_ASSIGN=92
MUL_ASSIGN=93
DIV_ASSIGN=94
AND_ASSIGN=95
OR_ASSIGN=96
XOR_ASSIGN=97
MOD_ASSIGN=98
LSHIFT_ASSIGN=99
RSHIFT_ASSIGN=100
URSHIFT_ASSIGN=101
Identifier=102
AT=103
ELLIPSIS=104
WS=105
COMMENT=106
LINE_COMMENT=107
'abstract'=1
'assert'=2
'boolean'=3
'break'=4
'byte'=5
'case'=6
'catch'=7
'char'=8
'class'=9
'const'=10
'continue'=11
'default'=12
'do'=13
'double'=14
'else'=15
'enum'=16
'extends'=17
'final'=18
'finally'=19
'float'=20
'for'=21
'if'=22
'goto'=23
'implements'=24
'import'=25
'instanceof'=26
'int'=27
'interface'=28
'long'=29
'native'=30
'new'=31
'package'=32
'private'=33
'protected'=34
'public'=35
'return'=36
'short'=37
'static'=38
'strictfp'=39
'super'=40
'switch'=41
'synchronized'=42
'this'=43
'throw'=44
'throws'=45
'transient'=46
'try'=47
'void'=48
'volatile'=49
'while'=50
'null'=56
'('=57
')'=58
'{'=59
'}'=60
'['=61
']'=62
';'=63
','=64
'.'=65
'='=66
'>'=67
'<'=68
'!'=69
'~'=70
'?'=71
':'=72
'=='=73
'<='=74
'>='=75
'!='=76
'&&'=77
'||'=78
'++'=79
'--'=80
'+'=81
'-'=82
'*'=83
'/'=84
'&'=85
'|'=86
'^'=87
'%'=88
'->'=89
'::'=90
'+='=91
'-='=92
'*='=93
'/='=94
'&='=95
'|='=96
'^='=97
'%='=98
'<<='=99
'>>='=100
'>>>='=101
'@'=103
'...'=104

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,174 +0,0 @@
/********************************************
* file: JavaLexer.lex *
* *
* enth<74>lt die JLex-Spezifikation f<>r die *
* Generierung des lexical analyzers *
* *
********************************************/
// user code:
package de.dhbwstuttgart.parser;
import de.dhbwstuttgart.logger.Section;
%%
%char
%line
%{
Token token;
%}
%public
%class JavaLexer
%type boolean
%eofval{
return false;
%eofval}
ws = [ \t\r\n\b\015]+
%state commentblock
%state commentsingleline
%%
abstract {this.token = new Token(JavaParser.ABSTRACT, yytext(), yyline, yychar);return true;}
boolean {this.token = new Token(JavaParser.BOOLEAN, yytext(), yyline, yychar);return true;}
break {this.token = new Token(JavaParser.BREAK, yytext(), yyline, yychar);return true;}
case {this.token = new Token(JavaParser.CASE, yytext(), yyline, yychar);return true;}
catch {this.token = new Token(JavaParser.CATCH, yytext(), yyline, yychar);return true;}
char {this.token = new Token(JavaParser.CHAR, yytext(), yyline, yychar);return true;}
class {this.token = new Token(JavaParser.CLASS, yytext(), yyline, yychar);return true;}
continue {this.token = new Token(JavaParser.CONTINUE, yytext(), yyline, yychar);return true;}
default {this.token = new Token(JavaParser.DEFAULT, yytext(), yyline, yychar);return true;}
do {this.token = new Token(JavaParser.DO, yytext(), yyline, yychar);return true;}
else {this.token = new Token(JavaParser.ELSE, yytext(), yyline, yychar);return true;}
extends {this.token = new Token(JavaParser.EXTENDS, yytext(), yyline, yychar);return true;}
final {this.token = new Token(JavaParser.FINAL, yytext(), yyline, yychar);return true;}
finally {this.token = new Token(JavaParser.FINALLY, yytext(), yyline, yychar);return true;}
for {this.token = new Token(JavaParser.FOR, yytext(), yyline, yychar);return true;}
if {this.token = new Token(JavaParser.IF, yytext(), yyline, yychar);return true;}
instanceof {this.token = new Token(JavaParser.INSTANCEOF, yytext(), yyline, yychar);return true;}
interface {this.token = new Token(JavaParser.INTERFACE, yytext(), yyline, yychar);return true;}
int {this.token = new Token(JavaParser.INT, yytext(), yyline, yychar);return true;}
implements {this.token = new Token(JavaParser.IMPLEMENTS, yytext(), yyline, yychar);return true;}
new {this.token = new Token(JavaParser.NEW, yytext(), yyline, yychar);return true;}
package {this.token = new Token(JavaParser.PACKAGE, yytext(), yyline, yychar);return true;}
import {this.token = new Token(JavaParser.IMPORT, yytext(), yyline, yychar);return true;}
private {this.token = new Token(JavaParser.PRIVATE, yytext(), yyline, yychar);return true;}
protected {this.token = new Token(JavaParser.PROTECTED, yytext(), yyline, yychar);return true;}
public {this.token = new Token(JavaParser.PUBLIC, yytext(), yyline, yychar);return true;}
return {this.token = new Token(JavaParser.RETURN, yytext(), yyline, yychar);return true;}
static {this.token = new Token(JavaParser.STATIC, yytext(), yyline, yychar);return true;}
super {this.token = new Token(JavaParser.SUPER, yytext(), yyline, yychar);return true;}
switch {this.token = new Token(JavaParser.SWITCH, yytext(), yyline, yychar);return true;}
this {this.token = new Token(JavaParser.THIS, yytext(), yyline,yychar);return true;}
throw {this.token = new Token(JavaParser.THROW, yytext(), yyline, yychar);return true;}
throws {this.token = new Token(JavaParser.THROWS, yytext(), yyline, yychar);return true;}
try {this.token = new Token(JavaParser.TRY, yytext(), yyline, yychar);return true;}
void {this.token = new Token(JavaParser.VOID, yytext(), yyline, yychar);return true;}
while {this.token = new Token(JavaParser.WHILE, yytext(), yyline, yychar);return true;}
"//" {yybegin(commentsingleline);}
"/*" {yybegin(commentblock);}
<commentblock> "*/" {yybegin(YYINITIAL);}
<commentblock> [^\*]* {}
<commentblock> "*" {}
<commentsingleline> [\t\r\n\b\015]+ {yybegin(YYINITIAL);}
<commentsingleline> [^\\t\r\n\b\015]+ {}
[1-9][0-9]*[L]? {
String lexem = yytext();
if(lexem.endsWith("L"))
{
lexem = lexem.substring(0, lexem.length() - 1);
this.token = new Token(JavaParser.LONGLITERAL, lexem, yyline, yychar);return true;
}
else
{
this.token = new Token(JavaParser.INTLITERAL, lexem, yyline, yychar);return true;
}
}
0[xX][0-9a-fA-F]+[L]? {
String lexem = yytext();
if(lexem.endsWith("L"))
{
lexem = lexem.substring(0, lexem.length() - 1);
this.token = new Token(JavaParser.LONGLITERAL, lexem, yyline, yychar);return true;
}
else
{
this.token = new Token(JavaParser.INTLITERAL, lexem, yyline, yychar);return true;
}
}
0[0-7]*[L]? {
String lexem = yytext();
if(lexem.endsWith("L"))
{
lexem = lexem.substring(0, lexem.length() - 1);
this.token = new Token(JavaParser.LONGLITERAL, lexem, yyline, yychar);return true;
}
else
{
this.token = new Token(JavaParser.INTLITERAL, lexem, yyline, yychar);return true;
}
}
[1-9][0-9]*[.]?[0-9]*[f] {
this.token = new Token(JavaParser.FLOATLITERAL, yytext(), yyline, yychar);return true;
}
[1-9][0-9]*[.][0-9]* {
this.token = new Token(JavaParser.DOUBLELITERAL, yytext(), yyline, yychar);return true;
}
true|false {
this.token = new Token(JavaParser.BOOLLITERAL, yytext(), yyline, yychar);return true;
}
null {
this.token = new Token(JavaParser.JNULL, yytext(), yyline, yychar);return true;
}
\'[a-zA-Z0-9!@#$%\&*\(\),\<.\>/\?;:]\' {
this.token = new Token(JavaParser.CHARLITERAL, yytext(), yyline, yychar);return true;
}
\"[a-zA-Z0-9!@#$%^&*\(\),\<.\>/\?;:\ ]*\" {
this.token = new Token(JavaParser.STRINGLITERAL, yytext(), yyline, yychar);return true;
}
[a-zA-Z$_][a-zA-Z0-9$_]* {
this.token = new Token(JavaParser.IDENTIFIER, yytext(), yyline, yychar);return true;
}
[()\{\}\[\];,.] {
this.token = new Token(JavaParser.BRACE,yytext().charAt(0), yyline, yychar);return true;
}
[=><!~?:] {
this.token = new Token(JavaParser.RELOP,yytext().charAt(0), yyline, yychar);return true;
}
"==" { this.token = new Token(JavaParser.EQUAL, yytext(), yyline, yychar);return true;}
"<=" { this.token = new Token(JavaParser.LESSEQUAL, yytext(), yyline, yychar);return true;}
">=" {this.token = new Token(JavaParser.GREATEREQUAL, yytext(), yyline, yychar);return true;}
"!=" {this.token = new Token(JavaParser.NOTEQUAL, yytext(), yyline, yychar);return true;}
"||" {this.token = new Token(JavaParser.LOGICALOR, yytext(), yyline, yychar);return true;}
"&&" {this.token = new Token(JavaParser.LOGICALAND, yytext(), yyline, yychar);return true;}
"++" {this.token = new Token(JavaParser.INCREMENT, yytext(), yyline, yychar);return true;}
"--" {this.token = new Token(JavaParser.DECREMENT, yytext(), yyline, yychar);return true;}
[+\-*/&|^%] {
this.token = new Token(JavaParser.OP, yytext().charAt(0), yyline, yychar);return true;
}
//"<<" {this.token = new Token(JavaParser.SHIFTLEFT, yytext(), yyline, yychar);return true;}
//">>" {this.token = new Token(JavaParser.SHIFTRIGHT, yytext(), yyline, yychar);return true;}
//">>>" {this.token = new Token(JavaParser.UNSIGNEDSHIFTRIGHT, yytext(), yyline, yychar);return true;}
"+=" {this.token = new Token(JavaParser.PLUSEQUAL, yytext(), yyline, yychar);return true;}
"-=" {this.token = new Token(JavaParser.MINUSEQUAL, yytext(), yyline, yychar);return true;}
"*=" {this.token = new Token(JavaParser.TIMESEQUAL, yytext(), yyline, yychar);return true;}
"/=" {this.token = new Token(JavaParser.DIVIDEEQUAL, yytext(), yyline, yychar);return true;}
"&=" {this.token = new Token(JavaParser.ANDEQUAL, yytext(), yyline, yychar);return true;}
"|=" {this.token = new Token(JavaParser.OREQUAL, yytext(), yyline, yychar);return true;}
"^=" {this.token = new Token(JavaParser.XOREQUAL, yytext(), yyline, yychar);return true;}
"%=" {this.token = new Token(JavaParser.MODULOEQUAL, yytext(), yyline, yychar);return true;}
//"<<=" {this.token = new Token(JavaParser.SHIFTLEFTEQUAL, yytext(), yyline, yychar);return true;}
//">>=" {this.token = new Token(JavaParser.SIGNEDSHIFTRIGHTEQUAL, yytext(), yyline, yychar);return true;}
//">>>=" {this.token = new Token(JavaParser.UNSIGNEDSHIFTRIGHTEQUAL, yytext(), yyline, yychar);return true;}
{ws}|\n { /* System.out.print(yytext()); */ }
\\.\n {de.dhbwstuttgart.logger.Logger.getLogger("parser").debug("Kommentar: "+yytext(), Section.PARSER);}
"->" {this.token = new Token(JavaParser.LAMBDAASSIGNMENT, yytext(), yyline, yychar);return true;}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,33 @@
package de.dhbwstuttgart.parser;
import org.antlr.v4.runtime.*;
import org.antlr.v4.runtime.ANTLRInputStream;
import org.antlr.v4.runtime.CommonTokenStream;
import org.antlr.v4.runtime.ParserRuleContext;
import org.antlr.v4.runtime.tree.ParseTreeWalker;
import de.dhbwstuttgart.syntaxtree.*;
import java.util.Scanner;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
public class RunParser{
public static void main(String[] args){
try{
Scanner sc = new Scanner(System.in);
String inputString = sc.nextLine();
while(sc.hasNextLine()) inputString = inputString + sc.nextLine();
InputStream stream = new ByteArrayInputStream(inputString.getBytes(StandardCharsets.UTF_8));
ANTLRInputStream input = new ANTLRInputStream(stream);
Java8Lexer lexer = new Java8Lexer(input);
CommonTokenStream tokens = new CommonTokenStream(lexer);
Java8Parser parser = new Java8Parser(tokens);
ParserRuleContext tree = parser.compilationUnit();
SyntaxTreeGenerator generator = new SyntaxTreeGenerator(null);
generator.convert((Java8Parser.CompilationUnitContext) tree);
}
catch(Exception e){
System.out.println("An exception occured which is unknown and on our TODO list.");
e.printStackTrace();
}
}
}

View File

@ -1,54 +0,0 @@
// ino.module.Scanner.8618.package
package de.dhbwstuttgart.parser;
// ino.end
// ino.class.Scanner.24842.declaration
public class Scanner extends JavaLexer implements JavaParser.yyInput
// ino.end
// ino.class.Scanner.24842.body
{
// ino.method.Scanner.24847.definition
public Scanner (java.io.Reader reader)
// ino.end
// ino.method.Scanner.24847.body
{
super (reader);
}
// ino.end
// ino.method.token.24850.definition
public int token ()
// ino.end
// ino.method.token.24850.body
{
if (token.token instanceof String)
{
return (int)(((String)token.token).charAt(0));
}
else
{
return ((Integer)token.token).intValue();
}
}
// ino.end
// ino.method.advance.24853.definition
public boolean advance ()
throws java.io.IOException
// ino.end
// ino.method.advance.24853.body
{
boolean ret = yylex();
return ret;
}
// ino.end
// ino.method.value.24856.definition
public Object value ()
// ino.end
// ino.method.value.24856.body
{
return this.token;
}
// ino.end
}
// ino.end

View File

@ -0,0 +1,29 @@
package de.dhbwstuttgart.parser;
import de.dhbwstuttgart.syntaxtree.SourceFile;
import de.dhbwstuttgart.syntaxtree.Class;
import de.dhbwstuttgart.typecheck.JavaClassRegistry;
import java.util.ArrayList;
import java.util.List;
public class SyntaxTreeGenerator {
public SyntaxTreeGenerator(JavaClassRegistry nameReg){
//TODO: Implement
}
public SourceFile convert(Java8Parser.CompilationUnitContext ctx){
List<Class> classes = new ArrayList<>();
for(Java8Parser.TypeDeclarationContext typeDecl : ctx.typeDeclaration()){
Class newClass = convert(typeDecl.classDeclaration());
classes.add(newClass);
}
return new SourceFile(classes);
}
private Class convert(Java8Parser.ClassDeclarationContext ctx) {
//TODO: Implement
return null;
}
}

View File

@ -0,0 +1,4 @@
= Grammatik =
* Core-Problem: Typinferenz vs. Konstruktoren
* möglicherweise Problem: falsche Return-Expressions

View File

@ -1,177 +0,0 @@
// ino.module.Token.8619.package
package de.dhbwstuttgart.parser;
// ino.end
// ino.class.Token.24859.declaration
public class Token
// ino.end
// ino.class.Token.24859.body
{
// ino.attribute.token.24862.declaration
public Object token;
// ino.end
// ino.attribute.lexem.24865.declaration
private String lexem;
// ino.end
// ino.attribute.m_LineNumber.24868.declaration
private int m_LineNumber;
// ino.end
// ino.attribute.m_Offset.24871.declaration
private int m_Offset;//hinzugefügt hoth: 14.04.2006
// ino.end
// ino.method.Token.24874.definition
Token (int tok, int lineNumber)
// ino.end
// ino.method.Token.24874.body
{
this.token = new Integer(tok);
m_LineNumber = lineNumber;
}
// ino.end
// ino.method.Token.24877.definition
Token (int tok, String s, int lineNumber)
// ino.end
// ino.method.Token.24877.body
{
lexem = s;
this.token = new Integer(tok);
m_LineNumber = lineNumber;
}
// ino.end
// ino.method.Token.24880.definition
Token (int tok, char c, int lineNumber)
// ino.end
// ino.method.Token.24880.body
{
char[] ch = new char[1];
ch[0] = c;
this.token = new String(ch);
m_LineNumber = lineNumber;
}
// ino.end
// ino.method.Token.24883.defdescription type=line
// hinzugefügt hoth: 14.04.2006
// ino.end
// ino.method.Token.24883.definition
Token (int tok, String s, int lineNumber, int charOffset)
// ino.end
// ino.method.Token.24883.body
{
lexem = s;
this.token = new Integer(tok);
m_LineNumber = lineNumber;
m_Offset = charOffset;
}
// ino.end
// ino.method.Token.24886.defdescription type=line
// hinzugefügt hoth: 14.04.2006
// ino.end
// ino.method.Token.24886.definition
Token (int tok, char c, int lineNumber, int charOffset)
// ino.end
// ino.method.Token.24886.body
{
char[] ch = new char[1];
ch[0] = c;
this.token = new String(ch);
m_LineNumber = lineNumber;
m_Offset = charOffset;
}
// ino.end
// ino.method.getLineNumber.24889.definition
public int getLineNumber()
// ino.end
// ino.method.getLineNumber.24889.body
{
return m_LineNumber;
}
// ino.end
// ino.method.getOffset.24892.definition
public int getOffset()
// ino.end
// ino.method.getOffset.24892.body
{
return m_Offset;
}
// ino.end
// ino.method.getLexem.24895.definition
public String getLexem ()
// ino.end
// ino.method.getLexem.24895.body
{
return lexem;
}
// ino.end
// ino.method.String2Int.24898.definition
public int String2Int()
// ino.end
// ino.method.String2Int.24898.body
{
return Integer.decode(lexem);
}
// ino.end
public long String2Long()
{
return Long.decode(lexem);
}
public float String2Float()
{
return Float.parseFloat(lexem);
}
public double String2Double()
{
return Double.parseDouble(lexem);
}
// ino.method.CharInString.24901.definition
public char CharInString()
// ino.end
// ino.method.CharInString.24901.body
{
char[] tmp = lexem.toCharArray();
return tmp[1];
}
// ino.end
// ino.method.String2Bool.24904.definition
public boolean String2Bool()
// ino.end
// ino.method.String2Bool.24904.body
{
if(lexem.equals("true"))
{
return(true);
}
else
{
return(false);
}
}
// ino.end
// ino.method.get_String.24907.definition
public String get_String()
// ino.end
// ino.method.get_String.24907.body
{
int laenge = lexem.length();
String rueck;
rueck = lexem.substring(1,laenge-1);
return rueck;
}
// ino.end
}
// ino.end

View File

@ -0,0 +1,12 @@
* Listener-Pattern für das Projekt eher ungeeignet.
= Herangehensweise/Format =
* CompilatunUnit (Rot) wird zu Source-File (Root)
* Im Paket Syntaxtree finden sich die Klassen, die ich letztendlich erzeugen muss.
* Kann hier auch Veränderungen vornehmen (Pull Request)
* Wichtig! Typnamen müssen aufgelöst werden können (also z.B. java.lang.util.ArrayList (JavaClassRegistry).
= Idee bei mehreren Files =
* Zunächst alle Files anschauen und Pakate/Klassen für die spätere Verwendung "registrieren".
* Danach erst das komplette Package/alle Klassen imselben Verzeichnis parsen.

View File

@ -1,33 +0,0 @@
// ino.module.BasicAssumptionClass.8552.package
package de.dhbwstuttgart.syntaxtree;
// ino.end
// ino.module.BasicAssumptionClass.8552.import
import de.dhbwstuttgart.syntaxtree.modifier.Modifiers;
// ino.class.BasicAssumptionClass.23000.declaration
public class BasicAssumptionClass extends Class
// ino.end
// ino.class.BasicAssumptionClass.23000.body
{
// ino.method.BasicAssumptionClass.23004.definition
public BasicAssumptionClass(String name)
// ino.end
// ino.method.BasicAssumptionClass.23004.body
{
super(name, 0);
}
// ino.end
// ino.method.BasicAssumptionClass.23007.definition
public BasicAssumptionClass(String name, Modifiers mod)
// ino.end
// ino.method.BasicAssumptionClass.23007.body
{
super(name,mod, 0);
}
// ino.end
}
// ino.end

File diff suppressed because it is too large Load Diff

View File

@ -1,290 +0,0 @@
// ino.module.ClassBody.8554.package
package de.dhbwstuttgart.syntaxtree;
// ino.end
// ino.module.ClassBody.8554.import
import java.util.Enumeration;
import java.util.Hashtable;
import de.dhbwstuttgart.typeinference.Menge;
import de.dhbwstuttgart.logger.Logger;
// ino.end
import de.dhbwstuttgart.syntaxtree.type.RefType;
import de.dhbwstuttgart.syntaxtree.type.Type;
import de.dhbwstuttgart.typeinference.JavaCodeResult;
import de.dhbwstuttgart.typeinference.ResultSet;
// ino.class.ClassBody.23143.declaration
public class ClassBody
{
// ino.attribute.fielddecl.23146.declaration
private Menge<Field>fielddecl = new Menge<Field>();
// ino.end
// ino.attribute.kill.23155.declaration
public Hashtable<Type,Type> kill = new Hashtable<Type,Type>();
// ino.end
// ino.attribute.parserlog.23158.declaration
protected static Logger parserlog = Logger.getLogger("parser");
// ino.end
// ino.method.complete_parahashtable.23173.defdescription type=block
/* public void set_paratype(Menge classlist, UsedId superclass, Menge
pl,Hashtable ph,boolean ext){ DeclId decl;
FieldDecl field;
System.out.println("++ ParaCheck: Fielddecl's: "+fielddecl.toString());
for(Enumeration e=fielddecl.elements();e.hasMoreElements();){
field = (FieldDecl)e.nextElement();
for(Enumeration e1=field.get_Name().elements();e1.hasMoreElements();){
decl=(DeclId)e1.nextElement();
if(superclass != null){
System.out.println("superclass.get_ParaList: "
+superclass.get_ParaList().toString());
for(Enumeration e2 =
superclass.get_ParaList().elements();e2.hasMoreElements();){
System.out.println("paralist.elements:: "+((Type)e2.nextElement()).get_Type());
}
}
if(decl.get_Paratyp()!=null){
System.out.println("++ ParaCheck: Name:
"+decl.get_Name()+"\tParatyp: "+decl.get_Paratyp()); }
else System.out.println("++ ParaCheck: Name: "+decl.get_Name()+"\tkein
Paratyp gesetzt."); }
}
}
*/
// ino.end
public Menge<Field> getFields()
{
return fielddecl;
}
/**
* @author Andreas Stadelmeier, a10023
* ¼gt der Klasse eine Feld hinzu.
* @param feld
*/
public void addField(Field i)
{
fielddecl.addElement(i);
}
// ino.method.string_rec.23191.definition
static String string_rec(Hashtable ht)
// ino.end
// ino.method.string_rec.23191.body
{
String record=("[");
for(Enumeration e=ht.elements(),k=ht.keys();e.hasMoreElements();){
String s = (String)k.nextElement();
Object o = e.nextElement();
record=record.concat(" "+s);
if(o instanceof Type){
record=record.concat(" = "+((Type)o).getName());
}
else if(o instanceof Hashtable){
record=record.concat("= ");
record=record.concat(string_rec((Hashtable)o));
if(e.hasMoreElements())
record=record.concat(", ");
}
else if(o instanceof String){
record=record.concat(" = "+o);
if(e.hasMoreElements())
record=record.concat(", ");
}
else {
record=("[FEHLER: string_rec: unbekannter Typ!!!!!!");
}
}
record=record.concat("]");
return(record);
}
// ino.end
// ino.method.string_rec.23194.defdescription type=block
/*static void string_rec(Menge v){
String record=("{");
for(Enumeration e=v.elements();e.hasMoreElements();){
Type t = (Type)e.nextElement();
record=record.concat(" "+t.getName());
if(e.hasMoreElements())
record=record.concat(",");
}
record=record.concat("}");
parserlog.debug(record);
}*/
// ino.end
// ino.method.string_rec.23194.definition
static String string_rec(String st, Hashtable ht)
// ino.end
// ino.method.string_rec.23194.body
{
String record=(st);
record=record.concat("[");
for(Enumeration e=ht.elements(),k=ht.keys();e.hasMoreElements();){
String s = (String)k.nextElement();
Object o = e.nextElement();
record=record.concat(" "+s);
if(o instanceof Type){
record=record.concat(" = "+((Type)o).getName());
}
else if(o instanceof Hashtable){
record=record.concat("= ");
record=record.concat(string_rec((Hashtable)o));
if(e.hasMoreElements())
record=record.concat(", ");
}
else if(o instanceof String){
record=record.concat(" = "+o);
if(e.hasMoreElements())
record=record.concat(", ");
}
else {
record=("FEHLER: string_rec: unbekannter Typ!!!!!! " +o);
}
}
record=record.concat("]");
return(record);
}
// ino.end
// ino.method.string_rec.23197.definition
static String string_rec(String st,Menge v)
// ino.end
// ino.method.string_rec.23197.body
{
String record=(st);
record=record.concat("{");
for(Enumeration e=v.elements();e.hasMoreElements();){
Type t = (Type)e.nextElement();
record=record.concat(" "+t.getName());
if(e.hasMoreElements())
record=record.concat(", ");
}
record=record.concat("}");
return(record);
}
// ino.end
// ino.method.istParameterOK.23200.defdescription type=line
//
// ********************************************************************************************
//
// ino.end
/*
// ino.method.istParameterOK.23200.definition
public void istParameterOK( Menge Parameter, Menge<Class> KlassenVektor )
// ino.end
// ino.method.istParameterOK.23200.body
{
// otth: prueft rekursiv, ob Parameter im Klassenvektor vorkommt, falls RefType, oder ob TypePlaceholder nicht vorkommt
for( int i = 0; i < Parameter.size(); i++)
{
Type TempParameter = (Type)(Parameter.elementAt(i));
// an dieser Stelle: Parametername
if ( TempParameter instanceof RefType )
{
// t im Klassenvektor suchen --> muss deklariert sein
boolean bGefunden = false;
for( int k = 0; k < KlassenVektor.size(); k++)
{
if( KlassenVektor.elementAt(k).getName().equals(((RefType)TempParameter).getTypeName()) )
{
// Namen gleich --> Parameterliste rekursiv pruefen
if( ((RefType)TempParameter).get_ParaList() != null )
{
if( ((RefType)TempParameter).get_ParaList().size() != KlassenVektor.elementAt(k).get_ParaList().size() )
{
parserlog.error( "SEMANTIK-CHECK-FEHLER: Parameteranzahl von\n" + TempParameter.getName() + " stimmt mit der Klassendefinition\n" + KlassenVektor.elementAt(k).getName() + " nicht �berein.", Section.OLD );
System.exit( 1 );
}
else
{
istParameterOK( ((RefType)TempParameter).get_ParaList(), KlassenVektor );
bGefunden = true;
break;
}
}
else
{
// OK ...
bGefunden = true;
break;
}
}
}
// Parameter wurde nicht gefunden:
if( !bGefunden )
{
parserlog.error( "SEMANTIK-CHECK-FEHLER: Parameter " + TempParameter.getName() + " ist noch nicht als Klasse definiert." );
System.exit( 1 );
}
}
else
{
// Tylose Variablen ¯Â¿Â½rfen nicht deklariert sein
for( int k = 0; k < KlassenVektor.size(); k++)
{
if( KlassenVektor.elementAt(k).getName().equals(TempParameter.getName()) )
{
parserlog.error( "SEMANTIK-CHECK-FEHLER: Parameter " + TempParameter.getName() + " ist bereits als Klasse definiert." );
System.exit( 1 );
}
}
// nicht gefunden
}
} // end otth; end if: t = RefType
}
// ino.end
*/
// ino.method.toString.23203.defdescription type=javadoc
/**
* <br/>Author: Martin Pl�micke
* @return
*/
// ino.end
// ino.method.toString.23203.definition
public String toString()
// ino.end
// ino.method.toString.23203.body
{
return fielddecl.toString();
}
// ino.end
public JavaCodeResult printJavaCode(ResultSet resultSet) {
JavaCodeResult ret = new JavaCodeResult("{\n");
for(Field field : this.fielddecl)ret.attach( field.printJavaCode(resultSet) ).attach( "\n" );
return ret.attach("}\n");
}
}
// ino.end

View File

@ -1,59 +0,0 @@
// ino.module.ClassHelper.8555.package
package de.dhbwstuttgart.syntaxtree;
// ino.end
// ino.module.ClassHelper.8555.import
import de.dhbwstuttgart.typeinference.Menge;
import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar;
import de.dhbwstuttgart.syntaxtree.type.RefType;
import de.dhbwstuttgart.syntaxtree.type.Type;
// ino.class.ClassHelper.23206.declaration
public class ClassHelper
// ino.end
// ino.class.ClassHelper.23206.body
{
// ino.method.findGenericType.23209.defdescription type=javadoc
/**
* HOTI
* Diese Methode sucht in der Klassendefinition nach einen GTV, die
* so heißt wie die im RefType definierte Variable. Wenn sie diese gefunden
* hat, wird sie zurückgeben. Wenn dies nicht der Fall war, schaut sie, falls
* angegeben in den Methodenparametern nach. Findet sie dort auch nichts, liefert
* die Methode <b>null</b>.
* @param type
* @return
*/
// ino.end
// ino.method.findGenericType.23209.definition
@Deprecated
public static GenericTypeVar findGenericType(Type type, Menge<Type> paralist, Menge<GenericTypeVar> methodParaList)
// ino.end
// ino.method.findGenericType.23209.body
{
if(!(type instanceof RefType)){
return null;
}
for(int i=0;i<paralist.size();i++){
if(paralist.get(i) instanceof GenericTypeVar){
GenericTypeVar gtv=(GenericTypeVar)paralist.get(i);
if(gtv.getName().equals(type.getName())){
return gtv;
}
}
}
if(methodParaList!=null){
for(int i=0;i<methodParaList.size();i++){
GenericTypeVar gtv=methodParaList.elementAt(i);
if(gtv.getName().equals(type.getName())){
return gtv;
}
}
}
return(null);
}
// ino.end
}
// ino.end

View File

@ -1,204 +0,0 @@
// ino.module.Constant.8556.package
package de.dhbwstuttgart.syntaxtree;
// ino.end
// ino.module.Constant.8556.import
import de.dhbwstuttgart.typeinference.Menge;
import de.dhbwstuttgart.core.MyCompiler;
import de.dhbwstuttgart.parser.JavaClassName;
import de.dhbwstuttgart.syntaxtree.modifier.Modifiers;
import de.dhbwstuttgart.syntaxtree.statement.Expr;
import de.dhbwstuttgart.syntaxtree.statement.Literal;
import de.dhbwstuttgart.syntaxtree.type.Type;
import de.dhbwstuttgart.typeinference.JavaCodeResult;
import de.dhbwstuttgart.typeinference.ResultSet;
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
import de.dhbwstuttgart.typeinference.exceptions.NotImplementedException;
// ino.class.Constant.23212.description type=javadoc
/**
* Enthaelt die Eigenschaften einer Konstante (Name, Typ, Modifier, Wert)
*
* @author SCJU
*
*/
// ino.end
// ino.class.Constant.23212.declaration
public class Constant extends Method
// ino.end
// ino.class.Constant.23212.body
{
// ino.attribute.name.23216.declaration
protected String name; // Name der Konstante
// ino.end
// ino.attribute.mod.23219.declaration
protected Modifiers mod = new Modifiers(); // Access-Flags
// ino.end
// ino.attribute.exp.23222.declaration
protected Expr exp; // Wert der Konstante
// ino.end
// ino.attribute.typ.23225.declaration
protected Type typ; // Typ der Konstante
// ino.end
// ino.method.Constant.23228.definition
@Deprecated
public Constant(String name, Modifiers mod)
// ino.end
// ino.method.Constant.23228.body
{
super(0); //Nur ein Workaraound. Da Constant = Deprecated
this.name = name;
this.mod = mod;
}
// ino.end
// ino.method.getValue.23231.defdescription type=javadoc
/**
* Gibt den Wert der Konstantendefinition zurueck.
*/
// ino.end
// ino.method.getValue.23231.definition
public Expr getValue()
// ino.end
// ino.method.getValue.23231.body
{
return exp;
}
// ino.end
// ino.method.setValue.23234.defdescription type=javadoc
/**
* Legt den Wert der Konstantendefinition fest.
*/
// ino.end
// ino.method.setValue.23234.definition
public void setValue(Expr exp)
// ino.end
// ino.method.setValue.23234.body
{
this.exp = exp;
}
// ino.end
// ino.method.getType.23237.defdescription type=javadoc
/**
* Gibt den Typ der Konstantendefinition zurueck.
*/
// ino.end
// ino.method.getType.23237.definition
public Type getType()
// ino.end
// ino.method.getType.23237.body
{
return typ;
}
// ino.end
// ino.method.setType.23240.defdescription type=javadoc
/**
* Legt den Typ der Konstantendefinition fest
*/
// ino.end
// ino.method.setType.23240.definition
public void setType(Type typ)
// ino.end
// ino.method.setType.23240.body
{
this.typ = typ;
}
// ino.end
// ino.method.getTypeName.23243.definition
public JavaClassName getTypeName()
// ino.end
// ino.method.getTypeName.23243.body
{
return new JavaClassName(name);
}
// ino.end
// ino.method.getName.23246.definition
public String getIdentifier()
// ino.end
// ino.method.getName.23246.body
{
return name;
}
// ino.end
// ino.method.setName.23249.definition
public void setName(String name)
// ino.end
// ino.method.setName.23249.body
{
this.name = name;
}
// ino.end
// ino.method.getModifiers.23252.definition
public Modifiers getModifiers()
// ino.end
// ino.method.getModifiers.23252.body
{
return mod;
}
// ino.end
// ino.method.setModifiers.23255.definition
public void setModifiers(Modifiers modifiers)
// ino.end
// ino.method.setModifiers.23255.body
{
this.mod = modifiers;
}
// ino.end
// ino.method.getOffset.23261.definition
public int getOffset()
// ino.end
// ino.method.getOffset.23261.body
{
if(declid.size()<=0)
return MyCompiler.NO_LINENUMBER;
else{
return declid.elementAt(0).getOffset();
}
}
// ino.end
// ino.method.getLineNumber.23264.definition
public int getLineNumber()
// ino.end
// ino.method.getLineNumber.23264.body
{
if(declid.size()<=0)
return MyCompiler.NO_LINENUMBER;
else{
return declid.elementAt(0).getLineNumber();
}
}
// ino.end
@Override
public JavaCodeResult printJavaCode(ResultSet resultSet) {
throw new NotImplementedException();
}
@Override
public TypeAssumptions createTypeAssumptions(Class classmember) {
throw new NotImplementedException();
//return null;
}
@Override
public int getTypeLineNumber() {
// TODO Auto-generated method stub
return 0;
}
}
// ino.end

View File

@ -1,42 +1,20 @@
package de.dhbwstuttgart.syntaxtree;
import org.apache.bcel.Constants;
import org.apache.bcel.classfile.ConstantPool;
import org.apache.bcel.generic.ClassGen;
import org.apache.bcel.generic.ConstantPoolGen;
import org.apache.bcel.generic.InstructionFactory;
import org.apache.bcel.generic.InstructionHandle;
import org.apache.bcel.generic.InstructionList;
import org.apache.bcel.generic.MethodGen;
import de.dhbwstuttgart.typeinference.Menge;
import de.dhbwstuttgart.bytecode.ClassGenerator;
import de.dhbwstuttgart.bytecode.DHBWConstantPoolGen;
import de.dhbwstuttgart.bytecode.DHBWInstructionFactory;
import de.dhbwstuttgart.bytecode.MethodGenerator;
import de.dhbwstuttgart.parser.JavaClassName;
import de.dhbwstuttgart.syntaxtree.misc.DeclId;
import de.dhbwstuttgart.syntaxtree.modifier.Modifiers;
import de.dhbwstuttgart.typecheck.JavaClassName;
import de.dhbwstuttgart.syntaxtree.statement.Block;
import de.dhbwstuttgart.syntaxtree.statement.Return;
import de.dhbwstuttgart.syntaxtree.statement.SuperCall;
import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar;
import de.dhbwstuttgart.syntaxtree.type.RefType;
import de.dhbwstuttgart.syntaxtree.type.Type;
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
import de.dhbwstuttgart.typeinference.ConstraintsSet;
import de.dhbwstuttgart.typeinference.JavaCodeResult;
import de.dhbwstuttgart.typeinference.ResultSet;
import de.dhbwstuttgart.typeinference.TypeinferenceResultSet;
import de.dhbwstuttgart.typeinference.TypeinferenceResults;
import de.dhbwstuttgart.typeinference.assumptions.ConstructorAssumption;
import de.dhbwstuttgart.typeinference.assumptions.MethodAssumption;
import de.dhbwstuttgart.typeinference.assumptions.ParameterAssumption;
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
import de.dhbwstuttgart.typeinference.exceptions.DebugException;
import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException;
import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertPoint;
import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertSet;
import de.dhbwstuttgart.syntaxtree.type.Void;
public class Constructor extends Method {
@ -45,9 +23,10 @@ public class Constructor extends Method {
* Diese Klasse beherbegt den als Methode geparsten Konstruktor und wandelt sein verhalten zu dem eines Konstruktors ab.
*/
public Constructor(Method methode, Class parent){
super(methode.get_Method_Name(), methode.getType(), methode.getParameterList(),methode.get_Block(), methode.getGenericDeclarationList(), methode.getOffset());
super(methode.get_Name(), methode.getType(), methode.getParameterList(),
methode.get_Block(), methode.getGenericDeclarationList(), methode.getOffset());
//Sicherstellen, dass das erste Statement in der Methode ein SuperCall ist:
if(this.get_Block().get_Statement().size() <1 || ! (this.get_Block().get_Statement().firstElement() instanceof SuperCall)){
if(this.get_Block().get_Statement().size() <1 || ! (this.get_Block().get_Statement().get(0) instanceof SuperCall)){
this.get_Block().statements.add(0, new SuperCall(this.get_Block()));
this.parserPostProcessing(parent);
}
@ -55,7 +34,7 @@ public class Constructor extends Method {
@Override
public TypeAssumptions createTypeAssumptions(Class classmember) {
this.parent = classmember;
Class parentClass = this.getParentClass();
Class parentClass = classmember;
TypeAssumptions ret = new TypeAssumptions();
ret.addAssumption(new ConstructorAssumption(this, parentClass));
return ret;
@ -64,17 +43,14 @@ public class Constructor extends Method {
public void genByteCode(ClassGenerator cg, InstructionList fieldInitializations){
DHBWConstantPoolGen _cp = cg.getConstantPool();
InstructionList il = new InstructionList(); //sollte nicht new sein sondern aus Block kommen
Class parentClass = this.getParentClass();
MethodGenerator method = new MethodGenerator(Constants.ACC_PUBLIC,
this.getType().getBytecodeType(cg, null), this.parameterlist.getBytecodeTypeList(cg,null),
this.parameterlist.getParameterNameArray(), "<init>", parentClass.name.toString(), il, _cp);
MethodGenerator method = new MethodGenerator(Constants.ACC_PUBLIC, this.getType().getBytecodeType(cg, null),
this.parameterlist.getBytecodeTypeList(cg,null) , this.parameterlist.getParameterNameArray(),
"<init>", cg.getClassName(), il, _cp);
//FieldInitializations an Block anfügen
Block block = this.get_Block();
if(block.statements.firstElement() instanceof SuperCall){
block.statements.insertElementAt(new BytecodeInstructionBlock(fieldInitializations), 1);
}else{
if(! (block.statements.get(0) instanceof SuperCall)){
throw new DebugException("Fehlender SuperCall im Konstruktor");
}
@ -83,20 +59,6 @@ public class Constructor extends Method {
cg.addMethod(method.createMethod(cg, getParameterList(), this.getType(), get_Block(), null));
}
/**
* Mit dieser Hilfsklasse kann eine beliebige InstructionList in eine vorhandenen Block als Statement eingefügt werden.
* Wird für Bytecodegenerierung benötigt.
*/
private class BytecodeInstructionBlock extends Block{
InstructionList il;
BytecodeInstructionBlock(InstructionList toInsert){
il = toInsert;
}
@Override
public InstructionList genByteCode(ClassGenerator cg, TypeinferenceResultSet rs){
return il;
}
}
@Override
public void genByteCode(ClassGenerator cg, Class classObj, TypeinferenceResults resultSets) {
@ -121,27 +83,6 @@ public class Constructor extends Method {
gtv.parserPostProcessing(this);
}
}
@Override
public ConstraintsSet TYPE(TypeAssumptions ass) {
//super.setType(this.getParentClass().getType());
super.setType(new Void(this, 0));
return super.TYPE(ass);
}
@Override
public void setType(Type t) {
super.setType(new Void(this, this.getOffset()));
//throw new TypeinferenceException("Einem Konstruktor kann kein Typ zugewiesen werden", this);
//this.methode.setType(t);
}
/*public Constructor(Method methode){
super(methode.getOffset());
this.methode = methode;
this.setDeclIdMenge(methode.getDeclIdMenge());
this.methode.setType(this.methode.getParentClass().getType());
}*/
@Override
public JavaClassName getTypeName() {
@ -152,61 +93,3 @@ public class Constructor extends Method {
}
/*
// ino.class.Constructor.23267.declaration
public class Constructor_Backup extends Method
// ino.end
// ino.class.Constructor.23267.body
{
// ino.method.Constructor.23271.definition
public Constructor_Backup()
// ino.end
// ino.method.Constructor.23271.body
{
this.setParameterList(null);
// #JB# 04.06.2005
// ###########################################################
DeclId decl = new DeclId();
decl.set_Name("<init>");
this.set_DeclId(decl);
// ###########################################################
}
// ino.end
// ino.method.get_codegen_Param_Type.23274.definition
public String get_codegen_Param_Type(Menge paralist)
// ino.end
// ino.method.get_codegen_Param_Type.23274.body
{
String ret = new String();
if(this.getParameterList() == null)
{
ret += "()";
}
else
{
ret += this.getParameterList().get_codegen_ParameterList(paralist);
}
ret += "V";
return ret;
}
// ino.end
// ino.method.codegen.23277.definition
public void codegen(ClassFile classfile, Menge paralist)
throws JVMCodeException
// ino.end
// ino.method.codegen.23277.body
{
classfile.set_constructor_founded(true);
classfile.add_method("<init>", this.get_codegen_Param_Type(paralist), this.getParameterList(), null, get_Block(), declid.firstElement().get_access_flags(), paralist, false);
}
// ino.end
}
*/

View File

@ -1,35 +1,14 @@
// ino.module.ExceptionList.8559.package
package de.dhbwstuttgart.syntaxtree;
// ino.end
// ino.module.ExceptionList.8559.import
import de.dhbwstuttgart.typeinference.Menge;
import de.dhbwstuttgart.syntaxtree.type.RefType;
import java.util.List;
// ino.class.ExceptionList.23358.declaration
public class ExceptionList
// ino.end
// ino.class.ExceptionList.23358.body
{
// ino.attribute.reftype.23361.declaration
private Menge<RefType> reftype = new Menge<RefType>();
// ino.end
// ino.method.set_addElem.23364.definition
public void set_addElem(RefType rety)
// ino.end
// ino.method.set_addElem.23364.body
{
reftype.addElement(rety);
private List<RefType> exceptions;
public ExceptionList(List<RefType> exceptions){
this.exceptions = exceptions;
}
// ino.end
}
// ino.end

View File

@ -4,7 +4,6 @@ import org.apache.bcel.generic.ClassGen;
import de.dhbwstuttgart.typeinference.Menge;
import de.dhbwstuttgart.bytecode.ClassGenerator;
import de.dhbwstuttgart.syntaxtree.misc.DeclId;
import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar;
import de.dhbwstuttgart.syntaxtree.type.RefType;
import de.dhbwstuttgart.syntaxtree.type.Type;
@ -21,16 +20,16 @@ import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertPoint;
public abstract class Field extends GTVDeclarationContext implements TypeInsertable, Typeable, Generic, GenericTypeInsertable{
protected Menge<DeclId> declid = new Menge<DeclId>(); // Menge, da 'int a, b, c, ...' auch eingeparst werden muss
private Type typ;
private String name;
protected Type typ;
private int offset;
private GenericDeclarationList genericParameters;
public Field(int offset){
this.offset = offset;
public Field(String name, Type type, int offset){
super(offset);
this.name = name;
this.typ = type;
}
@Override
@ -42,10 +41,6 @@ public abstract class Field extends GTVDeclarationContext implements TypeInserta
return this.offset;
}
@Override
public void setType(Type typ) {
this.typ = typ;
}
@Override
public Type getType() {
return typ;
@ -56,40 +51,13 @@ public abstract class Field extends GTVDeclarationContext implements TypeInserta
public Menge<GenericTypeVar> getGenericParameter() {
Menge<GenericTypeVar> ret = new Menge<>();
if(this.genericParameters == null)return ret;
ret.addAll(this.genericParameters.getMenge());
ret.addAll(this.genericParameters.getGTVList());
return ret;
}
GenericDeclarationList getGenericDeclarationList(){
return this.genericParameters;
}
public void set_DeclId(DeclId did)
{
this.declid.addElement(did);
}
public Menge<DeclId> get_Name()
{
return declid;
}
public Menge<DeclId> getDeclIdMenge()
{
// otth: ganzer Vektor zur�ckgeben, um ihn zu kopieren (vgl. MyCompiler - Konstruktor in Methode umwandeln)
return declid;
}
public void setDeclIdMenge( Menge<DeclId> vDeclId )
{
// otth: kompletter Vektor setzen, um ihn zu kopieren (vgl. MyCompiler - Konstruktor in Methode umwandeln)
declid = vDeclId;
}
public abstract JavaCodeResult printJavaCode(ResultSet resultSet);
@ -103,7 +71,7 @@ public abstract class Field extends GTVDeclarationContext implements TypeInserta
public abstract ConstraintsSet TYPE(TypeAssumptions publicAssumptions);
public String getIdentifier() {
return this.get_Name().firstElement().get_Name();
return name;
}
@Override
@ -117,22 +85,6 @@ public abstract class Field extends GTVDeclarationContext implements TypeInserta
return new TypeInsertPoint(this, this, resultSet.getTypeEqualTo(tph), resultSet);
}
/**
* Wird im Zuge des ParserPostProcessing aufgerufen.
* Der Parser kann den Unterschied zwischen einem RefType und einer GTV nicht erkennen.
* Diese Methode ersetzt die RefTypes gegebenenfalls durch eine GTV.
* @param paralist
*/
public void wandleRefTypeAttributes2GenericAttributes(Menge<Type> paralist){
// Zuerst Returntype untersuchen
Type type=getType();
Type pendantReturnType = null;
if(type instanceof RefType)pendantReturnType = ((RefType)type).findGenericType(paralist, new Menge<GenericTypeVar>());//GenericTypeVar pendantReturnType=ClassHelper.findGenericType(type, paralist,new Menge<GenericTypeVar>());
if(pendantReturnType!=null){ //Wenn generisch, dann modifizieren
setType(pendantReturnType);
}
}
public boolean isPublic() {
//TODO: momentan ist jedes Feld public!
return true;

View File

@ -9,7 +9,6 @@ import org.apache.bcel.generic.ClassGen;
import de.dhbwstuttgart.typeinference.Menge;
import de.dhbwstuttgart.bytecode.ClassGenerator;
import de.dhbwstuttgart.syntaxtree.misc.DeclId;
import de.dhbwstuttgart.syntaxtree.statement.Expr;
import de.dhbwstuttgart.syntaxtree.statement.This;
import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar;
@ -35,35 +34,20 @@ import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException;
public class FieldDeclaration extends Field{
private Expr wert;
//private Type type;
//private Menge<GenericTypeVar> parameter;
/**
* Dieser Konstruktor der FieldDeclaration erstellt den Syntaxknoten vollständig.
* Kein nachträgliches hinzfügen von Informationen oder aufrufen von parserPostProcessing ist notwendig.
*/
public FieldDeclaration(String name, Type typ){
super(0);//Dieser Deklarator wird nicht vom Parser aufgerufen. Dadurch gibt es auch keinen Offset
this.setType(typ);
this.set_DeclId(new DeclId(name));
public FieldDeclaration(String name, Type typ, Expr value){
super(name, typ, 0);//Dieser Deklarator wird nicht vom Parser aufgerufen. Dadurch gibt es auch keinen Offset
this.wert = value;
}
public FieldDeclaration(int offset){
super(offset);
}
public void setWert(Expr initialExpression){
this.wert = initialExpression;
}
public Expr getWert(){
return this.wert;
}
public String getIdentifier(){
return this.get_Name().elementAt(0).name;
}
@Override
public String toString()
{
@ -72,7 +56,7 @@ public class FieldDeclaration extends Field{
}
public JavaCodeResult printJavaCode(ResultSet resultSet) {
public JavaCodeResult printJavaCode(TypeinferenceResultSet resultSet) {
JavaCodeResult ret = new JavaCodeResult();
JavaCodeResult toAttach = this.getType().printJavaCode(resultSet).attach(" ").attach( this.getIdentifier());
if(this.wert!=null)toAttach.attach(" = ").attach(this.getWert().printJavaCode(resultSet) );
@ -97,23 +81,13 @@ public class FieldDeclaration extends Field{
return assumptions;
}
@Override
public void parserPostProcessing(SyntaxTreeNode parent){
super.parserPostProcessing(parent);
if(this.getType() == null)this.setType(TypePlaceholder.fresh(this));
}
@Override
public Menge<SyntaxTreeNode> getChildren() {
Menge<SyntaxTreeNode> ret = super.getChildren();
if(this.wert!=null)ret.add(this.wert);
return ret;
}
public int getVariableLength()
{
return declid.elementAt(0).get_Name().length();
}
@Override
public ConstraintsSet TYPE(TypeAssumptions publicAssumptions) {
if(this.wert == null && (this.getType() == null || this.getType() instanceof TypePlaceholder))
@ -128,24 +102,9 @@ public class FieldDeclaration extends Field{
for(GenericTypeVar gp : this.getGenericParameter()){
gp.TYPE(localAssumptions);
}
/*
if(this.getType() instanceof GenericTypeVar){
//Falls Typ ein GTV ist muss er syntaktisch kontrolliert werden...
GenericTypeVar gtv = (GenericTypeVar) this.getType();
}
*/
//TypeCheck, falls es sich um einen RefType handelt:
Type thisType = this.getType().TYPE(localAssumptions, this);
this.setType(thisType);
/*
if(this.getType()!=null && (this.getType() instanceof RefType)){
Type replaceType = null;
replaceType = publicAssumptions.getTypeFor((RefType)this.getType());
if(replaceType == null)throw new TypeinferenceException("Der Typ "+this.getType().getName()+" ist nicht korrekt",this);
this.setType(replaceType);
}
*/
Type thisType = this.getType();
UndConstraint c1 = ConstraintsSet.createSingleConstraint(thisType, thisType);
ret.add(c1); //Damit die TypVariable des Felds in den Constraints auftaucht
@ -157,12 +116,6 @@ public class FieldDeclaration extends Field{
}
return ret;
}
@Override
public void wandleRefTypeAttributes2GenericAttributes(Menge<Type> paralist){
super.wandleRefTypeAttributes2GenericAttributes(paralist);
if(this.getWert()!=null)this.getWert().wandleRefTypeAttributes2GenericAttributes(paralist, new Menge<GenericTypeVar>()); //FieldDeclaration hat keine Generischen Variablen, daher leere Liste übergeben
}
/**
* Das besondere bei genByteCode einer FieldDeclaration ist, dass ein InstructionList zurückgegeben wird.
@ -185,7 +138,7 @@ public class FieldDeclaration extends Field{
}
FieldInstruction putFieldInstruction =
cg.getInstructionFactory().createFieldAccess(this.getParentClass().getName().toString(),
cg.getInstructionFactory().createFieldAccess(cg.getClassName(),
this.getDescription(), this.getType().getBytecodeType(cg, rs), Const.PUTFIELD);
il.append(putFieldInstruction );
return il;

View File

@ -1,13 +1,12 @@
// ino.module.FormalParameter.8561.package
package de.dhbwstuttgart.syntaxtree;
// ino.end
// ino.module.FormalParameter.8561.import
import de.dhbwstuttgart.typeinference.Menge;
import java.util.List;
import de.dhbwstuttgart.bytecode.ClassGenerator;
import de.dhbwstuttgart.logger.Logger;
import de.dhbwstuttgart.syntaxtree.misc.DeclId;
import de.dhbwstuttgart.syntaxtree.type.Type;
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
import de.dhbwstuttgart.typeinference.JavaCodeResult;
@ -20,28 +19,16 @@ import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException;
import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertPoint;
import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertSet;
// ino.class.FormalParameter.23391.declaration
public class FormalParameter extends SyntaxTreeNode implements Typeable, TypeInsertable
// ino.end
// ino.class.FormalParameter.23391.body
{
// ino.attribute.type.23395.declaration
private Type type;
// ino.end
// ino.attribute.declid.23398.declaration
private DeclId declid;
// ino.end
// ino.attribute.inferencelog.23401.declaration
private String name;
protected static Logger inferencelog = Logger.getLogger("inference");
// ino.end
public FormalParameter(DeclId name){
this.set_DeclId(name);
}
public FormalParameter(String name, Type type){
this(new DeclId(name));
this.setType(type);
public FormalParameter(String name, Type type, int offset){
super(offset);
this.name = name;
this.type = type;
}
@Override
@ -55,121 +42,16 @@ public class FormalParameter extends SyntaxTreeNode implements Typeable, TypeIns
}
return true;
}
// ino.method.setType.23404.defdescription type=javadoc
/**
* <br/>Author: ¯Â¿Â½rg ¯Â¿Â½uerle
* @param t
*/
// ino.end
// ino.method.setType.23404.definition
public void setType(Type t)
// ino.end
// ino.method.setType.23404.body
{
this.type = t;
}
// ino.end
// ino.method.set_DeclId.23407.definition
public void set_DeclId(DeclId did)
// ino.end
// ino.method.set_DeclId.23407.body
{
if(did == null)throw new NullPointerException();
this.declid = did;
}
// ino.end
// ino.method.get_Name.23410.definition
public String getIdentifier()
// ino.end
// ino.method.get_Name.23410.body
{
return declid.get_Name();
return name;
}
// ino.end
// ino.method.getType.23413.definition
public Type getType()
// ino.end
// ino.method.getType.23413.body
{
return type;
}
// ino.end
// ino.method.getTypeName.23416.definition
public String getTypeName()
// ino.end
// ino.method.getTypeName.23416.body
{ if(this.getType() == null)return "";
return this.getType().getName().toString();
}
// ino.end
// ino.method.getOffset.23422.defdescription type=javadoc
/**
* <br/>Author: Thomas Hornberger 09.04.2006
* @return
*/
// ino.end
// ino.method.getOffset.23422.definition
public int getOffset()
// ino.end
// ino.method.getOffset.23422.body
{
return declid.getOffset();
}
// ino.end
// ino.method.getLineNumber.23425.defdescription type=javadoc
/**
* <br/>Author: ¯Â¿Â½rg ¯Â¿Â½uerle
* @return
*/
// ino.end
// ino.method.getLineNumber.23425.definition
public int getLineNumber()
// ino.end
// ino.method.getLineNumber.23425.body
{
return declid.getLineNumber();
}
// ino.end
// ino.method.getTypeLineNumber.23431.defdescription type=javadoc
/**
* <br>Author: ¯Â¿Â½rg ¯Â¿Â½uerle
* @return
*/
// ino.end
// ino.method.getTypeLineNumber.23431.definition
public int getTypeLineNumber()
// ino.end
// ino.method.getTypeLineNumber.23431.body
{
return this.getLineNumber();
}
// ino.end
//private Type typeVariable;
public String getTypeInformation() {
return getType().toString() + " " +this.getIdentifier();
}
@Override
public String toString(){
@ -188,33 +70,6 @@ public class FormalParameter extends SyntaxTreeNode implements Typeable, TypeIns
return ret;
}
@Override
public void setOffset(int offset) {
//Das Offset steht in declId
throw new NotImplementedException();
}
@Override
public Menge<SyntaxTreeNode> getChildren() {
Menge<SyntaxTreeNode> ret = new Menge<SyntaxTreeNode>();
if(type != null)ret.add(this.type);
return ret;
}
@Override
public void parserPostProcessing(SyntaxTreeNode parent) {
super.parserPostProcessing(parent);
if(this.type==null)this.type = TypePlaceholder.fresh(this);
}
@Override
public TypeInsertPoint createTypeInsertPoint(TypePlaceholder tph,
ResultSet resultSet) {
@ -223,20 +78,6 @@ public class FormalParameter extends SyntaxTreeNode implements Typeable, TypeIns
return new TypeInsertPoint(this, this, t, resultSet);
}
@Override
public int getVariableLength() {
int ret = 0;
ret += this.getTypeName().length();
ret +=this.getIdentifier().length();
return ret;
}
public DeclId getDeclId() {
return this.declid;
}
@Override
public String getDescription(){
String ret = "";
@ -245,6 +86,4 @@ public class FormalParameter extends SyntaxTreeNode implements Typeable, TypeIns
}
return ret+this.getIdentifier();
}
}
// ino.end

View File

@ -1,12 +1,13 @@
package de.dhbwstuttgart.syntaxtree;
import de.dhbwstuttgart.typeinference.Menge;
/**
* Beischreibt eine SyntaxTreeNode, welcher die Eigenschaft besitzt,
* dass bei seiner Deklaration auch Generische Typvariablen deklariert wurden.
*/
public abstract class GTVDeclarationContext extends SyntaxTreeNode {
public GTVDeclarationContext(int offset) {
super(offset);
}
@Override
public GTVDeclarationContext getGTVDeclarationContext(){
return this;

View File

@ -11,7 +11,5 @@ import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar;
*
*/
public interface Generic {
public void setGenericParameter(GenericDeclarationList params);
public Iterable<GenericTypeVar> getGenericParameter();
}

View File

@ -6,34 +6,25 @@ import java.util.List;
import java.util.ListIterator;
import de.dhbwstuttgart.typeinference.Menge;
import de.dhbwstuttgart.parser.GenericVarDeclarationList;
import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar;
/**
* Stellt eine Deklarations-Liste von Generischen Variablen dar.
* Kann vor Methoden und Klassen auftauchen. (<....>)
* @author janulrich
*
*
*/
public class GenericDeclarationList extends SyntaxTreeNode implements Iterable<GenericTypeVar>{
private int offsetOfLastElement;
private Menge<GenericTypeVar> gtvs = new Menge<>();
private List<GenericTypeVar> gtvs = new Menge<>();
public GenericDeclarationList(){
this(new Menge<GenericTypeVar>(), -1);
}
public GenericDeclarationList(Menge<GenericTypeVar> values, int endOffset) {
this.addAll(values);
public GenericDeclarationList(List<GenericTypeVar> values, int endOffset) {
super(endOffset);
gtvs = values;
this.offsetOfLastElement = endOffset;
}
private void addAll(Menge<GenericTypeVar> values) {
this.gtvs.addAll(values);
}
public int getEndOffset(){
return offsetOfLastElement;
}
@ -43,11 +34,6 @@ public class GenericDeclarationList extends SyntaxTreeNode implements Iterable<G
return getEndOffset();
}
@Override
public int getVariableLength() {
return 0;
}
@Override
public Iterator<GenericTypeVar> iterator() {
return this.gtvs.iterator();
@ -66,11 +52,11 @@ public class GenericDeclarationList extends SyntaxTreeNode implements Iterable<G
return gtvs.size();
}
public Menge<GenericTypeVar> getMenge() {
return this.gtvs;
}
public void add(GenericTypeVar t) {
this.gtvs.add(t);
}
public List<GenericTypeVar> getGTVList() {
return this.gtvs;
}
}

View File

@ -0,0 +1,72 @@
package de.dhbwstuttgart.syntaxtree;
import de.dhbwstuttgart.syntaxtree.type.RefType;
import de.dhbwstuttgart.typeinference.JavaCodeResult;
import de.dhbwstuttgart.typeinference.Menge;
import de.dhbwstuttgart.typeinference.ResultSet;
import de.dhbwstuttgart.typeinference.exceptions.NotImplementedException;
import java.util.ArrayList;
import java.util.List;
/**
* Entspricht einem GenericTypeVar, jedoch mit Bounds
* (d.h. vorgaben, von welchem Typ die Typevar sein darf
* => extends Class x
* => implements Interface y
* ...
* @author hoti 4.5.06
*
*/
public class GenericTypeVar extends SyntaxTreeNode
{
/**
* Hier sind die Bounds in Form von Type-Objekten abgespeichert
*/
List<RefType> bounds=new ArrayList<RefType>();
private int endOffset;
private String name;
public GenericTypeVar(String s, List<RefType> bounds, int offset, int endOffset)
{
super(offset);
name = s;
if(bounds != null)for(RefType t : bounds){
//if(t!=null)this.extendVars.add(t);
}
//this.genericTypeVar = new RefType(s,offset);
this.bounds = bounds;
this.endOffset = endOffset;
}
public int getEndOffset(){
return this.endOffset;
}
public List<RefType> getBounds()
{
return bounds;
}
public String toString()
{
return "BoGTV " + this.name;
}
@Override
public List<SyntaxTreeNode> getChildren() {
List<SyntaxTreeNode> ret = new ArrayList<>();
ret.addAll(this.bounds);
return ret;
}
@Override
public JavaCodeResult printJavaCode(ResultSet resultSet) {
throw new NotImplementedException();
}
public String getName() {
return name;
}
}

View File

@ -1,31 +0,0 @@
// ino.module.ImportDeclarations.8562.package
package de.dhbwstuttgart.syntaxtree;
// ino.end
// ino.module.ImportDeclarations.8562.import
import de.dhbwstuttgart.typeinference.Menge;
// ino.end
import de.dhbwstuttgart.syntaxtree.misc.UsedId;
// ino.class.ImportDeclarations.23434.description type=javadoc
/**
* HOTI 4.5.06
* Auch wenn es nicht so aussieht, hat diese Klasse einen Sinn :-)
* Der Parser kann keine Generischen Typen darstellen, damit trotzdem
* an amap Stellen die Typsicherheit gewährleistet ist, hier eine Kapselung...
*/
// ino.end
// ino.class.ImportDeclarations.23434.declaration
public class ImportDeclarations extends Menge<UsedId>
// ino.end
// ino.class.ImportDeclarations.23434.body
{
// ino.attribute.serialVersionUID.23438.declaration
private static final long serialVersionUID = -8958366609867768133L;
// ino.end
}
// ino.end

View File

@ -1,259 +0,0 @@
// ino.module.Interface.8582.package
package de.dhbwstuttgart.syntaxtree;
// ino.end
// ino.module.Interface.8582.import
import de.dhbwstuttgart.typeinference.Menge;
import de.dhbwstuttgart.core.AClassOrInterface;
import de.dhbwstuttgart.syntaxtree.misc.UsedId;
import de.dhbwstuttgart.syntaxtree.modifier.Modifiers;
import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar;
import de.dhbwstuttgart.syntaxtree.type.RefType;
import de.dhbwstuttgart.syntaxtree.type.Type;
import de.dhbwstuttgart.typeinference.TypeinferenceResultSet;
/**
* Ein Interface ist eine abstrakte Klasse, erbt daher von Class
* @author janulrich
*
*/
public class Interface extends Class {
public Interface(String name, int offset){
super(name, offset);
}
public Interface(String name, Modifiers modifiers, int offset) {
super(name,modifiers, offset);
}
public Menge getParaList() {
// TODO Auto-generated method stub
return null;
}
public void setInterfaceBody(InterfaceBody interfaceBody) {
// TODO Auto-generated method stub
}
public void setParaList(Menge<Type> paraMenge) {
// TODO Auto-generated method stub
}
@Override
public boolean isInterface(){
return true;
}
}
// ino.class.Interface.23932.description type=javadoc
/**
* Die Klasse stellt die Definition eines Interfaces dar.
* @author SCJU
*
*/
/*
// ino.end
// ino.class.Interface.23932.declaration
public class Interface implements AClassOrInterface
// ino.end
// ino.class.Interface.23932.body
{
// ino.attribute.ib.23936.declaration
private InterfaceBody ib;
// ino.end
// ino.attribute.paralist.23939.decldescription type=line
// HOTI 29. Apr 06
// ino.end
// ino.attribute.paralist.23939.declaration
private Menge<Type> paralist = new Menge<Type>(); // Parameterliste 'interface xy<para1, para2,...>{}' wird gespeichert
// ino.end
// ino.attribute.containedTypes.23942.declaration
private Menge<Type> containedTypes;
// ino.end
// ino.method.Interface.23945.defdescription type=line
// Konstruktoren
// ino.end
// ino.method.Interface.23945.definition
public Interface()
// ino.end
// ino.method.Interface.23945.body
{
super();
}
// ino.end
// ino.method.Interface.23948.definition
public Interface(String name)
// ino.end
// ino.method.Interface.23948.body
{
super(name);
}
// ino.end
// ino.method.Interface.23951.definition
public Interface(String name, Modifiers mod)
// ino.end
// ino.method.Interface.23951.body
{
super(name, mod);
}
// ino.end
// ino.method.getParaList.23954.definition
public Menge<Type> getParaList()
// ino.end
// ino.method.getParaList.23954.body
{
return this.paralist;
}
// ino.end
// ino.method.setParaList.23957.definition
public void setParaList(Menge<Type> paralist)
// ino.end
// ino.method.setParaList.23957.body
{
this.paralist=paralist;
}
// ino.end
// ino.method.setContainedTypes.23960.definition
public void setContainedTypes(Menge<Type> containedTypes)
// ino.end
// ino.method.setContainedTypes.23960.body
{
this.containedTypes = containedTypes;
}
// ino.end
// ino.method.getContainedTypes.23963.definition
public Menge<Type> getContainedTypes()
// ino.end
// ino.method.getContainedTypes.23963.body
{
return containedTypes;
}
// ino.end
// ino.method.codegen.23966.definition
public void codegen(SourceFile sf)
throws JVMCodeException
// ino.end
// ino.method.codegen.23966.body
{
codegenlog.info("Definierte Superinterfaces: " + getSuperInterfaces().size());
codegenlog.debug("Liste der Interfaces: " + getSuperInterfaces().toString());
codegenlog.info("Definierte Konstanten: " + ib.getConstantVektor().size());
codegenlog.info("Definierte Methoden: " + ib.getMethodVektor().size());
// Erzeugen einer Classfile auf Basis des Interfaces
ClassFile classfile = new ClassFile(this, sf);
// Handling fuer Generics
classfile.addGenerics(paralist, null, getSuperInterfaces());
// Handling fuer Superinterfaces
classfile.addSuperInterfaces(getSuperInterfaces());
// Codegen fuer Interface-Body
Menge<Type> paralist = new Menge<Type>();
if(ib != null) ib.codegen(classfile, paralist);
classfile.codegen();
codegenlog.info("Compilierung erfolgreich abgeschlossen, "+ getName() + ".class erstellt.");
}
// ino.end
// ino.method.getInterfaceBody.23969.definition
public InterfaceBody getInterfaceBody()
// ino.end
// ino.method.getInterfaceBody.23969.body
{
return ib;
}
// ino.end
// ino.method.setInterfaceBody.23972.definition
public void setInterfaceBody(InterfaceBody ib)
// ino.end
// ino.method.setInterfaceBody.23972.body
{
this.ib = ib;
}
// ino.end
// ino.end
// ino.method.isAGenericType.23978.definition
public boolean isAGenericType(RefType type)
// ino.end
// ino.method.isAGenericType.23978.body
{
if(paralist==null)
return false;
for(int i=0;i<paralist.size();i++){
if(paralist.get(i) instanceof GenericTypeVar){
GenericTypeVar gtv=(GenericTypeVar)paralist.get(i);
if(gtv.getName().equals(type.getName())){
return true;
}
}
}
return(false);
}
// ino.end
// ino.method.wandleRefTypeAttributes2GenericAttributes.23981.defdescription type=javadoc
// ino.end
// ino.method.wandleRefTypeAttributes2GenericAttributes.23981.definition
public void wandleRefTypeAttributes2GenericAttributes()
// ino.end
// ino.method.wandleRefTypeAttributes2GenericAttributes.23981.body
{
if(ib==null)
return;
Menge<Method> methods=ib.MethodVektor;
// Alle Methoden durchgehen
for(int i=0;i<methods.size();i++){
Method method=methods.get(i);
method.wandleRefTypeAttributes2GenericAttributes(paralist);
}
for(int i=0;i<ib.ConstantVektor.size();i++){
Constant instVar=(Constant)ib.ConstantVektor.get(i);
Type type=instVar.getType();
// Nur wenn es sich um ein RefType-Field handelt
if(type instanceof RefType){
GenericTypeVar pendant=ClassHelper.findGenericType(type,paralist,null);
if(pendant!=null){ //Wenn generisch, dann modifizieren
instVar.setType(pendant);
}
}
}
}
// ino.end
}
// ino.end
*/

View File

@ -1,100 +0,0 @@
// ino.module.InterfaceBody.8583.package
package de.dhbwstuttgart.syntaxtree;
// ino.end
// ino.module.InterfaceBody.8583.import
import de.dhbwstuttgart.typeinference.Menge;
import de.dhbwstuttgart.syntaxtree.modifier.Modifiers;
// ino.class.InterfaceBody.23984.description type=javadoc
/**
* Die Klasse enthaelt den Inhalt eines Interfaces, also Konstanten-
* und Mehtodendefinitionen.
* @author SCJU
*
*/
// ino.end
// ino.class.InterfaceBody.23984.declaration
public class InterfaceBody
// ino.end
// ino.class.InterfaceBody.23984.body
{
// ino.attribute.ConstantVektor.23987.declaration
protected Menge<Constant> ConstantVektor = new Menge<Constant>();
// ino.end
// ino.attribute.MethodVektor.23990.declaration
protected Menge<Method> MethodVektor = new Menge<Method>();
// ino.end
// ino.method.InterfaceBody.23993.defdescription type=line
// Konstruktoren
// ino.end
// ino.method.InterfaceBody.23993.definition
public InterfaceBody()
// ino.end
// ino.method.InterfaceBody.23993.body
{
}
// ino.end
// ino.method.addElement.23996.defdescription type=javadoc
/**
* Fuegt ein neues Element (Konstantendefinition oder abstrakte
* Methode) ein.
*/
// ino.end
// ino.method.addElement.23996.definition
public void addElement(Field fd)
// ino.end
// ino.method.addElement.23996.body
{
if (fd instanceof Constant) {
ConstantVektor.addElement((Constant) fd);
} else if (fd instanceof Method) {
MethodVektor.addElement((Method) fd);
}
}
// ino.end
// ino.method.getConstantVektor.23999.definition
public Menge<Constant> getConstantVektor()
// ino.end
// ino.method.getConstantVektor.23999.body
{
return ConstantVektor;
}
// ino.end
// ino.method.setConstantVektor.24002.definition
public void setConstantVektor(Menge<Constant> constantVektor)
// ino.end
// ino.method.setConstantVektor.24002.body
{
ConstantVektor = constantVektor;
}
// ino.end
// ino.method.getMethodVektor.24005.definition
public Menge<Method> getMethodVektor()
// ino.end
// ino.method.getMethodVektor.24005.body
{
return MethodVektor;
}
// ino.end
// ino.method.setMethodVektor.24008.definition
public void setMethodVektor(Menge<Method> methodVektor)
// ino.end
// ino.method.setMethodVektor.24008.body
{
MethodVektor = methodVektor;
}
// ino.end
}
// ino.end

View File

@ -2,55 +2,34 @@
package de.dhbwstuttgart.syntaxtree;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import org.apache.bcel.Constants;
import org.apache.bcel.classfile.Signature;
import org.apache.bcel.generic.ClassGen;
import org.apache.bcel.generic.ConstantPoolGen;
import org.apache.bcel.generic.InstructionFactory;
import org.apache.bcel.generic.InstructionHandle;
import org.apache.bcel.generic.InstructionList;
import org.apache.bcel.generic.MethodGen;
import de.dhbwstuttgart.typeinference.Menge;
import de.dhbwstuttgart.typeinference.Menge.Equal;
import de.dhbwstuttgart.logger.Logger;
import de.dhbwstuttgart.logger.Section;
import de.dhbwstuttgart.bytecode.ClassGenerator;
import de.dhbwstuttgart.bytecode.DHBWConstantPoolGen;
import de.dhbwstuttgart.bytecode.DHBWInstructionFactory;
import de.dhbwstuttgart.bytecode.MethodGenerator;
import de.dhbwstuttgart.core.IItemWithOffset;
import de.dhbwstuttgart.core.MyCompiler;
import de.dhbwstuttgart.parser.JavaClassName;
import de.dhbwstuttgart.syntaxtree.misc.DeclId;
import de.dhbwstuttgart.typecheck.JavaClassName;
import de.dhbwstuttgart.syntaxtree.modifier.Modifiers;
import de.dhbwstuttgart.syntaxtree.modifier.Static;
import de.dhbwstuttgart.syntaxtree.statement.Block;
import de.dhbwstuttgart.syntaxtree.statement.Return;
import de.dhbwstuttgart.syntaxtree.statement.Statement;
import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar;
import de.dhbwstuttgart.syntaxtree.type.RefType;
import de.dhbwstuttgart.syntaxtree.type.Type;
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
import de.dhbwstuttgart.typeinference.ConstraintsSet;
import de.dhbwstuttgart.typeinference.JavaCodeResult;
import de.dhbwstuttgart.typeinference.ResultSet;
import de.dhbwstuttgart.typeinference.TypeInsertable;
import de.dhbwstuttgart.typeinference.TypeinferenceResultSet;
import de.dhbwstuttgart.typeinference.TypeinferenceResults;
import de.dhbwstuttgart.typeinference.UndConstraint;
import de.dhbwstuttgart.typeinference.assumptions.MethodAssumption;
import de.dhbwstuttgart.typeinference.assumptions.ParameterAssumption;
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException;
import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertPoint;
// ino.class.Method.23482.declaration
/**
@ -67,33 +46,38 @@ public class Method extends Field implements IItemWithOffset, TypeInsertable
public ParameterList parameterlist = new ParameterList();
private ExceptionList exceptionlist;
private Type returntype;
private String name;
private int overloadedID;
private boolean isAbstract = false;
private Menge<String> types_in_parameterlist = new Menge<String>();
private int m_LineNumber = MyCompiler.NO_LINENUMBER;
private int m_Offset = -1; // hinzugef�gt hoth: 07.04.2006
private Modifiers modifiers;
protected static Logger inferencelog = Logger.getLogger("inference");
protected static Logger parserlog = Logger.getLogger("parser");
public Method(int offset) {
super(offset);
/**
*
* @param name
* @param returnType
* @param params
* @param block - use null to create abstract method
* @param offset
*/
public Method(String name, Type returnType, ParameterList params, Block block, int offset) {
this(name, returnType, params, new ExceptionList(), block, offset);
}
public Method(String name, Type returnType, ParameterList params, ExceptionList exceptions, Block block, int offset){
super(name, generateMethodType(returnType, params), offset);
}
public Method(String name, Type returnType, ParameterList parameterList, Block block,
GenericDeclarationList gtvDeclarations, int offset) {
this(offset);
/*
* if(parameterList != null)parameterList.parserPostProcessing(this);
* if(block != null)block.parserPostProcessing(this); if(gtvDeclarations
* != null)gtvDeclarations.parserPostProcessing(this);
*/
this.set_Method_Name(name);
this.setParameterList(parameterList);
this.set_Block(block);
this.name = name;
this.parameterlist = parameterList;
this.block = block;
this.setGenericParameter(gtvDeclarations);
this.setReturnType(returnType);
this.returntype = returnType;
}
public JavaClassName getTypeName()
@ -110,41 +94,6 @@ public class Method extends Field implements IItemWithOffset, TypeInsertable
return block;
}
/**
* <br/>
* Author: Jrg Buerle
*
* @param type
*/
private void setReturnType(Type type)
{
this.returntype = type;
}
public void set_Block(Block blo)
{
if (blo.getType() == null)
blo.setType(this.returntype);
this.block = blo;
}
public void set_Modifiers(Modifiers modif)
{
declid.firstElement().set_Modifiers(modif);
this.modifiers = modif;
}
public void set_ExceptionList(ExceptionList exlist)
{
this.exceptionlist = exlist;
}
public void setParameterList(ParameterList paralist)
{
this.parameterlist = paralist;
}
public ParameterList getParameterList()
{
return this.parameterlist;
@ -180,10 +129,9 @@ public class Method extends Field implements IItemWithOffset, TypeInsertable
this.overloadedID = overloadedID;
}
public String get_Method_Name()
public String get_Name()
{
DeclId hilf = declid.elementAt(0);
return hilf.get_Name();
return name;
}
public Menge get_Type_Paralist()
@ -208,7 +156,7 @@ public class Method extends Field implements IItemWithOffset, TypeInsertable
public int getVariableLength()
{
return get_Method_Name().length();
return get_Name().length();
}
public void setOffset(int Offset)
@ -255,16 +203,6 @@ public class Method extends Field implements IItemWithOffset, TypeInsertable
return isAbstract;
}
@Override
public void wandleRefTypeAttributes2GenericAttributes(Menge<Type> classParalist) {
}
public void set_Method_Name(String string) {
if (declid.size() == 0)
declid.add(0, new DeclId(string));
declid.set(0, new DeclId(string));
}
public ConstraintsSet TYPE(TypeAssumptions ass) {
ConstraintsSet ret = new ConstraintsSet();
TypeAssumptions localAss = new TypeAssumptions();
@ -282,8 +220,6 @@ public class Method extends Field implements IItemWithOffset, TypeInsertable
// Die Parameter zu den Assumptions hinzufügen:
if (this.parameterlist != null)
for (FormalParameter param : this.parameterlist) {
param.setType(param.getType().checkTYPE(localAss, this));
localAss.addAssumption(new ParameterAssumption(param));
}
ret.add(this.block.TYPEStmt(localAss));
@ -310,7 +246,7 @@ public class Method extends Field implements IItemWithOffset, TypeInsertable
public JavaCodeResult printJavaCode(ResultSet resultSet) {
JavaCodeResult ret = new JavaCodeResult();
ret.attach(this.getType().printJavaCode(resultSet)).attach(" ")
.attach(this.get_Method_Name()).attach("(")
.attach(this.get_Name()).attach("(")
.attach(this.getParameterList().printJavaCode(resultSet))
.attach(")\n");
ret.attach(this.block.printJavaCode(resultSet));
@ -329,15 +265,6 @@ public class Method extends Field implements IItemWithOffset, TypeInsertable
return ret;
}
@Override
public void parserPostProcessing(SyntaxTreeNode parent) {
if (this.getType() == null)
this.setType(TypePlaceholder.fresh(this));
if (this.returntype == null)
this.returntype = TypePlaceholder.fresh(this);
super.parserPostProcessing(parent);
}
@Override
public Menge<SyntaxTreeNode> getChildren() {
Menge<SyntaxTreeNode> ret = new Menge<SyntaxTreeNode>();
@ -348,15 +275,6 @@ public class Method extends Field implements IItemWithOffset, TypeInsertable
return ret;
}
@Override
public void setType(Type t) {
// Methode und Block teilen sich einen ReturnType:
// this.block.setType(t);
this.returntype = t;
this.returntype.parent = this; // TODO: Dieser Hack sollte nicht
// tig sein. (Parser ändern)
}
/**
* Der Typ einer Methode ist ihr Returntype
*/
@ -365,14 +283,14 @@ public class Method extends Field implements IItemWithOffset, TypeInsertable
// Methode und Block teilen sich einen ReturnType:
return this.returntype;
}
public static Method createEmptyMethod(Block withBlock, String withSignature, Class parent) {
public static Method createEmptyMethod(Block withBlock, String withSignature) {
Method ret = Method.createEmptyMethod(withSignature, parent);
ret.set_Block(withBlock);
return ret;
}
public static Method createEmptyMethod(String withSignature, Class parent) {
Method ret = new Method(0);
DeclId DImethod = new DeclId();
public static Method createEmptyMethod(String withSignature) {
Block block = new Block(new List<Statement>());
Method ret = new Method(withSignature, new de.dhbwstuttgart.syntaxtree.type.Void(0), new ParameterList(), block, new EmptyGenericDeclarationList(), 0);
DImethod.set_Name(withSignature);
ret.set_DeclId(DImethod);
Block tempBlock = new Block();
@ -403,11 +321,16 @@ public class Method extends Field implements IItemWithOffset, TypeInsertable
DHBWInstructionFactory _factory = cg.getInstructionFactory();
for(TypeinferenceResultSet t: typeInterferenceResults){
addMethodToClassGenerator(cg, _factory, t);
addMethodToClassGenerator(cg, _factory, t, classObj);
}
}
<<<<<<< HEAD
private void addMethodToClassGenerator(ClassGenerator cg, DHBWInstructionFactory _factory, TypeinferenceResultSet t, Class parentClass) {
=======
private void addMethodToClassGenerator(ClassGenerator cg, DHBWInstructionFactory _factory, TypeinferenceResultSet t) {
>>>>>>> refactoring
DHBWConstantPoolGen _cp = cg.getConstantPool();
InstructionList il = new InstructionList();
@ -424,9 +347,14 @@ public class Method extends Field implements IItemWithOffset, TypeInsertable
Type returnType = this.getType();
MethodGenerator method = new MethodGenerator(constants, returnType.getBytecodeType(cg, t),
<<<<<<< HEAD
argumentTypes.toArray(new org.apache.bcel.generic.Type[parameterlist.size()])
, argumentNames.toArray(new String[parameterlist.size()]), this.get_Name(), parentClass.name.toString(), il, _cp);
=======
argumentTypes.toArray(new org.apache.bcel.generic.Type[parameterlist.size()]) ,
argumentNames.toArray(new String[parameterlist.size()]), this.get_Method_Name(),
getParentClass().name.toString(), il, _cp);
>>>>>>> refactoring
cg.setMethodeGenerator(method);

View File

@ -1,26 +0,0 @@
package de.dhbwstuttgart.syntaxtree;
import de.dhbwstuttgart.typeinference.Menge;
/**
* Dieser SyntaxTreeNode kann anstelle von null in einem Syntaxbaum eingesetzt werden.
* Vorsicht: Als Offset wird dann immer 0 zurück gegeben.
*/
public class NullSyntaxTreeNode extends SyntaxTreeNode {
@Override
public int getOffset() {
return 0;
}
@Override
public int getVariableLength() {
return 0;
}
@Override
public Menge<? extends SyntaxTreeNode> getChildren() {
return new Menge<>();
}
}

View File

@ -1,11 +1,10 @@
// ino.module.ParameterList.8565.package
package de.dhbwstuttgart.syntaxtree;
// ino.end
// ino.module.ParameterList.8565.import
import de.dhbwstuttgart.typeinference.Menge;
import java.util.Iterator;
import java.util.List;
import de.dhbwstuttgart.bytecode.ClassGenerator;
import de.dhbwstuttgart.syntaxtree.type.RefType;
@ -13,79 +12,36 @@ import de.dhbwstuttgart.typeinference.JavaCodeResult;
import de.dhbwstuttgart.typeinference.ResultSet;
import de.dhbwstuttgart.typeinference.TypeinferenceResultSet;
// ino.end
// ino.class.ParameterList.23620.declaration
public class ParameterList extends SyntaxTreeNode implements Iterable<FormalParameter>
// ino.end
// ino.class.ParameterList.23620.body
{
// ino.attribute.formalparameter.23623.declaration
public Menge<FormalParameter> formalparameter = new Menge<FormalParameter>();
// ino.end
public List<FormalParameter> formalparameter = new Menge<FormalParameter>();
// ino.method.set_AddParameter.23626.definition
public void set_AddParameter(FormalParameter fp)
// ino.end
// ino.method.set_AddParameter.23626.body
{
formalparameter.addElement(fp);
public ParameterList(List<FormalParameter> params){
this.formalparameter = params;
}
// ino.end
// ino.method.getParameterAt.23632.definition
public FormalParameter getParameterAt(int i)
// ino.end
// ino.method.getParameterAt.23632.body
{
if (i >= formalparameter.size() ) return null;
return formalparameter.elementAt(i);
return formalparameter.get(i);
}
// ino.end
// ino.method.sc_get_Formalparalist.23635.definition
public Menge<FormalParameter> sc_get_Formalparalist()
// ino.end
// ino.method.sc_get_Formalparalist.23635.body
public List<FormalParameter> sc_get_Formalparalist()
{
return formalparameter;
}
// ino.end
// ino.method.getParameterCount.23641.defdescription type=javadoc
/**
* Author: ¯Â¿Â½rg ¯Â¿Â½uerle<br/>
* @return Die Anzahl der Parameter
*/
// ino.end
// ino.method.getParameterCount.23641.definition
public int getParameterCount()
// ino.end
// ino.method.getParameterCount.23641.body
{
return formalparameter.size();
}
// ino.end
/**
* @author Andreas Stadelmeier, a10023
* @return Die Typinformationen der Parameter in der Parameterliste
*/
public String getTypeInformation() {
String ret = "";
for(FormalParameter param : this.formalparameter){
ret += param.getTypeInformation();
}
return ret;
}
public String toString(){
if(formalparameter == null)return "[]"; //"Leere Parameterliste";
@ -129,16 +85,11 @@ public class ParameterList extends SyntaxTreeNode implements Iterable<FormalPara
@Override
public int getOffset() {
if(formalparameter == null || formalparameter.size()==0)return 0;
return formalparameter.firstElement().getOffset();
}
@Override
public int getVariableLength() {
return 0;
return formalparameter.get(0).getOffset();
}
@Override
public Menge<? extends SyntaxTreeNode> getChildren() {
public List<? extends SyntaxTreeNode> getChildren() {
return formalparameter;
}
@ -167,4 +118,3 @@ public class ParameterList extends SyntaxTreeNode implements Iterable<FormalPara
}
}
// ino.end

View File

@ -1,51 +1,27 @@
// ino.module.SourceFile.8722.package
package de.dhbwstuttgart.syntaxtree;
// ino.end
// ino.module.SourceFile.8722.import
import java.io.IOException;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.function.Function;
import de.dhbwstuttgart.typeinference.Menge;
import de.dhbwstuttgart.typeinference.*;
import java.util.stream.Stream;
import de.dhbwstuttgart.logger.Logger;
import de.dhbwstuttgart.logger.Section;
import de.dhbwstuttgart.core.AClassOrInterface;
import de.dhbwstuttgart.core.MyCompiler;
import de.dhbwstuttgart.parser.JavaClassName;
import de.dhbwstuttgart.typecheck.JavaClassName;
import de.dhbwstuttgart.syntaxtree.factory.UnifyTypeFactory;
import de.dhbwstuttgart.syntaxtree.misc.DeclId;
import de.dhbwstuttgart.syntaxtree.misc.UsedId;
import de.dhbwstuttgart.syntaxtree.modifier.Modifiers;
import de.dhbwstuttgart.syntaxtree.modifier.Public;
import de.dhbwstuttgart.syntaxtree.type.FunN;
import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar;
import de.dhbwstuttgart.syntaxtree.type.RefType;
import de.dhbwstuttgart.syntaxtree.type.Type;
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
import de.dhbwstuttgart.syntaxtree.type.Void;
import de.dhbwstuttgart.typeinference.ByteCodeResult;
import de.dhbwstuttgart.typeinference.ConstraintsSet;
import de.dhbwstuttgart.typeinference.FunNInterface;
import de.dhbwstuttgart.typeinference.Pair;
import de.dhbwstuttgart.typeinference.ResultSet;
import de.dhbwstuttgart.typeinference.TypeinferenceResultSet;
import de.dhbwstuttgart.typeinference.TypeinferenceResults;
import de.dhbwstuttgart.typeinference.UnifyConstraintsSet;
import de.dhbwstuttgart.typeinference.assumptions.ClassAssumption;
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
import de.dhbwstuttgart.typeinference.exceptions.DebugException;
import de.dhbwstuttgart.typeinference.exceptions.NotImplementedException;
import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException;
import de.dhbwstuttgart.typeinference.unify.TypeUnify;
import de.dhbwstuttgart.typeinference.unify.Unifikationsalgorithmus;
@ -55,148 +31,25 @@ import de.dhbwstuttgart.typeinference.unify.model.UnifyPair;
public class SourceFile
extends SyntaxTreeNode
public class SourceFile extends SyntaxTreeNode
{
// ino.attribute.LOAD_BASIC_ASSUMPTIONS_FROM_JRE.21358.decldescription type=javadoc
/**
* @autor HOTI
* Dieses Flag bestimmt, ob die basicAssumptions (Integer, Menge, ...) direkt von
* der Java-Laufzeitumgebung anhand der Imports oder von den "Fixed Hacks" geladen
* werden (Mit Fixed Hacks sind die von Hand eingetragene Basetypes gemeint)
*/
// ino.end
// ino.attribute.LOAD_BASIC_ASSUMPTIONS_FROM_JRE.21358.declaration
private static final boolean LOAD_BASIC_ASSUMPTIONS_FROM_JRE = true;
// ino.end
// ino.attribute.READ_OBJECT_SUPERCLASSES_FROM_JRE.21361.decldescription type=javadoc
/**
* @autor HOTI
* Wenn dieses Flag auf <b>true</b> gesetzt ist, wird immer als Superklasse Object
* mit rein geladen. Dies hat natürlich zur Folge, dass man in der GUI jeden Typ
* auswählen muss, weil ALLES in Java von Object erbt. Sobald die GUI das über eine
* Checkbox o.ä. ausblendbar macht kann es aktiviert werden. Ebenso beeinflusst es
* die superclass von allen Class-Objekten. (Wenn true ist jede Class automatisch
* wenn nicht anders eingegeben Subclass von Object (Wie es sein muss))
*/
// ino.end
// ino.attribute.READ_OBJECT_SUPERCLASSES_FROM_JRE.21361.declaration
public static final boolean READ_OBJECT_SUPERCLASSES_FROM_JRE = false;
// ino.end
// ino.attribute.READ_BASE_TYPE_SUPERCLASSES_FROM_JRE.21364.decldescription type=javadoc
/**
* Wenn dieses Flag auf <b>false</b> ist, werden ¼r alle Basisklassen (definiert
* durch die Hashtable baseTypeTranslationTable) KEINE Superklassen geladen. D.h.
* Integer hat bspw. nicht die Superklasse Number sondern OBJECT.
* Dies verursacht bei den Int-Operationen ein Problem
* (+,-,*,/,<,>,...)
*/
// ino.end
// ino.attribute.READ_BASE_TYPE_SUPERCLASSES_FROM_JRE.21364.declaration
private static final boolean READ_BASE_TYPE_SUPERCLASSES_FROM_JRE = false;
// ino.end
/**
* @autor PL
* Wenn dieses Flag auf <b>false</b> ist, werden ¼r alle importierten Klassen
* KEINE Superklassen geladen.
*/
private static final boolean READ_IMPORTED_SUPERCLASSES_FROM_JRE = false;
// ino.attribute.codegenlog.21367.decldescription type=line
// Logger fuer Code-Gen
// ino.end
// ino.attribute.codegenlog.21367.declaration
protected static Logger codegenlog = Logger.getLogger("codegen");
// ino.end
// ino.attribute.inferencelog.21370.declaration
protected static Logger inferencelog = Logger.getLogger("inference");
// ino.end
// ino.attribute.pkgName.21373.declaration
private UsedId pkgName;
// ino.end
// ino.attribute.KlassenVektor.21376.declaration
public Menge<Class> KlassenVektor = new Menge<Class>();
// ino.end
// ino.attribute.InterfaceVektor.21379.declaration
public Menge<Interface> InterfaceVektor = new Menge<Interface>();
// ino.end
private String pkgName;
public List<Class> KlassenVektor = new Menge<Class>();
private List<JavaClassName> imports;
/**
* Die SourceFile repräsntiert eine zu einem Syntaxbaum eingelesene Java-Datei.
* SourceFile stellt dabei den Wurzelknoten des Syntaxbaumes dar.
*/
public SourceFile(){
// HOTI 4.5.06
// Base-Type-Translations anlegen (siehe kommentar BaseTypeTranslationTable)
baseTypeTranslationTable=new Hashtable<String,String>();
baseTypeTranslationTable.put("int","java.lang.Integer");
baseTypeTranslationTable.put("char","java.lang.Character");
baseTypeTranslationTable.put("boolean","java.lang.Boolean");
baseTypeTranslationTable.put("double","java.lang.Double");
baseTypeTranslationTable.put("long","java.lang.Long");
baseTypeTranslationTable.put("float","java.lang.Float");
//baseTypeTranslationTable.put("this.is.a.temporary.entry","de.dhbwstuttgart.typeinference.Menge"); auskommentiert PL 07-08-11
this.imports=new ImportDeclarations();
this.imports.add(UsedId.createFromQualifiedName("java.lang.Integer",-1));
this.imports.add(UsedId.createFromQualifiedName("java.lang.String",-1));
this.imports.add(UsedId.createFromQualifiedName("java.lang.Character",-1));
this.imports.add(UsedId.createFromQualifiedName("java.lang.Boolean",-1));
this.imports.add(UsedId.createFromQualifiedName("java.lang.Double",-1));
this.imports.add(UsedId.createFromQualifiedName("java.lang.Float",-1));
this.imports.add(UsedId.createFromQualifiedName("java.lang.Long",-1));
//this.imports.add(UsedId.createFromQualifiedName("java.lang.Byte"));
// HOTI 4.5.06 Wenn die Klassen immer als "Daddy" Object haben,
// muss das der JCC auch kennen
if(READ_OBJECT_SUPERCLASSES_FROM_JRE){
this.imports.add(UsedId.createFromQualifiedName("java.lang.Object",-1));
}
}
public SourceFile(Menge<Class> classDefinitions) {
this.KlassenVektor = classDefinitions;
public SourceFile(List<Class> classDefinitions) {
this.KlassenVektor = classDefinitions;
}
/**
* HOTI 4.5.06
* Beinhaltet alle Imports des aktuell geparsten Files
* in Form einer UsedId
*/
private ImportDeclarations imports=new ImportDeclarations();
/**
* Table zum Übersetzen der nicht implementierten Base-Types:
* Überall im Compiler wird statt bspw. int Integer verwendet
* d.h. 1+2 liefert ein Integer
* Deshalb benÃtigen wir hier eine Tabelle, mit der man die von
* der JRE gelieferten Base-Typen (int,char, etc) und die Objekt-
* Typen umwandeln nnen
*/
private Hashtable<String,String> baseTypeTranslationTable;
/**
* Fuegt ein neues Element (Interface oder Klasse) hinzu.
* @param c
*/
public void addElement(AClassOrInterface e)
{
if (e instanceof Class) {
KlassenVektor.addElement((Class) e);
} else if (e instanceof Interface) {
InterfaceVektor.addElement((Interface) e);
}
}
/**
* PL 2014-10-25
* schnitt1 checkt ob die Typeplaceholders aus in den Elemeneten aus vars enthalten sind
@ -316,7 +169,6 @@ public class SourceFile
/////////////////////////////////////////////////////////////////////////
// TypeReconstructionAlgorithmus
/////////////////////////////////////////////////////////////////////////
// ino.method.typeReconstruction.21406.defdescription type=javadoc
/**
* Tyrekonstruktionsalgorithmus: ruft ¯Â¿Â½r jede Klasse den Algorithmus TRProg auf.
* Dessen Ergebnismenge A, die Menge aller Typannahmen, ¯Â¿Â½r eine Klasse dient als
@ -326,11 +178,7 @@ public class SourceFile
* @return Liste aller ¯Â¿Â½glichen Typkombinationen
* @throws CTypeReconstructionException Wenn was schief ¯Â¿Â½uft
*/
// ino.end
// ino.method.typeReconstruction.21406.definition
public Menge<TypeinferenceResultSet> typeReconstruction(TypeAssumptions globalAssumptions)
// ino.end
// ino.method.typeReconstruction.21406.body
{
Menge<TypeinferenceResultSet> ret = new Menge<TypeinferenceResultSet>();
@ -458,177 +306,13 @@ public class SourceFile
* @param imports
* @param withSuptypes - Gibt an, ob auch die subklassen der Packages den Assumptions angefügt werden sollen.
* @return
* TODO: Diese Methode neu erstellen
*/
public TypeAssumptions makeBasicAssumptionsFromJRE(Menge<UsedId> imports, boolean withSubtypes)
public TypeAssumptions makeBasicAssumptionsFromJRE(List<JavaClassName> imports, boolean withSubtypes)
// ino.end
// ino.method.makeBasicAssumptionsFromJRE.21409.body
{
//return null;
///*
Menge<UsedId> doneImports=new Menge<UsedId>();
//TypeinferenceResultSet basicAssumptions = new TypeinferenceResultSet(null);
TypeAssumptions basicAssumptions = new TypeAssumptions();
Modifiers mod = new Modifiers();
mod.addModifier(new Public());
//¼r Object:
imports.add(new UsedId("java.lang.Object",-1));
// ¼r jede einzelne Klasse
while (imports.size()>0) {
UsedId importDecl = imports.get(0);
// Properties laden
java.lang.Class<?> x;
try {
x = java.lang.Class.forName(importDecl.getQualifiedName().toString());
} catch (ClassNotFoundException e) {
throw new TypeinferenceException("Fehlerhafte Import-Declaration: "+e.getMessage(),this);
}
java.lang.reflect.Field[] fields=x.getDeclaredFields();
java.lang.reflect.Method[] methods=x.getDeclaredMethods();
java.lang.reflect.Constructor[] constructors=x.getConstructors();
java.lang.reflect.TypeVariable[] tvs=x.getTypeParameters();
//String className=x.getSimpleName();
String className=x.getName();
//Ermittle die Superklasse:
Class sClass = new Class("Object",0);
if(withSubtypes)sClass = getSuperClassOfJREClass(x, basicAssumptions);
// Namen von Generische Typen erzeugen
Hashtable<String,GenericTypeVar> jreSpiderRegistry=new Hashtable<String,GenericTypeVar>();
Menge<String> typeGenPara = new Menge<String>();
for(int j=0;j<tvs.length;j++){
//GenericTypeVar gtv=new GenericTypeVar(tvs[j].getName(), parentClass,-1);
typeGenPara.addElement(tvs[j].getName());
//jreSpiderRegistry.put(tvs[j].getName(),gtv);
}
Class parentClass = new Class(className, sClass.getType(),mod, typeGenPara);
//BasicAssumptionClass myCl = new BasicAssumptionClass(className, mod);
for(GenericTypeVar classParam : parentClass.getGenericParameter()){
jreSpiderRegistry.put(classParam.getName().toString(),classParam);
}
if(typeGenPara.size()>0){
//auskommentiert von Andreas Stadelmeier:
//basicAssumptions.addGenericTypeVars(className, typeGenPara);
//parentClass.set_ParaList((Menge)typeGenPara);//myCl.set_ParaList((Menge)typeGenPara);
}
if(x.getSuperclass()!=null){
//boolean isObject=x.getSuperclass().getSimpleName().equalsIgnoreCase("Object");
boolean isObject=x.getSuperclass().getName().equalsIgnoreCase("java.lang.Object");
boolean isBaseType=isBaseType(className);
//if((!isObject || READ_OBJECT_SUPERCLASSES_FROM_JRE) && (!isBaseType|| READ_BASE_TYPE_SUPERCLASSES_FROM_JRE))
if (((!isObject || READ_OBJECT_SUPERCLASSES_FROM_JRE) && READ_IMPORTED_SUPERCLASSES_FROM_JRE) //eingefuegt 07-08-11
|| (isBaseType && READ_BASE_TYPE_SUPERCLASSES_FROM_JRE))
{
String superclassFullyQualifiedName = x.getSuperclass().getCanonicalName();
//Andere Methode, da Menge.contains bei Strings nicht richtig vergleicht.
if(!containsString(imports,superclassFullyQualifiedName) && !containsString(doneImports,superclassFullyQualifiedName)){
imports.addElement(UsedId.createFromQualifiedName(superclassFullyQualifiedName,-1));
}
//UsedId ui = new UsedId();
//ui.set_Name(x.getSuperclass().getSimpleName());
UsedId ui=UsedId.createFromQualifiedName(x.getSuperclass().getName(),-1);
java.lang.Class superClass=x.getSuperclass();
java.lang.reflect.TypeVariable[] superclassTVS=superClass.getTypeParameters();
Menge<Type> supertypeGenPara = new Menge<Type>();
for(int tvi=0;tvi<superclassTVS.length;tvi++){
GenericTypeVar newGTV=new GenericTypeVar(superclassTVS[tvi].getName(),parentClass,-1);
supertypeGenPara.addElement(newGTV);
}
if(supertypeGenPara.size()==0){
supertypeGenPara=null;
}
ui.set_ParaList(supertypeGenPara);
ui.vParaOrg=supertypeGenPara;
parentClass.set_UsedId(ui);
}
}
//auskommentiert von Andreas Stadelmeier
//this.addElement(myCl);
//basicAssumptions.addClassName(className);
for(int j=0;j<fields.length;j++){
if(java.lang.reflect.Modifier.isPublic(fields[j].getModifiers())){
parentClass.addField(new FieldDeclaration(fields[j].getName(),new RefType(fields[j].getType().getName(),parentClass,-1)));
}
}
for(int j=0;j<methods.length;j++){
if(java.lang.reflect.Modifier.isPublic(methods[j].getModifiers())){
String methodName=methods[j].getName();
//if(methodName.equals("add")){
java.lang.reflect.Type genericReturnType=methods[j].getGenericReturnType();
Type returnType=createTypeFromJavaGenericType(genericReturnType,methods[j].getReturnType(),jreSpiderRegistry, parentClass);
java.lang.reflect.Type[] gpt=methods[j].getGenericParameterTypes();
java.lang.Class[] pt=methods[j].getParameterTypes();
//CMethodTypeAssumption method = new CMethodTypeAssumption(new RefType(className, 0), methodName, returnType, pt.length,MyCompiler.NO_LINENUMBER,MyCompiler.NO_LINENUMBER,new Menge<Integer>(),null);
Method method = de.dhbwstuttgart.syntaxtree.Method.createEmptyMethod(methodName, parentClass);
method.setType(returnType);
ParameterList parameterList = new ParameterList();
for(int k=0;k<gpt.length;k++){
Type type=createTypeFromJavaGenericType(gpt[k],pt[k],jreSpiderRegistry, parentClass);
// Fixme HOTI beachte overloaded id
//method.addParaAssumption(new CParaTypeAssumption(className, methodName, pt.length,0,type.getName(), type, MyCompiler.NO_LINENUMBER,MyCompiler.NO_LINENUMBER,new Menge<Integer>()));
FormalParameter parameter = new FormalParameter(new DeclId(type.get_Name()));
parameter.setType(type);
parameterList.formalparameter.add(parameter);
}
method.setParameterList(parameterList);
//basicAssumptions.addMethodIntersectionType(new CIntersectionType(method));
parentClass.addField(method);
//}
}
}
for(int j=0;j<constructors.length;j++){
String methodName=className;
Method constructorMethod = de.dhbwstuttgart.syntaxtree.Method.createEmptyMethod(methodName, parentClass);
if(java.lang.reflect.Modifier.isPublic(constructors[j].getModifiers())){
ParameterList paraList = new ParameterList();
for(int k=0;k<constructors[j].getParameterTypes().length;k++){
String paraType=constructors[j].getParameterTypes()[k].getName();
//String paraType=constructors[j].getParameterTypes()[k].getSimpleName();
// Fixme HOTI beachte overloaded id
FormalParameter fpara = new FormalParameter(new DeclId("p"+k));
fpara.setType(new RefType(paraType,constructorMethod,-1));
paraList.formalparameter.add(fpara);
}
//basicAssumptions.addMethodIntersectionType(new CIntersectionType(constructor));
constructorMethod.parameterlist = paraList;
Constructor constructor = new Constructor(constructorMethod, parentClass);
constructor.parserPostProcessing(parentClass);
parentClass.addField(constructor);
}
}
basicAssumptions.add(parentClass.getPublicFieldAssumptions());
basicAssumptions.addClassAssumption(new ClassAssumption(parentClass));
imports.removeElement(importDecl);
doneImports.addElement(importDecl);
}
imports.addAll(doneImports);
return basicAssumptions;
//*/
return null;
}
// ino.end
@ -761,25 +445,10 @@ public class SourceFile
}
// ino.end
// ino.method.addImports.21433.definition
public void addImports(ImportDeclarations imports)
// ino.end
// ino.method.addImports.21433.body
{
this.imports.addAll(imports);
}
// ino.end
// ino.method.getImports.21436.definition
public ImportDeclarations getImports()
// ino.end
// ino.method.getImports.21436.body
{
if(imports==null){
return(new ImportDeclarations());
}
return(imports);
}
// ino.end
// ino.method.getClassIterator.21439.definition
@ -837,6 +506,11 @@ public class SourceFile
return 0;
}
@Override
public JavaCodeResult printJavaCode(ResultSet resultSet) {
throw new NotImplementedException();
}
@Override
public int getVariableLength() {
// TODO Auto-generated method stub

View File

@ -1,7 +1,10 @@
package de.dhbwstuttgart.syntaxtree;
import java.util.List;
import org.apache.bcel.generic.ClassGen;
import de.dhbwstuttgart.typeinference.JavaCodeResult;
import de.dhbwstuttgart.typeinference.Menge;
import de.dhbwstuttgart.bytecode.ClassGenerator;
import de.dhbwstuttgart.core.IItemWithOffset;
@ -21,7 +24,12 @@ import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertSet;
public abstract class SyntaxTreeNode implements IItemWithOffset{
protected SyntaxTreeNode parent;
protected int offset;
public SyntaxTreeNode(int offset){
this.offset = offset;
}
/**
* Wird nach dem Parsen aufgerufen.
* Erfüllt folgenden Aufgaben:
@ -43,16 +51,8 @@ public abstract class SyntaxTreeNode implements IItemWithOffset{
return this.parent;
}
public abstract Menge<? extends SyntaxTreeNode> getChildren();
public Class getParentClass(){
SyntaxTreeNode parent = this.getParent();
if(parent instanceof Class)return (Class)parent;
if(parent == null)
throw new DebugException("Das Wurzelelement eines Syntaxbaumes muss Class sein");
return parent.getParentClass();
}
public abstract List<? extends SyntaxTreeNode> getChildren();
/**
* Eine Beschreibung/Name des SyntaxTree-Nodes
* Hat nichts mit der Description im Bytecode zu tun,
@ -113,11 +113,6 @@ public abstract class SyntaxTreeNode implements IItemWithOffset{
}
public boolean seesType(Type tA2) {
//TODO: Implementieren. Hier sollte ein Lookup in die Assumptions dieses Knotens erfolgen
return false;
}
public SyntaxTreeNode getMatchingParentNode(SyntaxTreeNode inNode) {
SyntaxTreeNode node = inNode;
while(node!=null){
@ -134,5 +129,9 @@ public abstract class SyntaxTreeNode implements IItemWithOffset{
return this.getParent().getGTVDeclarationContext();
}
public int getOffset(){
return offset;
}
public abstract JavaCodeResult printJavaCode(ResultSet resultSet);
}

View File

@ -1,58 +1,55 @@
package de.dhbwstuttgart.syntaxtree.factory;
import java.lang.reflect.Parameter;
import java.lang.reflect.TypeVariable;
import java.util.ArrayList;
import java.util.List;
import de.dhbwstuttgart.bytecode.ClassGenerator;
import de.dhbwstuttgart.parser.JavaClassName;
import de.dhbwstuttgart.typecheck.JavaClassName;
import de.dhbwstuttgart.typecheck.JavaClassRegistry;
import de.dhbwstuttgart.syntaxtree.*;
import de.dhbwstuttgart.syntaxtree.Class;
import de.dhbwstuttgart.syntaxtree.Constructor;
import de.dhbwstuttgart.syntaxtree.Field;
import de.dhbwstuttgart.syntaxtree.GenericDeclarationList;
import de.dhbwstuttgart.syntaxtree.Method;
import de.dhbwstuttgart.syntaxtree.ObjectClass;
import de.dhbwstuttgart.syntaxtree.ParameterList;
import de.dhbwstuttgart.syntaxtree.SourceFile;
import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;
import de.dhbwstuttgart.syntaxtree.misc.DeclId;
import de.dhbwstuttgart.syntaxtree.misc.UsedId;
import de.dhbwstuttgart.syntaxtree.modifier.Modifiers;
import de.dhbwstuttgart.syntaxtree.modifier.Public;
import de.dhbwstuttgart.syntaxtree.statement.Block;
import de.dhbwstuttgart.syntaxtree.statement.Statement;
import de.dhbwstuttgart.syntaxtree.statement.SuperCall;
import de.dhbwstuttgart.syntaxtree.type.RefType;
import de.dhbwstuttgart.syntaxtree.type.Type;
import de.dhbwstuttgart.typeinference.Menge;
import de.dhbwstuttgart.typeinference.ResultSet;
import de.dhbwstuttgart.typeinference.TypeinferenceResultSet;
public class ASTFactory {
public static Method createMethod(String name, ParameterList paralist, Block block, Class parent) {
Method method = new Method(0);
DeclId DImethod = new DeclId();
DImethod.set_Name(name);
method.set_DeclId(DImethod);
method.set_Block(block);
method.setParameterList(paralist);
block.parserPostProcessing(method);
method.parserPostProcessing(parent);
return method;
public class ASTFactory {
private final JavaClassRegistry names;
/**
* Anmerkung:
* Die ASTFactory Methoden, welche ASTBäume aus java.lang.Class Objekten generieren, können davon ausgehen,
* dass alle Imports und Typnamen korrekt sind und müssen diese nicht überprüfen.
*/
//private JavaClassRegistry names;
public ASTFactory(JavaClassRegistry scope){
names = scope;
}
public static Method createEmptyMethod(String withSignature, Class parent) {
return ASTFactory.createMethod(withSignature, new ParameterList(), new Block(), parent);
}
public static Constructor createEmptyConstructor(Class parent){
Block block = new Block();
block.setType(new de.dhbwstuttgart.syntaxtree.type.Void(block, 0));
block.statements.add(new SuperCall(block));
return ASTFactory.createConstructor(parent, new ParameterList(), block);
}
public static Constructor createConstructor(Class superClass, ParameterList paralist, Block block){
block.parserPostProcessing(superClass);
@ -62,7 +59,6 @@ public class ASTFactory {
return new Constructor(method, superClass);
}
/*
public static Class createClass(String className, RefType type, Modifiers modifiers, Menge supertypeGenPara, SourceFile parent) {
// TODO bytecode createClass
//String name, RefType superClass, Modifiers modifiers, Menge<String> supertypeGenPara
@ -73,7 +69,113 @@ public class ASTFactory {
return generatedClass;
}
*/
public static Class createObject(){
return createClass(java.lang.Object.class);
}
/**
*
* @param jreClass
* @return
*/
public Class createClass(java.lang.Class jreClass){
JavaClassName name = names.getName(jreClass.getName());
List<Method> methoden = new ArrayList<>();
for(java.lang.reflect.Constructor constructor : jreClass.getConstructors()){
}
for(java.lang.reflect.Method method : jreClass.getMethods()){
methoden.add(createMethod(method, jreClass));
}
List<Field> felder = new ArrayList<>();
Modifiers modifier = new Modifiers();
modifier.addModifier(new Public());
boolean isInterface = jreClass.isInterface();
java.lang.Class superjreClass = jreClass.getSuperclass();
RefType superClass = null;
if(superjreClass != null){
superClass = createType(superjreClass);
}else{//Jede Klasse und jedes Interface erbt von Object: (auch Object selbst!)
superClass = createType(java.lang.Object.class);
}
List<RefType> implementedInterfaces = new ArrayList<>();
for(java.lang.Class jreInterface : jreClass.getInterfaces()){
implementedInterfaces.add(createType(jreInterface));
}
int offset = 0; //Braucht keinen Offset, da diese Klasse nicht aus einem Quellcode geparst wurde
return new Class(name, methoden, felder, modifier, isInterface, superClass, implementedInterfaces, offset);
}
/**
* Wandelt eine Methode aus der JRE in eine Methode für unseren AST um.
* @param jreMethod
* @param inClass
* @return
*/
public Method createMethod(java.lang.reflect.Method jreMethod, java.lang.Class inClass){
String name = jreMethod.getName();
RefType returnType = createType(jreMethod.getReturnType());
Parameter[] jreParams = jreMethod.getParameters();
List<FormalParameter> params = new ArrayList<>();
for(Parameter jreParam : jreParams){
RefType paramType = createType(jreParam.getType());
params.add(new FormalParameter(jreParam.getName(),paramType,-1));
}
ParameterList parameterList = new ParameterList(params);
Block block = new Block(new ArrayList<Statement>(), -1);
List<GenericTypeVar> gtvs = new ArrayList<>();
for(TypeVariable jreTV : jreMethod.getTypeParameters()){
GenericTypeVar gtv = createGeneric(jreTV, inClass);
gtvs.add(gtv);
}
GenericDeclarationList gtvDeclarations = new GenericDeclarationList(gtvs,-1);
int offset = -1;
return new Method(name, returnType, parameterList, block, gtvDeclarations, offset);
}
public RefType createType(java.lang.Class jreClass){
List<RefType> params = new ArrayList<>();
for(TypeVariable jreTV : jreClass.getTypeParameters()){
RefType gtv = createType(jreTV);
params.add(gtv);
}
jreClass
return new RefType(jreClass.getName(), params, -1);
}
public RefType createType(java.lang.reflect.Type type){
RefType ret = new RefType(type.getTypeName(), -1);
//TODO hier die Generischen Variablen extrahieren
return ret;
}
/**
* Erstellt eine GenericTypeVar oder eine BoundedGenericTypeVar
* Um die Variablen korrekt zu generieren, muss die Klasse inClass übergeben werden, in der dieser Generic auftaucht
* TODO: Warum?
* Wird der AST von JREClass erzeugt, so kann davon ausgegangen werden, dass die Generics korrekt sind.
* Unser AST ist immutable und nicht im Kreis verzeigert. Generics die gleich heißen und gleiche Bounds haben, sind auch gleich. Müssen nicht die selben Instanzen sein.
* @param jreTypeVar
* @param inClass Die Klasse in der der Typ auftritt
* @return
*/
public GenericTypeVar createGeneric(TypeVariable jreTypeVar, java.lang.Class inClass){
//TODO: Bei den Namen der Parameter des Generishen Typs nachschauen, ob er in der Klasse als Generic deklariert wurde
String name = jreTypeVar.getTypeName();
List<RefType> genericBounds = new ArrayList<>();
java.lang.reflect.Type[] bounds = jreTypeVar.getBounds();
if(bounds.length > 0){
for(java.lang.reflect.Type bound : bounds){
genericBounds.add(createType(bound));
}
return new BoundedGenericVar();
}
return new GenericTypeVar();
}
public static Class createInterface(String className, RefType superClass, Modifiers modifiers,
Menge supertypeGenPara, SourceFile parent){
Class generatedClass = new Class(new JavaClassName(className), new ArrayList<Method>(), new ArrayList<Field>(), modifiers,

View File

@ -0,0 +1,9 @@
package de.dhbwstuttgart.syntaxtree.factory;
/**
* Generiert Hilfsmethoden für die Unary und Binary Operatoren
* Diese Methoden stellen die möglichen Operationen +,-,++, etc dar
*/
public class PrimitiveMethodsGenerator {
}

View File

@ -3,29 +3,23 @@ package de.dhbwstuttgart.syntaxtree.factory;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.logging.Logger;
import de.dhbwstuttgart.typeinference.exceptions.NotImplementedException;
import de.dhbwstuttgart.syntaxtree.NullSyntaxTreeNode;
import de.dhbwstuttgart.syntaxtree.type.ExtendsWildcardType;
import de.dhbwstuttgart.syntaxtree.type.FunN;
import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar;
import de.dhbwstuttgart.syntaxtree.type.ObjectType;
import de.dhbwstuttgart.syntaxtree.type.RefType;
import de.dhbwstuttgart.syntaxtree.type.SuperWildcardType;
import de.dhbwstuttgart.syntaxtree.type.Type;
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
import de.dhbwstuttgart.syntaxtree.type.Void;
import de.dhbwstuttgart.syntaxtree.type.WildcardType;
import de.dhbwstuttgart.typeinference.ConstraintsSet;
import de.dhbwstuttgart.typeinference.EinzelElement;
import de.dhbwstuttgart.typeinference.KomplexeMenge;
import de.dhbwstuttgart.typeinference.Menge;
import de.dhbwstuttgart.typeinference.OderConstraint;
import de.dhbwstuttgart.typeinference.OderMenge;
import de.dhbwstuttgart.typeinference.Pair;
import de.dhbwstuttgart.typeinference.UndConstraint;
import de.dhbwstuttgart.typeinference.UndMenge;
import de.dhbwstuttgart.typeinference.UnifyConstraintsSet;
import de.dhbwstuttgart.typeinference.UnifyOderConstraint;
import de.dhbwstuttgart.typeinference.UnifyUndConstraint;
@ -172,25 +166,25 @@ public class UnifyTypeFactory {
public static Type convert(ReferenceType t) {
//TODO: Hier kann man die GTVs extrahieren
if(t.getName().toString().equals(Void.VOID_NAME))return new Void(NULL_NODE, 0);
RefType ret = new RefType(t.getName(),null,0);
if(t.getName().toString().equals(Void.VOID_NAME))return new Void( 0);
RefType ret = new RefType(t.getName(),0);
ret.set_ParaList(convert(t.getTypeParams()));
return ret;
}
public static Type convert(FunNType t) {
RefType ret = new RefType(t.getName(),null,0);
RefType ret = new RefType(t.getName(),0);
ret.set_ParaList(convert(t.getTypeParams()));
return ret;
}
public static Type convert(SuperType t) {
RefType innerType = new RefType(t.getSuperedType().getName(),NULL_NODE,0);
RefType innerType = new RefType(t.getSuperedType().getName(),0);
return new SuperWildcardType(innerType);
}
public static Type convert(ExtendsType t) {
RefType innerType = new RefType(t.getExtendedType().getName(),NULL_NODE,0);
RefType innerType = new RefType(t.getExtendedType().getName(),0);
return new ExtendsWildcardType(innerType);
}

View File

@ -11,6 +11,7 @@ public class Unify_FC_TTO_Builder {
private Menge<Pair> fc = new Menge<Pair>();
private Menge<Class> classes = new Menge<Class>();
/*
public void AddInheritance(Type t1, Type t2) {
if(t1 instanceof RefType)
if(!classes.stream().anyMatch(x -> x.getName().equals(t1.getName())))
@ -22,6 +23,7 @@ public class Unify_FC_TTO_Builder {
fc.add(new Pair(t1, t2));
}
*/
public void clear() {
fc = new Menge<Pair>();

View File

@ -1,48 +0,0 @@
package de.dhbwstuttgart.syntaxtree.misc;
import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;
import de.dhbwstuttgart.syntaxtree.statement.ArgumentList;
import de.dhbwstuttgart.syntaxtree.statement.MethodCall;
import de.dhbwstuttgart.syntaxtree.statement.Receiver;
import de.dhbwstuttgart.typeinference.ConstraintsSet;
import de.dhbwstuttgart.typeinference.assumptions.ConstructorAssumption;
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException;
/**
* Diese Klasse stellt den this()-Aufruf dar.
* @author janulrich
*
*/
public class ConstructorCall extends MethodCall
{
public ConstructorCall(Receiver receiver, String methodName, ArgumentList argumentList, int offset){
super(receiver, methodName, argumentList,offset);
//this.set_Receiver(receiver);
//this.set_Name(methodName);
//this.set_ArgumentList(argumentList);
}
/*
@Override
public ConstraintsSet TYPEExpr(TypeAssumptions assumptions) {
throw new TypeinferenceException("this(...)-Aufruf kann nicht als Ausdruck verwendet werden",this);
}
*/
@Override
public ConstraintsSet overloading(TypeAssumptions assumptions){
ConstraintsSet ret = new ConstraintsSet();
ConstructorAssumption cAss = assumptions.getConstructorAssumption(this.get_Name(), this.getArgumentList().size());
if(cAss == null)throw new TypeinferenceException("Kein Konstruktor mit passender Parameteranzahl vorhanden",this);
ret.add(constraintsFromMethodAssumption(cAss, assumptions));
return ret;
}
@Override
public void parserPostProcessing(SyntaxTreeNode parent) {
super.parserPostProcessing(parent);
}
}

View File

@ -1,227 +0,0 @@
// ino.module.DeclId.8558.package
package de.dhbwstuttgart.syntaxtree.misc;
// ino.end
// ino.module.DeclId.8558.import
import de.dhbwstuttgart.typeinference.Menge;
import de.dhbwstuttgart.logger.Logger;
// ino.end
import de.dhbwstuttgart.core.MyCompiler;
import de.dhbwstuttgart.syntaxtree.Constant;
import de.dhbwstuttgart.syntaxtree.modifier.Final;
import de.dhbwstuttgart.syntaxtree.modifier.Modifiers;
import de.dhbwstuttgart.syntaxtree.statement.Assign;
import de.dhbwstuttgart.syntaxtree.statement.Expr;
import de.dhbwstuttgart.syntaxtree.statement.ExprStmt;
import de.dhbwstuttgart.syntaxtree.statement.InstVar;
import de.dhbwstuttgart.syntaxtree.statement.LocalOrFieldVarOrClassname;
import de.dhbwstuttgart.syntaxtree.type.RefType;
import de.dhbwstuttgart.syntaxtree.type.Type;
// ino.class.DeclId.23280.declaration
public class DeclId
// ino.end
// ino.class.DeclId.23280.body
{
// ino.attribute.modifiers.23283.declaration
public Modifiers modifiers;
// ino.end
// ino.attribute.name.23286.declaration
public String name;
// ino.end
// ino.attribute.wert.23289.declaration
private ExprStmt wert;
// ino.end
// ino.attribute.paratyp.23292.declaration
public Menge paratyp = null; // hier wird die Parameterzuordnung gespeichert ... 'test t <int, double> = new test();'
// ino.end
// ino.attribute.m_LineNumber.23295.declaration
private int m_LineNumber = MyCompiler.NO_LINENUMBER;
// ino.end
private int m_Offset = -1; //hinzugef�gt hoth: 07.04.2006
// ino.attribute.codegenlog.23298.decldescription type=line
// Logger fuer Code-Gen
// ino.end
// ino.attribute.codegenlog.23298.declaration
protected static Logger codegenlog = Logger.getLogger("codegen");
// ino.end
// ino.method.DeclId.23301.definition
public DeclId()
// ino.end
// ino.method.DeclId.23301.body
{
}
// ino.end
// ino.method.DeclId.23304.definition
public DeclId(String name)
// ino.end
// ino.method.DeclId.23304.body
{
this.name = name;
}
// ino.end
// ino.method.set_Paratyp.23307.definition
public void set_Paratyp(Menge p)
// ino.end
// ino.method.set_Paratyp.23307.body
{
this.paratyp = p;
}
// ino.end
// ino.method.get_Paratyp.23310.definition
public Menge get_Paratyp()
// ino.end
// ino.method.get_Paratyp.23310.body
{
return this.paratyp;
}
// ino.end
// ino.method.set_Name.23313.definition
public void set_Name(String name)
// ino.end
// ino.method.set_Name.23313.body
{
this.name = name;
}
// ino.end
// ino.method.set_Wert.23316.definition
public void set_Wert(ExprStmt w)
// ino.end
// ino.method.set_Wert.23316.body
{
this.wert = w;
}
// ino.end
// ino.method.get_Name.23319.definition
public String get_Name()
// ino.end
// ino.method.get_Name.23319.body
{
return name;
}
// ino.end
// ino.method.get_Wert.23322.definition
public ExprStmt get_Wert()
// ino.end
// ino.method.get_Wert.23322.body
{
return wert;
}
// ino.end
// ino.method.set_Modifiers.23325.definition
public void set_Modifiers(Modifiers mod)
// ino.end
// ino.method.set_Modifiers.23325.body
{
this.modifiers = mod;
}
// ino.end
// ino.method.get_Modifiers.23328.definition
public Modifiers get_Modifiers()
// ino.end
// ino.method.get_Modifiers.23328.body
{
return this.modifiers;
}
// ino.end
// ino.method.get_access_flags.23331.definition
public short get_access_flags()
// ino.end
// ino.method.get_access_flags.23331.body
{
if(modifiers != null) return modifiers.calculate_access_flags();
else return (short)0;
}
// ino.end
// ino.method.set_ListType.23334.definition
public void set_ListType(Type t)
// ino.end
// ino.method.set_ListType.23334.body
{
//System.out.println("In Klasse DeclID, Methode set_ListType passiert nix!");
}
// ino.end
// ino.method.getLineNumber.23343.definition
public int getLineNumber()
// ino.end
// ino.method.getLineNumber.23343.body
{
return m_LineNumber;
}
// ino.end
// ino.method.setLineNumber.23346.definition
public void setLineNumber(int lineNumber)
// ino.end
// ino.method.setLineNumber.23346.body
{
m_LineNumber = lineNumber;
}
// ino.end
// ino.method.getOffset.23349.defdescription type=line
// hinzugef�gt hoth: 07.04.2006
// ino.end
// ino.method.getOffset.23349.definition
public int getOffset()
// ino.end
// ino.method.getOffset.23349.body
{
return m_Offset;
}
// ino.end
// ino.method.setOffset.23352.defdescription type=line
// hinzugef�gt hoth: 07.04.2006
// ino.end
// ino.method.setOffset.23352.definition
public void setOffset(int Offset)
// ino.end
// ino.method.setOffset.23352.body
{
m_Offset = Offset;
}
// ino.end
// ino.method.toString.23355.defdescription type=javadoc
/**
* <br/>Author: Martin Pl�micke
* @return
*/
// ino.end
// ino.method.toString.23355.definition
public String toString()
// ino.end
// ino.method.toString.23355.body
{
return name.toString();
}
// ino.end
}
// ino.end

View File

@ -1,25 +0,0 @@
// ino.module.Status.8566.package
package de.dhbwstuttgart.syntaxtree.misc;
// ino.end
// ino.class.Status.23644.declaration
public abstract class Status
// ino.end
// ino.class.Status.23644.body
{
// ino.attribute.userdef.23647.declaration
protected UserDef userdef;
// ino.end
// ino.method.set_UserDef.23653.definition
public void set_UserDef( UserDef userdef)
// ino.end
// ino.method.set_UserDef.23653.body
{
this.userdef = userdef;
}
// ino.end
}
// ino.end

View File

@ -1,303 +0,0 @@
// ino.module.UsedId.8567.package
package de.dhbwstuttgart.syntaxtree.misc;
// ino.end
// ino.module.UsedId.8567.import
import java.util.Iterator;
import de.dhbwstuttgart.typeinference.Menge;
import de.dhbwstuttgart.core.IItemWithOffset;
import de.dhbwstuttgart.parser.JavaClassName;
import de.dhbwstuttgart.syntaxtree.type.Type;
import de.dhbwstuttgart.typeinference.JavaCodeResult;
import de.dhbwstuttgart.typeinference.ResultSet;
import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException;
// ino.class.UsedId.23659.declaration
public class UsedId implements IItemWithOffset
// ino.end
// ino.class.UsedId.23659.body
{
// ino.attribute.name.23663.declaration
public Menge<String> name = new Menge<String>(); // Menge mit Strings
// ino.end
// ino.attribute.typen.23666.declaration
private Menge typen = new Menge(); // Menge mit Typen
// ino.end
// ino.attribute.paralist.23669.declaration
private Menge<Type> paralist = null;
// ino.end
// ino.attribute.vParaOrg.23672.declaration
public Menge<Type> vParaOrg = null; // otth: originale Parameterliste
// ino.end
private int m_Offset = -1; //hinzugef�gt hoth: 07.04.2006
// ino.method.UsedId.23675.definition
public UsedId(int offset)
// ino.end
// ino.method.UsedId.23675.body
{
m_Offset=offset;
}
// ino.end
public UsedId(String name, int offset)
{
this(offset);
this.set_Name(name);
}
// ino.method.getOffset.23678.defdescription type=line
// hinzugef�gt hoth: 07.04.2006
// ino.end
// ino.method.getOffset.23678.definition
public int getOffset()
// ino.end
// ino.method.getOffset.23678.body
{
return m_Offset;
}
// ino.end
// ino.method.getVariableLength.23681.definition
public int getVariableLength()
// ino.end
// ino.method.getVariableLength.23681.body
{
return get_Name_1Element().length();
}
// ino.end
// ino.method.setOffset.23684.defdescription type=line
// hinzugef�gt hoth: 07.04.2006
// ino.end
// ino.method.setOffset.23684.definition
public void setOffset(int Offset)
// ino.end
// ino.method.setOffset.23684.body
{
m_Offset = Offset;
}
// ino.end
// ino.method.set_Name.23687.definition
public void set_Name( String name)
// ino.end
// ino.method.set_Name.23687.body
{
this.name.addElement(name);
}
// ino.end
// ino.method.get_Name.23690.definition
public Menge get_Name()
// ino.end
// ino.method.get_Name.23690.body
{
return name;
}
// ino.end
// ino.method.get_Name_1Element.23693.definition
public String get_Name_1Element()
// ino.end
// ino.method.get_Name_1Element.23693.body
{
return (String) name.elementAt(0);
}
// ino.end
// ino.method.set_Typen.23696.definition
public void set_Typen(Menge t)
// ino.end
// ino.method.set_Typen.23696.body
{
typen=t;
}
// ino.end
// ino.method.set_ParaList.23699.definition
public void set_ParaList(Menge<Type> pl)
// ino.end
// ino.method.set_ParaList.23699.body
{
this.paralist = pl;
}
// ino.end
// ino.method.get_RealParaList.23702.definition
public Menge<Type> get_RealParaList()
// ino.end
// ino.method.get_RealParaList.23702.body
{
return this.paralist;
}
// ino.end
// ino.method.get_ParaList.23705.definition
public Menge<Type> get_ParaList()
// ino.end
// ino.method.get_ParaList.23705.body
{
if(this.paralist != null)
return this.paralist;
else return new Menge<Type>();
}
// ino.end
// ino.method.get_vParaOrg.23708.definition
public Menge<Type> get_vParaOrg()
// ino.end
// ino.method.get_vParaOrg.23708.body
{
return this.vParaOrg;
}
// ino.end
// ino.method.get_Typen.23711.definition
public Menge get_Typen()
// ino.end
// ino.method.get_Typen.23711.body
{
return typen;
}
// ino.end
// ino.method.get_codegen_UsedId.23714.definition
public String get_codegen_UsedId()
// ino.end
// ino.method.get_codegen_UsedId.23714.body
{
String name_string = new String();
name_string += (String)name.elementAt(0);
for(int i = 1; i < name.size(); i++)
name_string += ("/" + (String)name.elementAt(i));
return name_string;
}
// ino.end
// ino.method.removeLast.23720.definition
public void removeLast()
// ino.end
// ino.method.removeLast.23720.body
{
name.removeElementAt(name.size()-1);
}
// ino.end
// ino.method.toString.23723.defdescription type=javadoc
/**
* <br/>Author: Martin Pl�micke
* @return
*/
// ino.end
// ino.method.toString.23723.definition
public String toString()
// ino.end
// ino.method.toString.23723.body
{
return this.get_Name_1Element();//name.toString(); //geändert von Andreas Stadelmeier
/*String s = "";
for(int i = 0; i<name.size();i++)
{
if(i<name.size() -1)
s += name.get(i) + ".";
else
s += name.get(i);
}
return s;*/
}
// ino.end
// ino.method.getQualifiedName.23726.definition
public JavaClassName getQualifiedName()
// ino.end
// ino.method.getQualifiedName.23726.body
{
StringBuffer sb=new StringBuffer();
if(name!=null){
for(int j=0;j<name.size();j++){
sb.append(name.get(j));
if(j<name.size()-1)
sb.append(".");
}
}
return new JavaClassName(sb.toString());
}
// ino.end
// ino.method.createFromQualifiedName.23729.definition
public static UsedId createFromQualifiedName(String qualifiedName, int offset)
// ino.end
// ino.method.createFromQualifiedName.23729.body
{
String[] steps=qualifiedName.split("\\.");
UsedId uid=new UsedId(offset);
uid.name=new Menge<String>();
for(int i=0;i<steps.length;i++){
uid.name.addElement(steps[i]);
}
return(uid);
}
// ino.end
// ino.method.hasWildCard.23732.definition
public boolean hasWildCard()
// ino.end
// ino.method.hasWildCard.23732.body
{
if(name!=null && name.size()>0){
return(name.elementAt(name.size()-1).equals("*"));
}
return(false);
}
// ino.end
// ino.method.getPackageName.23735.definition
public UsedId getPackageName()
// ino.end
// ino.method.getPackageName.23735.body
{
UsedId uid=new UsedId(-1);
uid.name=new Menge<String>();
for(int i=0;i<name.size()-1;i++){
uid.name.add(name.elementAt(i));
}
return uid;
}
// ino.end
// ino.method.getSimpleName.23738.definition
public String getSimpleName()
// ino.end
// ino.method.getSimpleName.23738.body
{
if(name!=null && name.size()>0)
return name.lastElement();
else
return null;
}
// ino.end
public JavaCodeResult printJavaCode(ResultSet resultSet) {
if(this.name.size()>1)throw new TypeinferenceException("Es kann maximal nur eine Superklasse pro Klasse geben", null);
JavaCodeResult ret = new JavaCodeResult(this.getQualifiedName().toString());
if(this.paralist != null){
ret.attach( "<" );
Iterator<Type> it = this.paralist.iterator();
while(it.hasNext()){
Type para = it.next();
ret.attach(para.printJavaCode(resultSet));
if(it.hasNext())ret.attach(", ");
}
//ret = ret.substring(0, ret.length()-2);
ret.attach(">");
}
return ret;
}
}
// ino.end

View File

@ -1,11 +0,0 @@
// ino.module.UserDef.8568.package
package de.dhbwstuttgart.syntaxtree.misc;
// ino.end
// ino.class.UserDef.23741.declaration
public class UserDef extends Status
// ino.end
// ino.class.UserDef.23741.body
{
}
// ino.end

View File

@ -1,30 +1,19 @@
// ino.module.Abstract.8585.package
package de.dhbwstuttgart.syntaxtree.modifier;
import de.dhbwstuttgart.typeinference.JavaCodeResult;
import de.dhbwstuttgart.typeinference.ResultSet;
// ino.class.Abstract.24015.description type=javadoc
/**
* Stellt den Modifier Abstract dar.
*
*/
// ino.end
// ino.class.Abstract.24015.declaration
public class Abstract extends Modifier
// ino.end
// ino.class.Abstract.24015.body
{
// ino.method.getBitmask.24019.definition
public short getBitmask()
// ino.end
// ino.method.getBitmask.24019.body
{
return 0x0400;
}
// ino.end
@Override
public JavaCodeResult printJavaCode(ResultSet resultSet) {
@ -32,4 +21,3 @@ public class Abstract extends Modifier
}
}
// ino.end

View File

@ -15,13 +15,8 @@ import de.dhbwstuttgart.typeinference.ResultSet;
* Die Klasse beinhaltet die Liste der Access-Modifier fuer eine Klasse,
* Methode usw.
*/
// ino.end
// ino.class.Modifiers.24035.declaration
public class Modifiers
// ino.end
// ino.class.Modifiers.24035.body
{
// ino.attribute.modifier.24038.declaration
protected Menge<Modifier> modifier = new Menge<Modifier>();
// ino.end
@ -104,16 +99,11 @@ public class Modifiers
modifier.addElement(new Public());
}
// ino.method.calculate_access_flags.24056.defdescription type=javadoc
/**
* Gibt den Bitmaskenwert fuer die enthaltenen Access-Modifier
* zurueck.
*/
// ino.end
// ino.method.calculate_access_flags.24056.definition
public short calculate_access_flags()
// ino.end
// ino.method.calculate_access_flags.24056.body
{
short ret = 0;
@ -127,7 +117,6 @@ public class Modifiers
}
return ret;
}
// ino.end
public JavaCodeResult printJavaCode(ResultSet resultSet) {
JavaCodeResult ret = new JavaCodeResult();

View File

@ -1,36 +1,13 @@
// ino.module.EqualOp.8597.package
package de.dhbwstuttgart.syntaxtree.operator;
// ino.end
// ino.module.EqualOp.8597.import
import java.util.Iterator;
// ino.module.EqualOp.8597.import
import org.apache.bcel.Constants;
import org.apache.bcel.generic.BranchInstruction;
import org.apache.bcel.generic.GOTO;
import org.apache.bcel.generic.IF_ICMPNE;
import org.apache.bcel.generic.InstructionConstants;
import org.apache.bcel.generic.InstructionList;
import org.apache.bcel.generic.NOP;
import org.apache.bcel.generic.ObjectType;
import de.dhbwstuttgart.typeinference.Menge;
import de.dhbwstuttgart.bytecode.ClassGenerator;
import de.dhbwstuttgart.bytecode.DHBWInstructionFactory;
import de.dhbwstuttgart.parser.JavaClassName;
import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;
import de.dhbwstuttgart.syntaxtree.statement.Binary;
import de.dhbwstuttgart.syntaxtree.statement.Expr;
import de.dhbwstuttgart.syntaxtree.statement.Null;
import de.dhbwstuttgart.syntaxtree.type.RefType;
import de.dhbwstuttgart.typeinference.Pair;
import de.dhbwstuttgart.typeinference.unify.TypeUnify;
import de.dhbwstuttgart.typeinference.TypeinferenceResultSet;
import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException;
// ino.class.EqualOp.24118.declaration
// ino.class.EqualOp.24118.declaration
public class EqualOp extends RelOp
// ino.end
// ino.class.EqualOp.24118.body

View File

@ -14,7 +14,11 @@ import de.dhbwstuttgart.typeinference.TypeinferenceResultSet;
public class ArgumentList extends SyntaxTreeNode
{
public Menge<Expr> expr = new Menge<Expr>();
public ArgumentList(int offset) {
super(offset);
}
public Menge<Expr> expr = new Menge<Expr>();
public Object get_firstElement()
@ -67,15 +71,6 @@ public class ArgumentList extends SyntaxTreeNode
return 0;
}
@Override
public int getVariableLength() {
return 0;
}
@Override
public Menge<? extends SyntaxTreeNode> getChildren() {
return expr;

View File

@ -1,96 +1,48 @@
// ino.module.Assign.8622.package
package de.dhbwstuttgart.syntaxtree.statement;
// ino.end
// ino.module.Assign.8622.import
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Iterator;
import org.apache.bcel.generic.ASTORE;
import org.apache.bcel.generic.ClassGen;
import org.apache.bcel.generic.DSTORE;
import org.apache.bcel.generic.FSTORE;
import org.apache.bcel.generic.ISTORE;
import org.apache.bcel.generic.InstructionFactory;
package de.dhbwstuttgart.syntaxtree.statement;
import org.apache.bcel.generic.InstructionList;
import org.apache.bcel.generic.LSTORE;
import de.dhbwstuttgart.typeinference.Menge;
import de.dhbwstuttgart.bytecode.ClassGenerator;
import de.dhbwstuttgart.bytecode.DHBWInstructionFactory;
import de.dhbwstuttgart.logger.Logger;
import de.dhbwstuttgart.parser.JavaClassName;
import de.dhbwstuttgart.syntaxtree.Class;
import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;
import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar;
import de.dhbwstuttgart.syntaxtree.type.Type;
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
import de.dhbwstuttgart.syntaxtree.type.Void;
import de.dhbwstuttgart.typeinference.ConstraintsSet;
import de.dhbwstuttgart.typeinference.JavaCodeResult;
import de.dhbwstuttgart.typeinference.Pair;
import de.dhbwstuttgart.typeinference.ResultSet;
import de.dhbwstuttgart.typeinference.TypeinferenceResultSet;
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
import de.dhbwstuttgart.typeinference.unify.TypeUnify;
// ino.class.Assign.24926.declaration
public class Assign extends Expr
// ino.end
// ino.class.Assign.24926.body
public class Assign extends ExprStmt
{
// ino.method.Assign.24930.definition
public Assign(int offset,int variableLength)
// ino.end
// ino.method.Assign.24930.body
{
super(offset,variableLength);
}
// ino.end
public Assign(Type type, int offset) {
super(type, offset);
}
// ino.attribute.expr1.24933.declaration
public Expr expr1;
// ino.end
// ino.attribute.expr2.24936.declaration
public Expr expr1;
public Expr expr2;
// ino.end
// ino.attribute.parserlog.24939.decldescription type=javadoc
/**
* Logger log4j
*/
// ino.end
// ino.attribute.parserlog.24939.declaration
protected static Logger parserlog = Logger.getLogger("parser");
// ino.end
// ino.method.set_Expr.24942.definition
public void set_Expr(Expr expr1,Expr expr2)
// ino.end
// ino.method.set_Expr.24942.body
{
this.expr1 = expr1;
this.expr2 = expr2;
}
// ino.end
// ino.method.get_Name.24948.definition
public String get_Name()
// ino.end
// ino.method.get_Name.24948.body
{
return null;
}
// ino.end
/**
@ -102,7 +54,7 @@ public class Assign extends Expr
ret.add(expr1.TYPEExpr(assumptions));
ret.add(expr2.TYPEExpr(assumptions));
//this.setTypeVariable( TypePlaceholder.fresh(this));
this.setType(TypePlaceholder.fresh(this));
//this.setType(TypePlaceholder.fresh(this));
ret.add(ConstraintsSet.createSingleConstraint(expr2.getType().TYPE(assumptions, this), expr1.getType().TYPE(assumptions, this))); //expr2.type <. expr1.type
ret.add(ConstraintsSet.createSingleConstraint(expr1.getType().TYPE(assumptions, this), this.getType().TYPE(assumptions, this)));
return ret;
@ -117,7 +69,7 @@ public class Assign extends Expr
@Override
public ConstraintsSet TYPEStmt(TypeAssumptions assumptions){
ConstraintsSet ret = this.TYPEExpr(assumptions); //TypeExpr aufrufen
this.setType(new Void(this,0)); //Typ des Statments auf Void setzen.
//this.setType(new Void(0)); //Typ des Statments auf Void setzen.
return ret;
}
@ -148,12 +100,12 @@ public class Assign extends Expr
}
// ino.end
/*
@Override
public String getTypeInformation(){
return "(" + expr1.getTypeInformation() + " = " + expr2.getTypeInformation() + ") : "+this.getType();
}
*/
@Override
public JavaCodeResult printJavaCode(ResultSet resultSet){
JavaCodeResult ret = new JavaCodeResult().attach(this.expr1.printJavaCode(resultSet) ).attach( " = " ).attach( this.expr2.printJavaCode(resultSet));

View File

@ -2,43 +2,25 @@
package de.dhbwstuttgart.syntaxtree.statement;
// ino.end
// ino.module.Binary.8623.import
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Hashtable;
import org.apache.bcel.generic.BranchInstruction;
import org.apache.bcel.generic.ClassGen;
import org.apache.bcel.generic.GOTO;
import org.apache.bcel.generic.IF_ICMPNE;
import org.apache.bcel.generic.InstructionConstants;
import org.apache.bcel.generic.InstructionList;
import org.apache.bcel.generic.NOP;
import de.dhbwstuttgart.typeinference.Menge;
import de.dhbwstuttgart.bytecode.ClassGenerator;
import de.dhbwstuttgart.logger.Logger;
import de.dhbwstuttgart.parser.JavaClassName;
import de.dhbwstuttgart.syntaxtree.Class;
import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;
import de.dhbwstuttgart.syntaxtree.operator.AddOp;
import de.dhbwstuttgart.syntaxtree.operator.LogOp;
import de.dhbwstuttgart.syntaxtree.operator.MulOp;
import de.dhbwstuttgart.syntaxtree.operator.Operator;
import de.dhbwstuttgart.syntaxtree.operator.RelOp;
import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar;
import de.dhbwstuttgart.syntaxtree.type.RefType;
import de.dhbwstuttgart.syntaxtree.type.Type;
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
import de.dhbwstuttgart.typeinference.ConstraintsSet;
import de.dhbwstuttgart.typeinference.JavaCodeResult;
import de.dhbwstuttgart.typeinference.OderConstraint;
import de.dhbwstuttgart.typeinference.Pair;
import de.dhbwstuttgart.typeinference.ResultSet;
import de.dhbwstuttgart.typeinference.TypeinferenceResultSet;
import de.dhbwstuttgart.typeinference.UndConstraint;
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException;
// ino.class.Binary.24966.description type=line
@ -164,9 +146,6 @@ public class Binary extends BinaryExpr
// ino.method.wandleRefTypeAttributes2GenericAttributes.25027.body
{
}
// ino.end
@Override
public ConstraintsSet TYPEExpr(TypeAssumptions assumptions) {
@ -180,7 +159,7 @@ public class Binary extends BinaryExpr
* @param expr2
* @return
*/
if(this.getType()==null)this.set_Type(TypePlaceholder.fresh(this));
//if(this.getType()==null)this.set_Type(TypePlaceholder.fresh(this));
OderConstraint oderCons = new OderConstraint();
HashMap<Type,Type> rMap = this.op.getReturnTypes(assumptions);
for(Type rT : rMap.keySet()){

View File

@ -5,6 +5,7 @@ package de.dhbwstuttgart.syntaxtree.statement;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import org.apache.bcel.Constants;
import org.apache.bcel.generic.ClassGen;
@ -45,23 +46,17 @@ public class Block extends Statement
private ConstantPoolGen _cp;
private ClassGen _cg;
// ino.method.Block.25041.definition
public Block()
// ino.end
// ino.method.Block.25041.body
{
super(-1,-1);
}
// ino.end
public Block(List<Statement> statements, int offset) {
super(offset);
this.statements = statements;
}
// ino.attribute.parserlog.25044.declaration
// ino.attribute.parserlog.25044.declaration
protected static Logger parserlog = Logger.getLogger("parser");
// ino.end
// ino.attribute.statements.25047.declaration
public Menge<Statement> statements = new Menge<Statement>();
// ino.end
public List<Statement> statements = new Menge<Statement>();
//private String sc_meth_ret_type;
@ -78,38 +73,12 @@ public class Block extends Statement
// ino.method.get_Statement.25065.definition
public Menge<Statement> get_Statement()
public List<Statement> get_Statement()
// ino.end
// ino.method.get_Statement.25065.body
{
return statements;
}
// ino.end
// ino.method.set_Statement.25068.definition
public void set_Statement(Statement s)
// ino.end
// ino.method.set_Statement.25068.body
{
statements.addElement(s);
}
// ino.end
// ino.method.set_Statement_Menge.25071.definition
public void set_Statement_Menge(Menge<Statement> v)
// ino.end
// ino.method.set_Statement_Menge.25071.body
{
statements = v;
}
// ino.end
/////////////////////////////////////////////////////////////////////////
// TypeReconstructionAlgorithmus
@ -132,33 +101,9 @@ public class Block extends Statement
}
// ino.end
// ino.method.wandleRefTypeAttributes2GenericAttributes.25086.defdescription type=javadoc
/**
* In allen lokalen Variablendeklarationen die "falschen" RefTypes ersetzen
* @param paralist
* @param genericMethodParameters
*/
// ino.end
// ino.method.wandleRefTypeAttributes2GenericAttributes.25086.definition
public void wandleRefTypeAttributes2GenericAttributes(Menge<Type> paralist, Menge<GenericTypeVar> genericMethodParameters)
// ino.end
// ino.method.wandleRefTypeAttributes2GenericAttributes.25086.body
{
if(statements==null)
return;
for(int i=0;i<statements.size();i++){
statements.elementAt(i).wandleRefTypeAttributes2GenericAttributes(paralist,genericMethodParameters);
}
}
// ino.end
@Override
public ConstraintsSet TYPEStmt(TypeAssumptions assumptions) {
ConstraintsSet ret = new ConstraintsSet();
if(statements.size()==0)this.setType(new Void(this,0));
/* this.setTypeVariable(TypePlaceholder.fresh(this)); */
for(Statement stmt : statements){
typinferenceLog.debug("Prozessing statement: "+stmt, Section.TYPEINFERENCE);
@ -169,11 +114,11 @@ public class Block extends Statement
*/
}
if(statements.size()>0){
Statement stmt = statements.elementAt(statements.size()-1);
Statement stmt = statements.get(statements.size()-1);
typinferenceLog.debug("Prozessing statement: "+stmt, Section.TYPEINFERENCE);
this.setType(stmt.getType());
for(int i= statements.size()-2; i >= 0; i--) {
stmt = statements.elementAt(i);
stmt = statements.get(i);
typinferenceLog.debug("Prozessing statement: "+stmt, Section.TYPEINFERENCE);
if (!(stmt.getReturnType() instanceof Void))
if (this.getReturnType() instanceof Void) {
@ -187,8 +132,6 @@ public class Block extends Statement
this.setType(tph);
}
}
}else{
this.setType(new Void(this,0));
}
return ret;
}

View File

@ -51,7 +51,7 @@ public class BoolLiteral extends Literal
super(-1,-1);
// #JB# 20.04.2005
// ###########################################################
this.setType(new RefType("Boolean",this,this.getOffset()));
this.setType(new RefType("java.lang.Boolean",this.getOffset()));
//this.setType(new Type("boolean"));
// ###########################################################
}
@ -99,7 +99,6 @@ public class BoolLiteral extends Literal
@Override
public ConstraintsSet TYPEExpr(TypeAssumptions assumptions) {
this.type = assumptions.checkType(new RefType("java.lang.Boolean",this,-1), this);
return new ConstraintsSet();
}
@ -118,15 +117,6 @@ public class BoolLiteral extends Literal
}
@Override
public void wandleRefTypeAttributes2GenericAttributes(
Menge<Type> paralist,
Menge<GenericTypeVar> genericMethodParameters) {
// TODO Auto-generated method stub
}
@Override
public InstructionList genByteCode(ClassGenerator _cg, TypeinferenceResultSet rs) {
InstructionFactory _factory = new InstructionFactory(_cg, _cg.getConstantPool());

View File

@ -26,16 +26,17 @@ import de.dhbwstuttgart.typeinference.exceptions.NotImplementedException;
// ino.class.CastExpr.25126.declaration
public class CastExpr extends UnaryExpr
public class CastExpr extends Expr
// ino.end
// ino.class.CastExpr.25126.body
{
// ino.method.CastExpr.25130.definition
public CastExpr(int offset,int variableLength)
public CastExpr(Type castType, Expr expr,int offset)
// ino.end
// ino.method.CastExpr.25130.body
{
super(offset,variableLength);
super(offset);
this.type = castType;
}
// ino.end
@ -106,7 +107,7 @@ public class CastExpr extends UnaryExpr
@Override
public JavaCodeResult printJavaCode(ResultSet resultSet) {
return new JavaCodeResult("(("+this.usedid+")").attach(this.expr.printJavaCode(resultSet)).attach(")");
return new JavaCodeResult("(("+this.+")").attach(this.expr.printJavaCode(resultSet)).attach(")");
}

View File

@ -0,0 +1,36 @@
package de.dhbwstuttgart.syntaxtree.statement;
import java.util.Iterator;
import org.apache.bcel.generic.InstructionList;
import de.dhbwstuttgart.typeinference.Menge;
import de.dhbwstuttgart.logger.Logger;
import de.dhbwstuttgart.bytecode.ClassGenerator;
import de.dhbwstuttgart.core.MyCompiler;
import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;
import de.dhbwstuttgart.syntaxtree.type.Type;
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
import de.dhbwstuttgart.typeinference.Pair;
import de.dhbwstuttgart.typeinference.Typeable;
import de.dhbwstuttgart.typeinference.TypeinferenceResultSet;
import de.dhbwstuttgart.typeinference.unify.TypeUnify;
public abstract class Executeable extends SyntaxTreeNode implements Typeable
{
private Type type;
public Executeable(Type type,int offset) {
super(offset);
this.type = type;
}
public Type getType(){
return type;
}
public abstract InstructionList genByteCode(ClassGenerator _cg, TypeinferenceResultSet rs);
//public abstract String getTypeInformation();
}

View File

@ -1,7 +1,6 @@
// ino.module.Expr.8630.package
package de.dhbwstuttgart.syntaxtree.statement;
// ino.end
// ino.module.Expr.8630.import
import java.util.Hashtable;
import java.util.Iterator;
@ -10,7 +9,7 @@ import org.apache.bcel.generic.InstructionList;
import de.dhbwstuttgart.typeinference.Menge;
import de.dhbwstuttgart.syntaxtree.Class;
import de.dhbwstuttgart.syntaxtree.misc.UsedId;
import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;
import de.dhbwstuttgart.syntaxtree.type.Type;
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
import de.dhbwstuttgart.typeinference.ConstraintsSet;
@ -18,81 +17,14 @@ import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
import de.dhbwstuttgart.typeinference.exceptions.NotImplementedException;
// ino.class.Expr.25225.declaration
public abstract class Expr extends ExprStmt
// ino.end
// ino.class.Expr.25225.body
public abstract class Expr extends Executeable
{
// ino.method.Expr.25229.definition
public Expr(int offset, int variableLength)
// ino.end
// ino.method.Expr.25229.body
{
super(offset, variableLength);
}
// ino.end
// ino.attribute.usedid.25232.declaration
public UsedId usedid; //String type; ab sofort in die Klasse ExprStmt verlegt. last1 17.03.02
// ino.end
// ino.method.set_Type.25235.definition
public void set_Type(Type type)
// ino.end
// ino.method.set_Type.25235.body
{
this.setType(type);
}
// ino.end
public Expr(Type type, int offset) {
super(type, offset);
}
// ino.method.set_UsedId.25238.definition
public void set_UsedId(UsedId ui)
// ino.end
// ino.method.set_UsedId.25238.body
{
this.usedid = ui;
}
// ino.end
// ino.method.get_UsedId.25241.definition
public UsedId get_UsedId()
// ino.end
// ino.method.get_UsedId.25241.body
{
return usedid;
}
// ino.end
// ino.method.get_Name_Menge.25244.definition
public Menge get_Name_Menge()
// ino.end
// ino.method.get_Name_Menge.25244.body
{
return usedid.get_Name();
}
// ino.end
// ino.method.get_Type_Menge.25247.definition
public Menge get_Type_Menge()
// ino.end
// ino.method.get_Type_Menge.25247.body
{
return usedid.get_Typen();
}
// ino.end
// ino.method.get_Name.25253.declaration
public abstract String get_Name();
// ino.end
public abstract String get_Name();
/**
* @author AI10023 - Andreas Stadelmeier
@ -100,17 +32,4 @@ public abstract class Expr extends ExprStmt
* Jede Expression wird im Zuge des Algorithmus durch die TYPEExpr-Funktion angesprochen.
*/
public abstract ConstraintsSet TYPEExpr(TypeAssumptions assumptions);
/**
* @author AI10023 - Andreas Stadelmeier
* Die Funktion überschreiben, damit sie von Expressions nicht mehr spezifiziert werden muss.
* Denn Expressions ¼ssen diese Funktion nicht implementieren.
*/
@Override
public ConstraintsSet TYPEStmt(TypeAssumptions assumptions){
throw new NotImplementedException(); //wird die TYPEStmt-Methode innerhalb einer Expr aufgerufen, dann ist etwas schief gelaufen.
}
//public abstract InstructionList genByteCode(ClassGen _cg, TypeAssumptions ass);
}
// ino.end

71
src/de/dhbwstuttgart/syntaxtree/statement/ExprStmt.java Executable file → Normal file
View File

@ -1,69 +1,14 @@
// ino.module.ExprStmt.8631.package
package de.dhbwstuttgart.syntaxtree.statement;
// ino.end
// ino.module.ExprStmt.8631.import
import java.util.Iterator;
import de.dhbwstuttgart.typeinference.Menge;
import de.dhbwstuttgart.logger.Logger;
import de.dhbwstuttgart.core.MyCompiler;
import de.dhbwstuttgart.syntaxtree.type.Type;
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
import de.dhbwstuttgart.typeinference.Pair;
import de.dhbwstuttgart.typeinference.unify.TypeUnify;
import de.dhbwstuttgart.typeinference.ConstraintsSet;
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
// ino.class.ExprStmt.25265.declaration
public abstract class ExprStmt extends Statement
// ino.end
// ino.class.ExprStmt.25265.body
{
// ino.method.ExprStmt.25270.definition
public ExprStmt(int offset, int variableLength)
// ino.end
// ino.method.ExprStmt.25270.body
{
super(offset,variableLength);
}
// ino.end
// ino.attribute.type.25273.declaration
//protected Type type; // Type type;
// ino.end
// ino.attribute.inferencelog.25276.declaration
protected static Logger inferencelog = Logger.getLogger("inference");
// ino.end
// ino.method.getTypeName.25279.definition
public String getTypeName()
// ino.end
// ino.method.getTypeName.25279.body
{
if (getType()!=null)
return getType().getName().toString();
else
return null;
}
// ino.end
// ino.method.getTypeLineNumber.25291.defdescription type=javadoc
/**
* <br>Author: ¯Â¿Â½rg ¯Â¿Â½uerle
* @return
*/
// ino.end
// ino.method.getTypeLineNumber.25291.definition
public int getTypeLineNumber()
// ino.end
// ino.method.getTypeLineNumber.25291.body
{
return MyCompiler.NO_LINENUMBER;
}
// ino.end
public abstract class ExprStmt extends Executeable{
public ExprStmt(Type type,int offset) {
super(type,offset);
}
public abstract ConstraintsSet TYPEExpr(TypeAssumptions assumptions);
public abstract ConstraintsSet TYPEStmt(TypeAssumptions assumptions);
}
// ino.end

View File

@ -1,51 +1,34 @@
package de.dhbwstuttgart.syntaxtree.statement;
import java.util.ArrayList;
import java.util.List;
import org.apache.bcel.Const;
import org.apache.bcel.Constants;
import org.apache.bcel.classfile.BootstrapMethod;
import org.apache.bcel.classfile.ConstantMethodHandle;
import org.apache.bcel.classfile.ConstantMethodType;
import org.apache.bcel.classfile.ConstantPool;
import org.apache.bcel.classfile.InnerClass;
import org.apache.bcel.generic.BIPUSH;
import org.apache.bcel.generic.ClassGen;
import org.apache.bcel.generic.ConstantPoolGen;
import org.apache.bcel.generic.InstructionFactory;
import org.apache.bcel.generic.InstructionList;
import org.apache.bcel.generic.MethodGen;
import org.apache.bcel.generic.INVOKEDYNAMIC;
import org.apache.bcel.generic.Instruction;
import de.dhbwstuttgart.typeinference.Menge;
import de.dhbwstuttgart.bytecode.ClassGenerator;
import de.dhbwstuttgart.bytecode.DHBWConstantPoolGen;
import de.dhbwstuttgart.bytecode.MethodGenerator;
import de.dhbwstuttgart.bytecode.TypePlaceholderType;
import de.dhbwstuttgart.parser.JavaClassName;
import de.dhbwstuttgart.syntaxtree.Class;
import de.dhbwstuttgart.typecheck.JavaClassName;
import de.dhbwstuttgart.syntaxtree.ClassHelper;
import de.dhbwstuttgart.syntaxtree.FormalParameter;
import de.dhbwstuttgart.syntaxtree.Method;
import de.dhbwstuttgart.syntaxtree.ParameterList;
import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;
import de.dhbwstuttgart.syntaxtree.type.ExtendsWildcardType;
import de.dhbwstuttgart.syntaxtree.type.FunN;
import de.dhbwstuttgart.syntaxtree.type.FunVoidN;
import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar;
import de.dhbwstuttgart.syntaxtree.type.ObjectType;
import de.dhbwstuttgart.syntaxtree.type.RefType;
import de.dhbwstuttgart.syntaxtree.type.SuperWildcardType;
import de.dhbwstuttgart.syntaxtree.type.Type;
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
import de.dhbwstuttgart.syntaxtree.type.WildcardType;
import de.dhbwstuttgart.typeinference.ConstraintsSet;
import de.dhbwstuttgart.typeinference.JavaCodeResult;
import de.dhbwstuttgart.typeinference.OderConstraint;
import de.dhbwstuttgart.typeinference.ResultSet;
import de.dhbwstuttgart.typeinference.Typeable;
import de.dhbwstuttgart.typeinference.TypeinferenceResultSet;
import de.dhbwstuttgart.typeinference.assumptions.ParameterAssumption;
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;

View File

@ -16,14 +16,9 @@ import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;
import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar;
import de.dhbwstuttgart.syntaxtree.type.RefType;
import de.dhbwstuttgart.syntaxtree.type.Type;
import de.dhbwstuttgart.syntaxtree.type.Void;
import de.dhbwstuttgart.typeinference.ConstraintsSet;
import de.dhbwstuttgart.typeinference.JavaCodeResult;
import de.dhbwstuttgart.typeinference.Pair;
import de.dhbwstuttgart.typeinference.ResultSet;
import de.dhbwstuttgart.typeinference.TypeinferenceResultSet;
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
import de.dhbwstuttgart.typeinference.unify.TypeUnify;
import de.dhbwstuttgart.typeinference.exceptions.NotImplementedException;

View File

@ -1,7 +1,6 @@
// ino.module.Statement.8652.package
package de.dhbwstuttgart.syntaxtree.statement;
// ino.end
// ino.module.Statement.8652.import
import java.util.Enumeration;
import java.util.Hashtable;
@ -28,55 +27,15 @@ import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
// ino.class.Statement.26184.declaration
public abstract class Statement extends SyntaxTreeNode implements IItemWithOffset, Typeable
// ino.end
// ino.class.Statement.26184.body
public abstract class Statement extends Executeable
{
// ino.attribute.offset.26188.declaration
protected int offset;
// ino.end
// ino.attribute.variableLength.26191.declaration
private int variableLength;
// ino.end
protected Type type;
// ino.method.Statement.26194.definition
public Statement(int offset, int variableLength)
// ino.end
// ino.method.Statement.26194.body
public Statement(Type type,int offset)
{
this.offset=offset;
this.variableLength=variableLength;
super(type,offset);
}
// ino.end
// ino.method.getOffset.26197.definition
public int getOffset()
// ino.end
// ino.method.getOffset.26197.body
{
return offset;
}
// ino.end
// ino.method.getVariableLength.26200.definition
public int getVariableLength()
// ino.end
// ino.method.getVariableLength.26200.body
{
return variableLength;
}
// ino.end
// ino.method.wandleRefTypeAttributes2GenericAttributes.26224.declaration
public abstract void wandleRefTypeAttributes2GenericAttributes(Menge<Type> paralist, Menge<GenericTypeVar> genericMethodParameters);
// ino.end
/**
* @author AI10023 - Andreas Stadelmeier
@ -85,12 +44,6 @@ public abstract class Statement extends SyntaxTreeNode implements IItemWithOffse
*/
public abstract ConstraintsSet TYPEStmt(TypeAssumptions assumptions);
public Type getType(){
return type;
}
/**
* @author Andreas Stadelmeier, a10023
* Sollte von jedem Statement überschrieben werden.
@ -98,23 +51,9 @@ public abstract class Statement extends SyntaxTreeNode implements IItemWithOffse
* @return
*/
public String getTypeInformation(){
return this.printJavaCode(new ResultSet(new Menge<Pair>()))+" : "+type.toString();
return this.printJavaCode(new ResultSet(new Menge<Pair>()))+" : "+this.getType().toString();
}
/**
* @author AI10023 - Andreas Stadelmeier
* Jedem Statement und jeder Expression wird im Zuge des Typinferenzalgorithmus eine Typvariable zugewiesen.
* Daher ¼ssen alle Statements und Expressions die Methoden setTypeVariable und getTypeVariable implementieren.
*/
public void setType(Type t)
{
this.type=t;
}
public abstract JavaCodeResult printJavaCode(ResultSet resultSet);
@Override
public String getDescription(){
return this.printJavaCode(new ResultSet(new Menge<Pair>())).toString();
@ -124,14 +63,9 @@ public abstract class Statement extends SyntaxTreeNode implements IItemWithOffse
}
public Type getReturnType(){
return new de.dhbwstuttgart.syntaxtree.type.Void(this,-1);
return new de.dhbwstuttgart.syntaxtree.type.Void(-1);
}
public abstract InstructionList genByteCode(ClassGenerator _cg, TypeinferenceResultSet rs);
}
// ino.end
}

View File

@ -1,32 +1,22 @@
// ino.module.This.8654.package
package de.dhbwstuttgart.syntaxtree.statement;
// ino.end
// ino.module.This.8654.import
import java.util.Hashtable;
// ino.module.This.8654.import
import org.apache.bcel.Constants;
import org.apache.bcel.generic.ClassGen;
import org.apache.bcel.generic.InstructionFactory;
import org.apache.bcel.generic.InstructionHandle;
import org.apache.bcel.generic.InstructionList;
import de.dhbwstuttgart.typeinference.Menge;
import de.dhbwstuttgart.bytecode.ClassGenerator;
import de.dhbwstuttgart.logger.Logger;
import de.dhbwstuttgart.syntaxtree.Class;
import de.dhbwstuttgart.syntaxtree.Constructor;
import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;
import de.dhbwstuttgart.syntaxtree.misc.ConstructorCall;
import de.dhbwstuttgart.syntaxtree.misc.UsedId;
import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar;
import de.dhbwstuttgart.syntaxtree.type.RefType;
import de.dhbwstuttgart.syntaxtree.type.Type;
import de.dhbwstuttgart.syntaxtree.type.Void;
import de.dhbwstuttgart.typeinference.ConstraintsSet;
import de.dhbwstuttgart.typeinference.JavaCodeResult;
import de.dhbwstuttgart.typeinference.ResultSet;
import de.dhbwstuttgart.typeinference.TypeinferenceResultSet;
import de.dhbwstuttgart.typeinference.assumptions.ConstructorAssumption;
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException;

View File

@ -17,7 +17,6 @@ import de.dhbwstuttgart.logger.Logger;
import de.dhbwstuttgart.syntaxtree.Class;
import de.dhbwstuttgart.syntaxtree.Constructor;
import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;
import de.dhbwstuttgart.syntaxtree.misc.UsedId;
import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar;
import de.dhbwstuttgart.syntaxtree.type.RefType;
import de.dhbwstuttgart.syntaxtree.type.Type;

View File

@ -1,19 +1,10 @@
// ino.module.This.8654.package
package de.dhbwstuttgart.syntaxtree.statement;
// ino.end
// ino.module.This.8654.import
import java.util.Hashtable;
import de.dhbwstuttgart.typeinference.Menge;
// ino.module.This.8654.import
import de.dhbwstuttgart.logger.Logger;
import de.dhbwstuttgart.syntaxtree.Class;
import de.dhbwstuttgart.syntaxtree.Constructor;
import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;
import de.dhbwstuttgart.syntaxtree.misc.ConstructorCall;
import de.dhbwstuttgart.syntaxtree.misc.UsedId;
import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar;
import de.dhbwstuttgart.syntaxtree.type.RefType;
import de.dhbwstuttgart.syntaxtree.type.Type;
import de.dhbwstuttgart.syntaxtree.type.Void;
import de.dhbwstuttgart.typeinference.ConstraintsSet;
import de.dhbwstuttgart.typeinference.JavaCodeResult;
@ -26,14 +17,10 @@ import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException;
public class ThisCall extends MethodCall
{
public ThisCall(int offset,int variableLength)
public ThisCall(Receiver receiver, ArgumentList arglist, int offset)
{
super(offset,variableLength);
}
super(offset);
public ThisCall(SyntaxTreeNode parent){
this(0,0);
this.parent = parent;
}
public ArgumentList arglist;
@ -47,15 +34,7 @@ public class ThisCall extends MethodCall
{
return this.arglist;
}
public void set_UsedId(UsedId ui)
{
this.usedid = ui;
}
@Override
public ConstraintsSet TYPEExpr(TypeAssumptions assumptions) {
throw new TypeinferenceException("this(...)-Aufruf kann nicht als Ausdruck verwendet werden",this);
@ -65,8 +44,7 @@ public class ThisCall extends MethodCall
* This kann auch als Konstruktoraufruf in einem Konstruktor-Block vorkommen.
*/
@Override
public ConstraintsSet TYPEStmt(TypeAssumptions assumptions) {
String className = this.getParentClass().getName().toString();
public ConstraintsSet TYPEStmt(TypeAssumptions assumptions, Class parentClass) {
ConstraintsSet ret = new ConstraintsSet();
this.setType(new Void(this,this.getOffset()));
//Kontrollieren, dass sich this(...) in einem Konstruktor und dort als erstes Statement befindet:
@ -74,9 +52,7 @@ public class ThisCall extends MethodCall
if(p instanceof Constructor &&
((Constructor)p).get_Block().statements.firstElement().equals(this)){
//Constraints generieren:
ConstructorCall constructorCall = new ConstructorCall(new Receiver(new This(this)), className, arglist, this.getOffset());
ret.add(constructorCall.TYPEStmt(assumptions));
ret.add(super.TYPEStmt(assumptions, parentClass));
return ret;
}else{
//Ansonsten Fehler ausgeben:
@ -84,9 +60,18 @@ public class ThisCall extends MethodCall
}
}
@Override
public ConstraintsSet overloading(TypeAssumptions assumptions){
ConstraintsSet ret = new ConstraintsSet();
ConstructorAssumption cAss = assumptions.getConstructorAssumption(this.get_Name(), this.getArgumentList().size());
if(cAss == null)throw new TypeinferenceException("Kein Konstruktor mit passender Parameteranzahl vorhanden",this);
ret.add(constraintsFromMethodAssumption(cAss, assumptions));
return ret;
}
public String toString()
{
//return receiver/*.toString()*/ + " " + usedid.toString();
return "(" + "this" +"(" + this.getArgumentList() + "))";
}
@ -94,14 +79,6 @@ public class ThisCall extends MethodCall
public JavaCodeResult printJavaCode(ResultSet resultSet) {
return new JavaCodeResult("this("+this.getArgumentList().printJavaCode(resultSet)+")");
}
@Override
public Menge<SyntaxTreeNode> getChildren() {
Menge<SyntaxTreeNode> ret = new Menge<SyntaxTreeNode>();
if(arglist != null)ret.add(arglist);
return ret;
}
}

View File

@ -4,42 +4,42 @@ package de.dhbwstuttgart.syntaxtree.statement;
// ino.module.UnaryExpr.8655.import
import de.dhbwstuttgart.typeinference.Menge;
import org.apache.bcel.generic.InstructionList;
import de.dhbwstuttgart.bytecode.ClassGenerator;
import de.dhbwstuttgart.syntaxtree.type.RefType;
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
import de.dhbwstuttgart.typeinference.ConstraintsSet;
import de.dhbwstuttgart.typeinference.OderConstraint;
import de.dhbwstuttgart.typeinference.TypeinferenceResultSet;
import de.dhbwstuttgart.typeinference.UndConstraint;
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
// ino.class.UnaryExpr.26298.declaration
public abstract class UnaryExpr extends Expr
// ino.end
// ino.class.UnaryExpr.26298.body
public abstract class UnaryExpr extends MethodCall
{
public Expr expr;
// ino.method.UnaryExpr.26302.definition
public UnaryExpr(int offset,int variableLength)
// ino.end
// ino.method.UnaryExpr.26302.body
{
super(offset,variableLength);
}
// ino.end
@Override
public InstructionList genByteCode(ClassGenerator cg, TypeinferenceResultSet rs) {
/**
* TODO
* Je nach Typisierung wird eine andere Methode aufgerufen
* Alle Parameter müssen in ihren primitiven Datentyp umgewandelt werden
* Der Bytecodegenerator muss anhand der ermittelten Typen den korrekten Bytecode produzieren
* Es werden nie Typen generiert, die nicht Containertypen von primitiven Datentypen sind.
* Das lassen die generierten Constraints nicht zu.
*/
return super.genByteCode(cg, rs);
}
private Menge<RefType> getNumericTypes(){
Menge<RefType> ret = new Menge<>();
ret.add(new RefType("Integer",this,-1));
ret.add(new RefType("Long",this,-1));
ret.add(new RefType("Double",this,-1));
ret.add(new RefType("Float",this,-1));
return ret ;
}
/*
@Override
public ConstraintsSet TYPEExpr(TypeAssumptions assumptions) {
if(this.getType() == null)this.setType(TypePlaceholder.fresh(this));
@ -63,7 +63,6 @@ public abstract class UnaryExpr extends Expr
this.setType(new de.dhbwstuttgart.syntaxtree.type.Void(this, -1).TYPE(assumptions, this));
return ret;
}
*/
}
// ino.end

View File

@ -1,140 +0,0 @@
// ino.module.BoundedGenericTypeVar.8669.package
package de.dhbwstuttgart.syntaxtree.type;
// ino.end
// ino.module.BoundedGenericTypeVar.8669.import
import de.dhbwstuttgart.typeinference.Menge;
import de.dhbwstuttgart.syntaxtree.Class;
import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;
import de.dhbwstuttgart.typeinference.ConstraintsSet;
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException;
// ino.class.BoundedGenericTypeVar.26464.description type=javadoc
/**
* Entspricht einem GenericTypeVar, jedoch mit Bounds
* (d.h. vorgaben, von welchem Typ die Typevar sein darf
* => extends Class x
* => implements Interface y
* ...
* @author hoti 4.5.06
*
*/
// ino.end
// ino.class.BoundedGenericTypeVar.26464.declaration
public class BoundedGenericTypeVar extends GenericTypeVar
// ino.end
// ino.class.BoundedGenericTypeVar.26464.body
{
// ino.attribute.bounds.26468.decldescription type=javadoc
/**
* Hier sind die Bounds in Form von Type-Objekten abgespeichert
*/
// ino.end
// ino.attribute.bounds.26468.declaration
Menge<ObjectType> bounds=new Menge<ObjectType>();
// ino.end
private int endOffset;
/*
// ino.method.BoundedGenericTypeVar.26471.definition
public BoundedGenericTypeVar(String s, int offset, Menge<Type> t, int endOffset)
// ino.end
// ino.method.BoundedGenericTypeVar.26471.body
{
super(s, offset);
throw new NotImplementedException();
}
// ino.end
*/
// ino.method.BoundedGenericTypeVar.29409.definition
public BoundedGenericTypeVar(String s, Menge<ObjectType> bounds, SyntaxTreeNode parentClass, int offset, int endOffset)
// ino.end
// ino.method.BoundedGenericTypeVar.29409.body
{
super(s, parentClass ,offset);
if(bounds != null)for(Type t : bounds){
//if(t!=null)this.extendVars.add(t);
}
//this.genericTypeVar = new RefType(s,offset);
this.bounds = bounds;
this.endOffset = endOffset;
}
// ino.end
@Override
public int getEndOffset(){
return this.endOffset;
}
// ino.method.getBounds.26474.definition
public Menge<ObjectType> getBounds()
// ino.end
// ino.method.getBounds.26474.body
{
return bounds;
}
// ino.end
@Override
public ConstraintsSet TYPE(TypeAssumptions ass) {
ConstraintsSet ret = super.TYPE(ass);
//ass.addGenericVarAssumption(this);
//Die Type methode der BoundedGenericTypeVar schreibt zusätzlich noch die Constraints ¼r die bounds
Menge<ObjectType> tempBounds = new Menge<>();
if(this.bounds != null){
for(ObjectType ev : this.bounds){
Type extendsType = ev.TYPE(ass, this);
if(extendsType == null)throw new TypeinferenceException("Der Typ "+ev.getName()+" ist nicht korrekt", this);
//TODO: ??? stimmt der Cast???
tempBounds.add((ObjectType)extendsType);
//ret.add(new SingleConstraint(ass.getTypeFor(this, this), extendsType ));
}
}
this.bounds = tempBounds;
return ret;
}
// ino.method.addBound.26480.definition
public void addBound(ObjectType bound)
// ino.end
// ino.method.addBound.26480.body
{
bounds.addElement(bound);
}
// ino.end
// ino.method.clone.26483.definition
public BoundedGenericTypeVar clone()
// ino.end
// ino.method.clone.26483.body
{
return new BoundedGenericTypeVar(this.getName().toString(), this.getBounds(), this.getParentClass(), getOffset(), this.getEndOffset());
}
// ino.end
// ino.method.toString.26486.definition
public String toString()
// ino.end
// ino.method.toString.26486.body
{
return "BoGTV " + this.getName();
}
// ino.end
@Override
public Menge<SyntaxTreeNode> getChildren() {
Menge<SyntaxTreeNode> ret = super.getChildren();
ret.addAll(this.bounds);
return ret;
}
}
// ino.end

View File

@ -1,8 +1,7 @@
package de.dhbwstuttgart.syntaxtree.type;
import de.dhbwstuttgart.typeinference.Menge;
import de.dhbwstuttgart.bytecode.ClassGenerator;
import de.dhbwstuttgart.parser.JavaClassName;
import de.dhbwstuttgart.typecheck.JavaClassName;
import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;
import de.dhbwstuttgart.typeinference.JavaCodeResult;
import de.dhbwstuttgart.typeinference.ResultSet;
@ -23,9 +22,9 @@ public class ExtendsWildcardType extends WildcardType implements ITypeContainer,
* Author: Arne ¼dtke<br/>
* Standard Konstruktor ¼r eine ExtendsWildcard
*/
public ExtendsWildcardType (int offset, ObjectType extendsType)
public ExtendsWildcardType (int offset, RefType extendsType)
{
super(extendsType, extendsType.getParent(), offset);
super(extendsType, offset);
this.name = new JavaClassName(this.toString());
}
@ -81,16 +80,6 @@ public class ExtendsWildcardType extends WildcardType implements ITypeContainer,
}
}
/**
* Author: Arne ¼dtke<br/>
* Gibt die passende FreshWildcardType Klasse zurück.
* Wird ¼r CaptureConversion verwendet
*/
public FreshExtendsWildcardType GetFreshWildcardType()
{
return new FreshExtendsWildcardType(this.innerType,this.getParent(),-1);
}
/**
* Author: Arne ¼dtke<br/>
* Das gleiche wie get_ExtendsType().

View File

@ -1,95 +0,0 @@
package de.dhbwstuttgart.syntaxtree.type;
import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;
public class FreshExtendsWildcardType extends FreshWildcardType implements IMatchable {
private ObjectType extendsBoundType;
/**
* Author: Arne Lüdtke<br/>
* Standard Konstruktor für eine FreshExtendsWildcard
*/
public FreshExtendsWildcardType(ObjectType extendsBound,SyntaxTreeNode parent ,int offset)
{
super(parent,offset);
this.extendsBoundType = extendsBound;
}
/**
* Author: Arne Lüdtke<br/>
* Privater Konstruktor für clone
*/
private FreshExtendsWildcardType(ObjectType extendsBound ,SyntaxTreeNode parent,int offset, String name)
{
super(parent,offset,name);
this.extendsBoundType = extendsBound;
}
/**
* Author: Arne Lüdtke<br/>
* Gibt String Entsprechung zurück.
*/
public String toString()
{
String s = "FEWCT " + this.name;
if(extendsBoundType != null)
s += " " + extendsBoundType.toString();
return s;
}
/**
* Author: Arne Lüdtke<br/>
* Gibt einen Klon der Wildcard zurück.
* Der Innere Typ wird auch geklont
*/
public FreshExtendsWildcardType clone()
{
return new FreshExtendsWildcardType(this.extendsBoundType.clone(),this.getParent(),getOffset(),this.name.toString());
}
/**
* Author: Arne Lüdtke<br/>
* Gibt die Grenze der Wildcard zurück
*/
public ObjectType get_ExtendsBound()
{
return extendsBoundType;
}
/**
* Author: Arne Lüdtke<br/>
* Prüft, ob zwei Objekte gleich sind. NICHT INSTANZGLEICH
*/
public boolean equals(Object obj)
{
if(obj instanceof FreshExtendsWildcardType)
{
FreshExtendsWildcardType FEWT = (FreshExtendsWildcardType)obj;
return this.get_ExtendsBound().equals(FEWT.get_ExtendsBound());
}
else
return false;
}
/**
* Author: Arne Lüdtke<br/>
* Gibt die passende ExtendsWildcardType Klasse zurück.
* Wird für smaller4 verwendet
*/
public ExtendsWildcardType get_WildcardType()
{
return new ExtendsWildcardType(this.getOffset(),this.get_ExtendsBound());
}
/**
* Author: Arne Lüdtke<br/>
* Gibt den Typen zurück, der bei einem match im Unify verwendet werden soll.
* Wird über IMatchable implementiert.
*/
public Type getMatchType()
{
return this.get_ExtendsBound();
}
}

View File

@ -1,95 +0,0 @@
package de.dhbwstuttgart.syntaxtree.type;
import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;
public class FreshSuperWildcardType extends FreshWildcardType implements IMatchable {
private ObjectType superBoundType;
/**
* Author: Arne ¼dtke<br/>
* Standard Konstruktor ¼r eine FreshSuperWildcard
*/
public FreshSuperWildcardType(ObjectType superBound ,SyntaxTreeNode parent, int offset)
{
super(parent,offset);
this.superBoundType = superBound;
}
/**
* Author: Arne ¼dtke<br/>
* Privater Konstruktor ¼r clone
*/
private FreshSuperWildcardType(ObjectType superBound,SyntaxTreeNode parent,int offset, String name)
{
super(parent,offset,name);
this.superBoundType = superBound;
}
/**
* Author: Arne ¼dtke<br/>
* Gibt String Entsprechung zurück.
*/
public String toString()
{
String s = "FSWCT " + this.name;
if(superBoundType != null)
s += " " + superBoundType.toString();
return s;
}
/**
* Author: Arne ¼dtke<br/>
* Gibt einen Klon der Wildcard zurück.
* Der Innere Typ wird auch geklont
*/
public FreshSuperWildcardType clone()
{
return new FreshSuperWildcardType((ObjectType) this.superBoundType.clone(),this.getParent(),getOffset(),this.name.toString());
}
/**
* Author: Arne ¼dtke<br/>
* Gibt die Grenze der Wildcard zurück
*/
public ObjectType get_SuperBound()
{
return superBoundType;
}
/**
* Author: Arne ¼dtke<br/>
* Prüft, ob zwei Objekte gleich sind. NICHT INSTANZGLEICH
*/
public boolean equals(Object obj)
{
if(obj instanceof FreshSuperWildcardType)
{
FreshSuperWildcardType FSWT = (FreshSuperWildcardType)obj;
return this.get_SuperBound().equals(FSWT.get_SuperBound());
}
else
return false;
}
/**
* Author: Arne ¼dtke<br/>
* Gibt die passende SuperWildcardType Klasse zurück.
* Wird ¼r smaller4 verwendet
*/
public SuperWildcardType get_WildcardType()
{
return new SuperWildcardType(this.getOffset(),this.get_SuperBound());
}
/**
* Author: Arne ¼dtke<br/>
* Gibt den Typen zurück, der bei einem match im Unify verwendet werden soll.
* Wird über IMatchable implementiert.
*/
public Type getMatchType()
{
return this.get_SuperBound();
}
}

View File

@ -1,180 +0,0 @@
package de.dhbwstuttgart.syntaxtree.type;
import de.dhbwstuttgart.typeinference.Menge;
import de.dhbwstuttgart.bytecode.ClassGenerator;
import de.dhbwstuttgart.parser.JavaClassName;
import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;
import de.dhbwstuttgart.typeinference.JavaCodeResult;
import de.dhbwstuttgart.typeinference.ResultSet;
import de.dhbwstuttgart.typeinference.TypeinferenceResultSet;
import de.dhbwstuttgart.typeinference.exceptions.NotImplementedException;
public class FreshWildcardType extends ObjectType {
private static String strNextName = "A";
private Menge<Type> upperBounds = new Menge<Type>();
/**
* Author: Arne ¼dtke<br/>
* Standard Konstruktor ¼r eine FreshWildcard
*/
public FreshWildcardType(SyntaxTreeNode parent, int offset)
{
super(parent, offset);
this.name = makeNewName();
}
/**
* Author: Arne ¼dtke<br/>
* Protected Konstruktor ¼r clone.
* Protected, da vererbte Klassen ihn verwenden ¼ssen.
*/
protected FreshWildcardType(SyntaxTreeNode parent, int offset, String name)
{
super(parent, offset);
this.name = new JavaClassName(name);
}
/**
* Author: Arne ¼dtke<br/>
* Gibt String Entsprechung zurück.
*/
public String toString()
{
String s = "FWCT " + this.name;
if(upperBounds.size() > 0)
{
s += "|";
for(int i = 0;i<upperBounds.size();i++)
{
if(i<upperBounds.size()-1)
s += upperBounds.elementAt(i).toString() + " & ";
else
s += upperBounds.elementAt(i).toString();
}
}
return s;
}
/**
* Author: Arne ¼dtke<br/>
* Gibt einen Klon der Wildcard zurück.
* Der Innere Typ wird auch geklont
*/
public FreshWildcardType clone()
{
return new FreshWildcardType(this.getParent(),getOffset(),this.name.toString());
}
/**
* Author: Arne ¼dtke<br/>
* Prüft, ob zwei Objekte gleich sind. NICHT INSTANZGLEICH
*/
public boolean equals(Object obj)
{
//Da die Namensgebung von Typeplaceholdern und FreshWildcards identisch ist,
//und im Type nur auf Namen geprüft wird muss verhindert werden, dass ausversehen True zurückgegeben wird,
//Wenn eine FreshWildcard mit einem TypePlaceholder verglichen wird.
return (obj instanceof FreshWildcardType) && super.equals(obj);
}
/**
* Erzeugt einen neuen Namen, und gibt diesen zurück
* Methode aus TypePlaceholder kopiert
*/
private static JavaClassName makeNewName()
{
// luar: Methode aus TypePlaceholder kopiert.
String strReturn = strNextName;
// ¯Â¿Â½chster Name berechnen und in strNextName speichern
inc( strNextName.length() - 1 );
return new JavaClassName(strReturn);
}
/**
* Hilfsmethode ¼r makeNewName
* Methode aus TypePlaceholder kopiert
*/
private static void inc(int i)
{
// luar: Methode aus TypePlaceholder kopiert.
if ( i == -1 )
{
strNextName = "A" + strNextName;
return;
}
char cBuchstabe = (char)(strNextName.charAt( i ));
cBuchstabe++;
if ( cBuchstabe - 65 > 25 )
{
// aktuelle Stelle: auf A zuruecksetzen
manipulate( i, 'A' );
// vorherige Stelle erh�hen
inc( i - 1 );
}
else
{
// aktueller Buchstabe �ndern
manipulate( i, cBuchstabe );
}
}
/**
* Hilfsmethode ¼r makeNewName
* Methode aus TypePlaceholder kopiert
*/
private static void manipulate( int nStelle, char nWert )
{
// luar: Methode aus TypePlaceholder kopiert.
String strTemp = "";
for( int i = 0; i < strNextName.length(); i++)
{
if ( i == nStelle )
strTemp = strTemp + nWert;
else
strTemp = strTemp + strNextName.charAt( i );
}
strNextName = strTemp;
}
/**
* Author: Arne ¼dtke<br/>
* Gibt die passende WildcardType Klasse zurück.
* Wird ¼r smaller4 verwendet
*/
public WildcardType get_WildcardType()
{
return new WildcardType(null, this.getParent(),this.getOffset());
}
/**
* Author: Arne ¼dtke<br/>
* Gibt den Menge der oberen Grenzen zurück
*/
public Menge<Type> get_UpperBounds()
{
return this.upperBounds;
}
/**
* Author: Arne ¼dtke<br/>
* Setzt den Menge der oberen Grenzen
*/
public void set_UpperBounds(Menge<Type> bounds)
{
this.upperBounds = bounds;
}
@Override
public JavaCodeResult printJavaCode(ResultSet resultSet) {
throw new NotImplementedException();
}
@Override
public org.apache.bcel.generic.Type getBytecodeType(ClassGenerator cg, TypeinferenceResultSet rs) {
// TODO: Bytecode
return null;
}
}

View File

@ -2,22 +2,13 @@ package de.dhbwstuttgart.syntaxtree.type;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import de.dhbwstuttgart.typeinference.FunNInterface;
import de.dhbwstuttgart.typeinference.Menge;
import de.dhbwstuttgart.typeinference.TypeinferenceResultSet;
import de.dhbwstuttgart.bytecode.ClassGenerator;
import de.dhbwstuttgart.parser.JavaClassName;
import de.dhbwstuttgart.syntaxtree.Method;
import de.dhbwstuttgart.syntaxtree.ParameterList;
import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;
import de.dhbwstuttgart.typecheck.JavaClassName;
import de.dhbwstuttgart.syntaxtree.factory.NameGenerator;
import de.dhbwstuttgart.typeinference.assumptions.MethodAssumption;
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
import de.dhbwstuttgart.typeinference.exceptions.DebugException;
import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException;
/**
* @see Spezifikation "Complete Typeinference in Java 8" von Martin Plümicke
@ -30,8 +21,8 @@ import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException;
*/
public class FunN extends RefType {
private Type R;
private List<? extends Type> T;
private RefType R;
private List<? extends RefType> T;
/**
* @author Andreas Stadelmeier, a10023
@ -41,8 +32,8 @@ public class FunN extends RefType {
* @param T
* @return
*/
public FunN(Type R, List<? extends Type> T) {
super("",null,0);
public FunN(RefType R, List<? extends RefType> T) {
super("",0);
if(T==null || R == null)throw new NullPointerException();
setT(T);
setR(R);
@ -53,7 +44,7 @@ public class FunN extends RefType {
* Spezieller Konstruktor um eine FunN ohne Returntype zu generieren
protected FunN(List<? extends Type> list){
super("",null,0);
super("",0);
if(list==null)throw new NullPointerException();
setT(list);
this.name = new JavaClassName("Fun"+list.size());//getName();
@ -67,14 +58,14 @@ public class FunN extends RefType {
* @param parameterCount
*/
public FunN(int parameterCount) {
super("",null,0);
super("",0);
if(parameterCount<0)throw new RuntimeException("Anzahl der Parameter muss >0 sein");
Menge<Type> t = new Menge<Type>();
List<RefType> t = new ArrayList<>();
for(int i=0;i<parameterCount;i++){
//t.add(TypePlaceholder.fresh(this));
t.add(new GenericTypeVar(NameGenerator.makeNewName(), this, -1));
t.add(new GenericTypeVar(NameGenerator.makeNewName(), -1));
}
setR(new GenericTypeVar(NameGenerator.makeNewName(), this, -1));
setR(new GenericTypeVar(NameGenerator.makeNewName(), -1));
setT(t);
this.name = new JavaClassName("Fun"+parameterCount);
@ -85,47 +76,30 @@ public class FunN extends RefType {
* Dabei werden bestimmte, von RefType geerbte, Parameter angepasst. Dies ist wichtig ¼r den Typinferenzalgorithmus.
*/
private void calculateNewParalist(){
Menge<Type> t = new Menge<Type>();
List<RefType> t = new ArrayList<>();
if(R!=null)t.add(R);
if(T!=null)t.addAll(T);
for(Type type : t){
for(RefType type : t){
if(type instanceof WildcardType){
throw new DebugException("Der FunN-Typ darf keine Wildcards in den Parameter enthalten");
}
}
this.set_ParaList(t);
this.parameter = t;
}
protected void setT(List<? extends Type> list){
protected void setT(List<? extends RefType> list){
this.T = list;
calculateNewParalist();
}
protected void setR(Type R){
protected void setR(RefType R){
this.R = R;
calculateNewParalist();
}
/*
@Override
public String getName(){
String ret = "FunN<"+R.toString();
for(Type t : T){
ret += ", " + t.toString();
}
ret += ">";
return ret;
}
*/
public int getTypeLineNumber() {
// TODO Auto-generated method stub
return 0;
}
public String getBytecodeInvokeDynamicSignature(ClassGenerator cg, TypeinferenceResultSet rs) {
String ret = "(";
for(Type t : T){
for(RefType t : T){
ret+=t.getBytecodeType(cg, rs).getSignature();
}
ret +=")";
@ -135,62 +109,11 @@ public class FunN extends RefType {
public String getBytecodeInvokeDynamicSignatureUpperBound(ClassGenerator cg) {
String ret = "(";
for(Type t : T){
for(RefType t : T){
ret+=cg.getInstructionFactory().createObjectType().getSignature();
}
ret +=")";
ret += cg.getInstructionFactory().createObjectType().getSignature();
return ret;
}
@Override
public Type TYPE(TypeAssumptions ass, SyntaxTreeNode parent){
//FunN Typen müssen nicht geprüft werden. Sie werden schließlich nur von unserem Typinferenzalgorithmus erstellt:
List<Type> paraList = new ArrayList<>();
for(Type t : this.T){
Type toAdd = t.TYPE(ass, parent);
//if(toAdd == null)throw new TypeinferenceException("Typ "+toAdd+" ist in den Assumptions nicht vorhanden",this);
paraList.add(toAdd);
}
FunN ret = new FunN(this.R.TYPE(ass, parent),paraList);
return ret;
}
public FunNInterface getCorrespondingInterface(){
return null;
}
/*
@Override
public JavaCodeResult printJavaCode(ResultSet resultSet){
//String ret = super.printJavaCode(resultSet) + (T!=null ? this.T.size() : 0) +"<";
JavaCodeResult ret = new JavaCodeResult("Fun" + (T!=null ? this.T.size() : 0) +"<");
ret .attach( this.R.printJavaCode(resultSet)).attach(", ");
Iterator<Type> it = T.iterator();
while(it.hasNext()){
Type t = it.next();
ret.attach( t.printJavaCode(resultSet));
if(it.hasNext())ret.attach(", ");
}
//ret = ret.substring(0, ret.length()-2);
return ret.attach(">");
}
*/
/**
* Die Clone-Methode von RefType darf von FunN NICHT überschrieben werden.
@Override
public FunN clone()
{
FunN ret = null;
Menge<Type> clonepara = new Menge<Type>();
for(int i = 0; i< this.T.size(); i++)
{
clonepara.addElement(((Type)this.T.elementAt(i)).clone());
}
ret = new FunN(this.R.clone(),clonepara);
ret.setPrimitiveFlag(this.getPrimitiveFlag());
return ret;
}
*/
}

View File

@ -1,14 +1,10 @@
package de.dhbwstuttgart.syntaxtree.type;
import java.util.Iterator;
import de.dhbwstuttgart.typeinference.Menge;
import java.util.ArrayList;
import java.util.List;
import de.dhbwstuttgart.parser.JavaClassName;
import de.dhbwstuttgart.syntaxtree.Method;
import de.dhbwstuttgart.syntaxtree.ParameterList;
import de.dhbwstuttgart.typeinference.assumptions.MethodAssumption;
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
import de.dhbwstuttgart.typecheck.JavaClassName;
/**
* FunVoid<T1,...,TN> {
@ -19,8 +15,8 @@ import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
*/
public class FunVoidN extends FunN {
private Type R;
private Menge<Type> T;
private RefType R;
private List<RefType> T;
/**
* @author Andreas Stadelmeier, a10023
@ -29,8 +25,8 @@ public class FunVoidN extends FunN {
* @param T
* @return
*/
public FunVoidN(Menge<Type> T) {
super(T.size());
public FunVoidN(List<RefType> T) {
super(null,T);
this.setR(new Void(this, -1));
this.setT(T);
this.name = new JavaClassName("FunVoid"+T.size());
@ -52,9 +48,9 @@ public class FunVoidN extends FunN {
* Dabei werden bestimmte, von RefType geerbte, Parameter angepasst. Dies ist wichtig ¼r den Typinferenzalgorithmus.
*/
private void calculateNewParalist(){
Menge<Type> t = new Menge<Type>();
List<RefType> t = new ArrayList<>();
if(T!=null)t.addAll(T);
this.set_ParaList(t);
this.parameter = t;
}
}

Some files were not shown because too many files have changed in this diff Show More