1
0

Compare commits

...

68 Commits

Author SHA1 Message Date
bee92ef11d Parser package-Struktur umstellen 2017-01-27 13:20:22 +01:00
a4dc47cc4e Merge branch 'antlr' of ssh://gohorb.ba-horb.de/bahome/projekt/git/JavaCompilerCore into antlr 2017-01-20 13:01:08 +01:00
10ede1ba98 Entfernen von unnötigen ino.* Kommentaren 2017-01-20 13:00:25 +01:00
a77b65e65c Extend converter for modifiers by strictfp. 2017-01-18 15:58:34 +01:00
a1bbd8b11e Implement Strictfp modifier. 2017-01-18 15:55:07 +01:00
e8537c3886 TODO cleanup 2017-01-18 15:12:16 +01:00
c3320858a3 RunParser no handles line breaks.This should also fix problems with
comments.
2017-01-18 13:27:17 +01:00
68476f9f96 * Implemented converter for Modifier.
* Missing getters etc. in some classes added.
2017-01-18 00:45:46 +01:00
fbfa407c26 More converters & cleanup. 2017-01-17 20:59:42 +01:00
5814cac83f Start rewriting converters to simplify readability etc. 2017-01-17 12:34:23 +01:00
9ef41280ca * Implement missing constructor for Modifiers.
* TODO: convert for Modifier
2017-01-17 00:58:03 +01:00
0db15bffa8 Begin rewriting of convert for TypeDecl. 2017-01-16 23:32:12 +01:00
4c79023889 Implement base constructor in ClassOrInterface. 2017-01-16 14:28:22 +01:00
e4e98797fc Extend constructor of SourceFile. 2017-01-11 16:42:02 +01:00
647196bf16 * Start implementing "getters and setters" for
symtaxtree.ClassOrInterface (=no choice!!!).
* Start implementing converters TypeDeclerytion -> Class.
2017-01-10 23:44:19 +01:00
3c6ffcf4d8 * "Normal" class and interface names can now be resolved.
* TODO: line comments
2017-01-10 22:20:44 +01:00
fb10220da9 * Set JavaClassName constroctur to public.
* Implemented "class resolution" for interfaces.
2017-01-10 20:07:23 +01:00
599c8b2573 * SyntaxTreeGenerator: Implemented method to get package name of
CompilationUnitCtx (ongoing).
* RunParser: test methods
2017-01-10 17:42:20 +01:00
f0028f6aaf Minor changes (nameReg/constructor). 2016-12-21 15:49:38 +01:00
5f61d478fa Class ändern zu ClassOrInterface 2016-12-21 15:46:28 +01:00
aed261c807 JavaClassName aufräumen 2016-12-21 15:39:07 +01:00
3ab96a3ed7 Syntaxbaum bereinigen. Allen Code löschen. Nur Struktur bleibt erhalten 2016-12-16 00:00:37 +01:00
e84d6373c7 Aufräumen 2016-12-15 17:02:39 +01:00
a35bcd490b Merge branch 'antlr' of ssh://gohorb.ba-horb.de/bahome/projekt/git/JavaCompilerCore into antlr 2016-12-15 16:28:26 +01:00
40ba5fb621 Beispiel für ANTLR Parser 2016-12-15 16:28:12 +01:00
ad02e94967 notes parse_tree 2016-12-15 16:17:40 +01:00
c34b3c4c14 Aufräumen 2016-12-15 16:00:28 +01:00
01a954ca68 TypeCheck package 2016-12-15 15:45:23 +01:00
5c6b001ae1 Merge branch 'antlr' of ssh://gohorb.ba-horb.de/bahome/projekt/git/JavaCompilerCore into antlr 2016-12-15 15:35:26 +01:00
fc43cd11da Aufräumen 2016-12-15 15:35:14 +01:00
e1d68291c9 Added some basic handling of package declarations. 2016-12-15 15:01:57 +01:00
b0a6585252 Small changes, i.e. RunParser now reads from System.in. 2016-12-15 13:35:07 +01:00
81e223334b Created RunParser which is supposed the main class (still rather
experimental).
2016-12-15 12:05:23 +01:00
82a1e86186 * Started implementing CompilationUnitEvaluator.java which is supposed to be the base
class for syntax tree construction.
* Deleted JavaClassName and JavaClassRegistry as they cannot be compiled
so far (backups exist).
2016-12-15 11:21:33 +01:00
aff39ba442 Type löschen 2016-12-09 04:34:50 +01:00
343c7d3a55 Merge branch 'antlr' of /home/janulrich/Development/intellijworkspace/../eclipseworkspace/eclipseWorkspaceHorb/JavaCompilerCore into antlr 2016-12-07 14:32:56 +01:00
c1cbb78fe5 Aufräumen 2016-12-07 14:32:48 +01:00
4e43de987d Merge branch 'antlr' of ssh://gohorb.ba-horb.de/bahome/projekt/git/JavaCompilerCore into antlr 2016-12-07 14:06:19 +01:00
717fd5d53e Field anpassen 2016-12-02 01:23:01 +01:00
d9e6ef6e47 Parser now handles untyped method declarations but this needs further
inspection as constructors are not handled properly.
2016-11-29 21:08:53 +01:00
b2e5555da5 Grammar now supports untyped parameters in method declarations. 2016-11-29 19:46:07 +01:00
c5ea9a3464 Grammar now supports untyped field declarations. 2016-11-29 18:34:33 +01:00
52a5e54c3a Recompile grammer due to some technical problems. 2016-11-29 18:31:50 +01:00
264ede100c Create list with notes/questions/problems. 2016-11-23 00:43:57 +01:00
d651a6cdff Parser austauschen 2016-11-16 14:51:45 +01:00
c9e3743fb5 Merge branch 'antlr' of ssh://gohorb.ba-horb.de/bahome/projekt/git/JavaCompilerCore into antlr 2016-11-16 14:33:38 +01:00
7d38c9af43 Added package declaration to sources. 2016-11-16 14:32:51 +01:00
cdb1850668 ANTLR Lib an classpath anfügen 2016-11-16 14:28:28 +01:00
90b6e81195 Merge branch 'antlr' of ssh://gohorb.ba-horb.de/bahome/projekt/git/JavaCompilerCore into antlr 2016-11-16 14:17:47 +01:00
7606aee9c3 Unnötige Datein in bin löschen 2016-11-16 14:17:38 +01:00
7504211df2 * Add base antlr grammer and corresponding classes.
* Add antlr4 runtime library.
2016-11-16 14:09:33 +01:00
6a4cb673bf Mergen... (nicht fertig) 2016-11-11 11:01:55 +01:00
accbe5bbfc Beginnen der BytecodeTypeFactory 2016-11-09 16:59:08 +01:00
c4aff43f71 NameGenerator einführen 2016-10-28 18:32:05 +02:00
107201c00c Fehler in FunN Generierung beheben 2016-10-28 18:31:42 +02:00
e60e6b622c Bugfix 2016-10-07 14:12:18 +02:00
a33ce04734 modified 2016-09-30 12:48:41 +02:00
b05b0ea5df Syntaxbaum anpassen 2016-09-30 12:46:02 +02:00
a1227a8b1b Expr und ExprStmt ändern 2016-09-20 15:18:13 +02:00
a5c34896ba Fehler in Lambda-Generierung fixen 2016-09-16 14:26:18 +02:00
bc812ad083 Aufräumen 2016-09-16 13:25:20 +02:00
1ac500715b Aufräumen 2016-09-13 17:32:22 +02:00
5be508e943 Beginnen der AST Anpassungen für das ANTLR-Projekt. Constructor-Aufrufe ändern. UsedID entfernen. parserPostProcessing entfernen. Anpassungen am AST Layout. 2016-09-10 00:40:17 +02:00
aa6a6beb93 StackMapTable-Fix 2016-08-25 19:52:06 +02:00
dbe09c237c Lambda Bytecodegenerierung implementieren 2016-08-17 00:45:14 +02:00
592af65c08 Einführen von BCEL 6.1 2016-07-21 16:36:53 +02:00
25329cd39e Einführen von BCEL 6.1 2016-07-21 16:36:33 +02:00
5aebc06337 Fehlerhaften Filter auslassen 2016-07-21 16:20:37 +02:00
635 changed files with 27519 additions and 46398 deletions
.classpath
.settings
bin
doc/LambdaJavadoc/de/dhbwstuttgart
lib
src/de/dhbwstuttgart
JvmDisassembler
bytecode
core
logger
parser
syntaxtree
BasicAssumptionClass.javaClass.javaClassBody.javaClassHelper.javaClassOrInterface.javaConstant.javaConstructor.javaExceptionList.javaField.javaFieldDeclaration.javaFormalParameter.javaGTVDeclarationContext.javaGeneric.javaGenericDeclarationList.javaGenericTypeVar.javaImportDeclarations.javaInterface.javaInterfaceBody.javaMethod.javaNullSyntaxTreeNode.javaParameterList.javaSourceFile.javaSyntaxTreeNode.java
factory
misc
modifier
operator
statement
type
typecheck
typeinference
test
KomplexeMenge
bytecode
ASTBytecodeTest.javaAssign.javAssignTest.javaBinary.javBinary2.javBinaryTest.javaBinaryTest2.javaBoolLit.javBoolLitTest.javaCharLitTest.javaCondition.javConditionTest.javaEmptyClass.javEmptyClassTest.javaFieldDeclaration.javFieldDeclarationTest.javaForTest.javForTest.javaId.javIdTest.javaIdentity.javIdentityField.javIdentityFieldTest.javaIdentityTest.javaIfElseIfStatement.javIfElseIfStatementTest.javaIfElseStatement.javIfElseStatementTest.javaIfStatement.javIfStatementTest.javaLambdaExpr.javLambdaExpr2.javLambdaExpr2Test.javaLambdaExprTest.javaMain.javMainTest.javaMatrix_lambda.javMatrix_lambda2.javMatrix_lambda3.javMatrix_lambdaTest.javaMatrix_lambdaTest2.javaMatrix_lambdaTest3.javaMethodAndVariable.javMethodCall.javMethodCallTest.javaMethodEmpty.javMethodEmpty.javaMethodEmptyRetType.javMethodEmptyRetType.javaMethodsAndVariableTest.javaMultiClass.javMultiClassTest.javaNewArray.javNewClass.javNewClassTest.javaNewStatement.javNewStatementTest.javaParameter.javParameterTest.javaPostDecrement.javPostDecrement.javaPostIncrement.javPostIncrement.javaReturn.javReturnTest.javaRunnable.javRunnableTest.javaSingleClassTester.javaSourceFileBytecodeTest.javaStringLitTest.javStringLitTest.javaSystemOutPrintln.javSystemOutPrintlnTest.javaUninitializedVariable.javUninitializedVariableTest.javaVariable.javVariableMultimethods.javVariableMultimethodsTest.javaVariableTest.javaWhileTest.javWhileTest.java
operators
stackmaptable
types
parser
plugindevelopment
InsertSingleTypeTest.java
MartinTestCases
MethodTypeInsertTest.javMethodTypeInsertTest.javaMethodTypeInsertTestSolution.javParameterInsertTest.javaParameterTypeInsertTest.javParameterTypeInsertTestSolution.javSingleTypeInsertTest.javSyntaxTreeTests.javaTypeInsertSetEqualTest.javTypeInsertTester.java
TypeInsertTests
.LambdaTest2_3.jav.log.swpAdd.javAdd.javaAnalysis.txtBoundedGenericTest.javBoundedGenericsTest.javaConstructorTest.javConstructorTest.javaFunNInsertTest.javFunNInsertTest.javaFunVoid.javFunVoid.javaGenTypeTest.javGenTypeTest.javaGenericParaListInsertTest.javGenericParaListInsertTest.javaGenericParaListInsertTest2.javGenericParaListInsertTest2.javaGenericTypeVarTest.javGenericTypeVarTest.javaGenericTypeVarTest2.javGenericTypeVarTest2.javaGenericVarInsertTest.javGenericVarInsertTest.javaGenericVarTest.javGenericVarTest.javaGenericVarTest2.javGenericVarTest2.javaGenericVarTest3.javGenericVarTest3.javaId.javId.javaImportSubClassTest.javImportSubClassTest.javaImportTest.javImportTest.javaImportTest2.javImportTest2.javaIntTest.javIntTest.javaLambdaTest1.javLambdaTest1.javaLambdaTest10.javLambdaTest10.javaLambdaTest11.javLambdaTest11.javaLambdaTest12.javLambdaTest12.javaLambdaTest13.javLambdaTest13.javaLambdaTest14.javLambdaTest14.javaLambdaTest15.javLambdaTest15.javaLambdaTest16.javLambdaTest16.javaLambdaTest17.javLambdaTest17.javaLambdaTest18.javLambdaTest18.javaLambdaTest19.javLambdaTest19.javaLambdaTest2.javLambdaTest2.javaLambdaTest20.javLambdaTest20.javaLambdaTest21.javLambdaTest22.javLambdaTest23.javLambdaTest23.javaLambdaTest24.javLambdaTest24.javaLambdaTest25.javLambdaTest25.javaLambdaTest26.javLambdaTest26.javaLambdaTest27.javLambdaTest27.javaLambdaTest28.javLambdaTest28.javaLambdaTest29.javLambdaTest29.javaLambdaTest2_2.javLambdaTest2_2.javaLambdaTest2_3.javLambdaTest2_3.javaLambdaTest3.javLambdaTest3.javaLambdaTest4.javLambdaTest4.javaLambdaTest5.javLambdaTest5.javaLambdaTest6.javLambdaTest6.javaLambdaTest7.javLambdaTest7.javaLambdaTest8.javLambdaTest8.javaLambdaTest9.javLambdaTest9.java
LargeSourceCodeTests
Matrix.javMatrix_simple.javMatrix_simple.javaMultipleTypesInsertTester.javaMutlitpleTestCases.javaOL.javOL.javaOperatorTest.javOperatorTest.javaOverloadingExample.javOverloadingExample.javaOverloadingInMethod.javOverloadingInMethod.javaOverloadingInMethod2.javOverloadingInMethod2.javaOverloadingInMethod2Simple.javOverloadingInMethod2Simple.javaOverloadingInsertTest.javOverloadingInsertTest.javaOverloadingRecursive.javOverloadingRecursive.javaOverloadingVector.javOverloadingVectorTest.javaRecursive.javRecursive2.javRelOpTest.javRelOpTest.javaReursiveTest.javaReursiveTest2.javaSuperTest.javSuperTest.javaTest1.javTest2.javThisTest.javThisTest.javaTypedMatrixSimpleTest.javTypedMatrixTest.javUnifyPaper.javUnifyPaper.javaUnifyPaper2.javUnifyPaper2.javaWildcardTestForLambda.javWildcardTestForLambda.javaWildcardTestForLambda2.javWildcardTestForLambda2.java
VariableTypeInsertTest.javVariableTypeInsertTest.javaVariableTypeInsertTestSolution.jav
syntaxTree
unify

@ -3,8 +3,9 @@
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="test"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="lib" path="lib/commons-bcel6-6.0-SNAPSHOT.jar" sourcepath="/home/janulrich/Development/intellijworkspace/bcel/src/main"/>
<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>

@ -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

@ -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>

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

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

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

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

@ -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>

@ -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">

@ -69,9 +69,9 @@
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#fields.inherited.from.class.de.dhbwstuttgart.syntaxtree.Class">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#fields.inherited.from.class.de.dhbwstuttgart.syntaxtree.ClassOrInterface">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#methods.inherited.from.class.de.dhbwstuttgart.syntaxtree.Class">Method</a></li>
<li><a href="#methods.inherited.from.class.de.dhbwstuttgart.syntaxtree.ClassOrInterface">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
@ -100,7 +100,7 @@
<li><a href="../../../de/dhbwstuttgart/syntaxtree/GTVDeclarationContext.html" title="class in de.dhbwstuttgart.syntaxtree">de.dhbwstuttgart.syntaxtree.GTVDeclarationContext</a></li>
<li>
<ul class="inheritance">
<li><a href="../../../de/dhbwstuttgart/syntaxtree/Class.html" title="class in de.dhbwstuttgart.syntaxtree">de.dhbwstuttgart.syntaxtree.Class</a></li>
<li><a href="../../../de/dhbwstuttgart/syntaxtree/Class.html" title="class in de.dhbwstuttgart.syntaxtree">de.dhbwstuttgart.syntaxtree.ClassOrInterface</a></li>
<li>
<ul class="inheritance">
<li>de.dhbwstuttgart.syntaxtree.BasicAssumptionClass</li>
@ -137,7 +137,7 @@ extends <a href="../../../de/dhbwstuttgart/syntaxtree/Class.html" title="class i
</a>
<h3>Field Summary</h3>
<ul class="blockList">
<li class="blockList"><a name="fields.inherited.from.class.de.dhbwstuttgart.syntaxtree.Class">
<li class="blockList"><a name="fields.inherited.from.class.de.dhbwstuttgart.syntaxtree.ClassOrInterface">
<!-- -->
</a>
<h3>Fields inherited from class&nbsp;de.dhbwstuttgart.syntaxtree.<a href="../../../de/dhbwstuttgart/syntaxtree/Class.html" title="class in de.dhbwstuttgart.syntaxtree">Class</a></h3>
@ -173,7 +173,7 @@ extends <a href="../../../de/dhbwstuttgart/syntaxtree/Class.html" title="class i
</a>
<h3>Method Summary</h3>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.de.dhbwstuttgart.syntaxtree.Class">
<li class="blockList"><a name="methods.inherited.from.class.de.dhbwstuttgart.syntaxtree.ClassOrInterface">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;de.dhbwstuttgart.syntaxtree.<a href="../../../de/dhbwstuttgart/syntaxtree/Class.html" title="class in de.dhbwstuttgart.syntaxtree">Class</a></h3>
@ -287,9 +287,9 @@ extends <a href="../../../de/dhbwstuttgart/syntaxtree/Class.html" title="class i
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#fields.inherited.from.class.de.dhbwstuttgart.syntaxtree.Class">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#fields.inherited.from.class.de.dhbwstuttgart.syntaxtree.ClassOrInterface">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#methods.inherited.from.class.de.dhbwstuttgart.syntaxtree.Class">Method</a></li>
<li><a href="#methods.inherited.from.class.de.dhbwstuttgart.syntaxtree.ClassOrInterface">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>

@ -106,7 +106,7 @@ var activeTableTab = "activeTableTab";
<li><a href="../../../de/dhbwstuttgart/syntaxtree/GTVDeclarationContext.html" title="class in de.dhbwstuttgart.syntaxtree">de.dhbwstuttgart.syntaxtree.GTVDeclarationContext</a></li>
<li>
<ul class="inheritance">
<li>de.dhbwstuttgart.syntaxtree.Class</li>
<li>de.dhbwstuttgart.syntaxtree.ClassOrInterface</li>
</ul>
</li>
</ul>

@ -75,7 +75,7 @@ var activeTableTab = "activeTableTab";
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#fields.inherited.from.class.de.dhbwstuttgart.syntaxtree.Class">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#fields.inherited.from.class.de.dhbwstuttgart.syntaxtree.ClassOrInterface">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
@ -106,7 +106,7 @@ var activeTableTab = "activeTableTab";
<li><a href="../../../de/dhbwstuttgart/syntaxtree/GTVDeclarationContext.html" title="class in de.dhbwstuttgart.syntaxtree">de.dhbwstuttgart.syntaxtree.GTVDeclarationContext</a></li>
<li>
<ul class="inheritance">
<li><a href="../../../de/dhbwstuttgart/syntaxtree/Class.html" title="class in de.dhbwstuttgart.syntaxtree">de.dhbwstuttgart.syntaxtree.Class</a></li>
<li><a href="../../../de/dhbwstuttgart/syntaxtree/Class.html" title="class in de.dhbwstuttgart.syntaxtree">de.dhbwstuttgart.syntaxtree.ClassOrInterface</a></li>
<li>
<ul class="inheritance">
<li>de.dhbwstuttgart.syntaxtree.Interface</li>
@ -148,7 +148,7 @@ extends <a href="../../../de/dhbwstuttgart/syntaxtree/Class.html" title="class i
</a>
<h3>Field Summary</h3>
<ul class="blockList">
<li class="blockList"><a name="fields.inherited.from.class.de.dhbwstuttgart.syntaxtree.Class">
<li class="blockList"><a name="fields.inherited.from.class.de.dhbwstuttgart.syntaxtree.ClassOrInterface">
<!-- -->
</a>
<h3>Fields inherited from class&nbsp;de.dhbwstuttgart.syntaxtree.<a href="../../../de/dhbwstuttgart/syntaxtree/Class.html" title="class in de.dhbwstuttgart.syntaxtree">Class</a></h3>
@ -205,7 +205,7 @@ extends <a href="../../../de/dhbwstuttgart/syntaxtree/Class.html" title="class i
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.de.dhbwstuttgart.syntaxtree.Class">
<li class="blockList"><a name="methods.inherited.from.class.de.dhbwstuttgart.syntaxtree.ClassOrInterface">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;de.dhbwstuttgart.syntaxtree.<a href="../../../de/dhbwstuttgart/syntaxtree/Class.html" title="class in de.dhbwstuttgart.syntaxtree">Class</a></h3>
@ -356,7 +356,7 @@ extends <a href="../../../de/dhbwstuttgart/syntaxtree/Class.html" title="class i
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#fields.inherited.from.class.de.dhbwstuttgart.syntaxtree.Class">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#fields.inherited.from.class.de.dhbwstuttgart.syntaxtree.ClassOrInterface">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>

@ -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.Class</title>
<title>Uses of Class de.dhbwstuttgart.syntaxtree.ClassOrInterface</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.Class" class="title">Uses of Class<br>de.dhbwstuttgart.syntaxtree.Class</h2>
<h2 title="Uses of Class de.dhbwstuttgart.syntaxtree.ClassOrInterface" class="title">Uses of Class<br>de.dhbwstuttgart.syntaxtree.Class</h2>
</div>
<div class="classUseContainer">
<ul class="blockList">

@ -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>

@ -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">

@ -75,7 +75,7 @@ var activeTableTab = "activeTableTab";
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#fields.inherited.from.class.de.dhbwstuttgart.syntaxtree.Class">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#fields.inherited.from.class.de.dhbwstuttgart.syntaxtree.ClassOrInterface">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
@ -106,7 +106,7 @@ var activeTableTab = "activeTableTab";
<li><a href="../../../de/dhbwstuttgart/syntaxtree/GTVDeclarationContext.html" title="class in de.dhbwstuttgart.syntaxtree">de.dhbwstuttgart.syntaxtree.GTVDeclarationContext</a></li>
<li>
<ul class="inheritance">
<li><a href="../../../de/dhbwstuttgart/syntaxtree/Class.html" title="class in de.dhbwstuttgart.syntaxtree">de.dhbwstuttgart.syntaxtree.Class</a></li>
<li><a href="../../../de/dhbwstuttgart/syntaxtree/Class.html" title="class in de.dhbwstuttgart.syntaxtree">de.dhbwstuttgart.syntaxtree.ClassOrInterface</a></li>
<li>
<ul class="inheritance">
<li>de.dhbwstuttgart.typeinference.FunNInterface</li>
@ -148,7 +148,7 @@ extends <a href="../../../de/dhbwstuttgart/syntaxtree/Class.html" title="class i
</a>
<h3>Field Summary</h3>
<ul class="blockList">
<li class="blockList"><a name="fields.inherited.from.class.de.dhbwstuttgart.syntaxtree.Class">
<li class="blockList"><a name="fields.inherited.from.class.de.dhbwstuttgart.syntaxtree.ClassOrInterface">
<!-- -->
</a>
<h3>Fields inherited from class&nbsp;de.dhbwstuttgart.syntaxtree.<a href="../../../de/dhbwstuttgart/syntaxtree/Class.html" title="class in de.dhbwstuttgart.syntaxtree">Class</a></h3>
@ -205,7 +205,7 @@ extends <a href="../../../de/dhbwstuttgart/syntaxtree/Class.html" title="class i
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.de.dhbwstuttgart.syntaxtree.Class">
<li class="blockList"><a name="methods.inherited.from.class.de.dhbwstuttgart.syntaxtree.ClassOrInterface">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;de.dhbwstuttgart.syntaxtree.<a href="../../../de/dhbwstuttgart/syntaxtree/Class.html" title="class in de.dhbwstuttgart.syntaxtree">Class</a></h3>
@ -362,7 +362,7 @@ extends <a href="../../../de/dhbwstuttgart/syntaxtree/Class.html" title="class i
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#fields.inherited.from.class.de.dhbwstuttgart.syntaxtree.Class">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#fields.inherited.from.class.de.dhbwstuttgart.syntaxtree.ClassOrInterface">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>

BIN
lib/antlr-complete.jar Executable file

Binary file not shown.

Binary file not shown.

BIN
lib/bcel-6.1-SNAPSHOT.jar Normal file

Binary file not shown.

@ -1,3 +0,0 @@
jvmDisassebler.class
*~*
*.class

@ -1,18 +0,0 @@
package de.dhbwstuttgart.JvmDisassembler;
class GenericsTest<a,b> {
Integer k;
GenericsTest<Integer,Integer> pp;
Object j;
a meth(a arg) {
return arg;
}
<t extends Integer> t meth2(b arg, t arg2) {
return arg2;
}
}

@ -1,231 +0,0 @@
package de.dhbwstuttgart.JvmDisassembler;
import java.util.*;
import java.io.*;
import de.dhbwstuttgart.typeinference.Menge;
//GenricsTest.java Testfile fuer jvmDisassembler
class jvmDisassembler {
static int makePosByte(int code) {
return (code & 0x7f | code & 0x80);
}
static int makePosShort(int code) {
return (code & 0x7fff | code & 0x8000);
}
static long makePosInt(long code) {
return (code & 0x7fffffff | code & 0x80000000);
}
static void parse_attribute(DataInputStream d, Menge<String> const_pool) throws IOException, Exception {
int attribut_count = d.readShort();
System.out.println("attribut_count = " + attribut_count);
if (attribut_count == 0) System.out.println("attributes = {}");
else {
for (int j = 0; j < attribut_count; j++) {
System.out.println("attribut[" + j + "] =\n{");
int attribut_name_index = d.readShort();
System.out.println("attribut_name_index = " + attribut_name_index
+ " //" + const_pool.elementAt(makePosShort(attribut_name_index)));
if (const_pool.elementAt(makePosShort(attribut_name_index)).equals("Code")) {
parse_code(d, const_pool);
int exception_table_length = d.readShort();
System.out.println("exception_table_length = " + exception_table_length);
if (exception_table_length == 0) System.out.println("exception_table = {}");
else throw new Exception("exceptiones not implemented");
parse_attribute(d, const_pool);
} else {
if ((const_pool.elementAt(makePosShort(attribut_name_index)).equals("Signature"))) {
long attribut_length = d.readInt();
System.out.println("attribut_length = " + attribut_length);
int sigdescriptor_index = d.readShort();
System.out.println("descriptor_index = " + sigdescriptor_index
+ " //" + const_pool.elementAt(makePosShort(sigdescriptor_index)));
} else {
long attribut_length = d.readInt();
System.out.println("attribut_length = " + attribut_length);
for(int ll = 0; ll < attribut_length; ll++) {
System.out.println(Integer.toHexString(makePosByte(d.readByte())));
}
System.out.println("}");
}
}
System.out.println("}");
}
}
}
static void parse_code(DataInputStream d, Menge<String> const_pool) throws IOException {
long attribut_length = d.readInt();
System.out.println("attribut_length = " + attribut_length);
int max_stack = d.readShort();
System.out.println("max_stack = " + max_stack);
int max_locals = d.readShort();
System.out.println("max_locals = " + max_locals);
long code_length = makePosInt(d.readInt());
System.out.println("code_length = " + code_length);
System.out.println("code =\n{");
int code;
int codenr = 1;
for(; codenr <= code_length;) {
//CODE VERVOLLSTAENDIGEN PL 06-04-01
code = makePosByte(d.readByte());
//System.out.println("DEBUG: " + Integer.toHexString(code));
switch(code) {
case 0x4: System.out.println(" " + codenr + " iconst_1");
codenr++;
break;
case 0x2a: System.out.println(" " + codenr + " aload_0");
codenr++;
break;
case 0x2b: System.out.println(" " + codenr + " aload_1");
codenr++;
break;
case 0x2c: System.out.println(" " + codenr + " aload_2");
codenr++;
break;
case 0xac: System.out.println(" " + codenr + " ireturn");
codenr++;
break;
case 0xb0: System.out.println(" " + codenr + " areturn");
codenr++;
break;
case 0xb1: System.out.println(" " + codenr + " return");
codenr++;
break;
case 0xb7: System.out.println(" " + codenr + " invokespecial " +
d.readShort());
codenr+=3;
break;
default: System.out.println(" " + Integer.toHexString(code));
codenr++;
break;
}
}
System.out.println("}");
}
public static void main (String[] args) throws FileNotFoundException, IOException, Exception {
DataInputStream d = new DataInputStream(new FileInputStream(new File (args[0])));
int magic = d.readInt();
System.out.println("magic = 0x " + Integer.toHexString(magic));
int minor = d.readShort();
System.out.println("minor_version = " + minor);
int major = d.readShort();
System.out.println("major_version = " + major);
//CONSTANT POOL START
int constant_pool_count = makePosShort(d.readShort());
System.out.println("constant_pool_count = " + constant_pool_count);
Menge<String> const_pool = new Menge<String>();
const_pool.addElement(""); // Konstatenpool beginnt bei 1, Stelle 0 auffuellen
System.out.println("constant_pool =\n{");
short constant_pool_tag;
for (int i = 1; i < constant_pool_count; i++) {
constant_pool_tag = d.readByte();
switch(constant_pool_tag) {
//Tags vervollstaendigen PL 06-04-01
case 1: System.out.print(i + "| tag = CONSTANT_Utf8, length = ");
int length = makePosShort(d.readShort());
System.out.print(length + ", ");
byte[] bytes = new byte[length];
d.read(bytes, 0, length);
System.out.println(new String(bytes));
const_pool.addElement(new String(bytes));
break;
case 7: System.out.println(i + "| tag = CONSTANT_Class, name_index = " + d.readShort());
const_pool.addElement("");
break;
case 10: System.out.println(i + "| tag = CONSTANT_Methodref, class_index = " +
d.readShort() + ", name_and_type_index = " + d.readShort());
const_pool.addElement("");
break;
case 12:System.out.println(i + "| tag = CONSTANT_NameAndType, name_index = " +
d.readShort() + ", descriptor_index = " + d.readShort());
const_pool.addElement("");
break;
}
}
//CONSTANT POOL END
int access_flags = d.readShort();
System.out.println("access_flags = " + access_flags);
int this_class = d.readShort();
System.out.println("this_class = " + this_class);
int super_class = d.readShort();
System.out.println("super_class = " + super_class);
//INTERFACE START
int interface_count = d.readShort();
System.out.println("interface_count = " + interface_count);
if (interface_count == 0) System.out.println("interfaces ={}");
else
//Interface implementieren PL 06-04-01
throw new Exception("no interfaces implemented");
//INTERFACE END
//FIELD START
int field_count = d.readShort();
System.out.println("field_count = " + field_count);
if (field_count == 0) System.out.println("fields = {}");
else {
for(int o = 1; o <= field_count; o++) {
System.out.println("field[" + o + "] =\n{");
int faccess_flags = d.readShort();
System.out.println("access_flags = " + faccess_flags);
int fname_index = d.readShort();
System.out.println("name_index = " + fname_index);
int fdescriptor_index = d.readShort();
System.out.println("descriptor_index = " + fdescriptor_index);
parse_attribute(d, const_pool);
System.out.println("}");
}
}
//FIELD END
//METHOD START
int method_count = makePosShort(d.readShort());
System.out.println("method_count = " + method_count);
if (method_count == 0) System.out.println("methods ={}");
else {
for(int i = 1; i <= method_count; i++) {
System.out.println("method[" + i + "] =\n{");
int maccess_flags = d.readShort();
System.out.println("access_flags = " + maccess_flags);
int mname_index = d.readShort();
System.out.println("name_index = " + mname_index);
int descriptor_index = d.readShort();
System.out.println("descriptor_index = " + descriptor_index);
parse_attribute(d, const_pool);
System.out.println("}");
}
}
//METHOD END
//FILE ATTRIBUTES START
parse_attribute(d, const_pool);
//FILE ATTRIBUTES END
}
}

@ -1,194 +0,0 @@
package de.dhbwstuttgart.bytecode;
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.commons.bcel6.classfile.BootstrapMethod;
import org.apache.commons.bcel6.classfile.BootstrapMethods;
import org.apache.commons.bcel6.classfile.ConstantPool;
import org.apache.commons.bcel6.classfile.InnerClass;
import org.apache.commons.bcel6.classfile.InnerClasses;
import org.apache.commons.bcel6.classfile.JavaClass;
import org.apache.commons.bcel6.classfile.Method;
import org.apache.commons.bcel6.classfile.Signature;
import org.apache.commons.bcel6.generic.ClassGen;
import org.apache.commons.bcel6.generic.ConstantPoolGen;
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;
public class ClassGenerator extends ClassGen{
private DHBWConstantPoolGen cp;
private DHBWInstructionFactory factory;
private TypeinferenceResults tiResult;
private int lambdaMethodeNr = 0;
private Type superClass;
private Menge<TypePlaceholder> usedTPHs = new Menge<>();
private Map<String, ClassGenerator> extraClasses = new HashMap<>();
private List<String> methodsNamesAndTypes = new LinkedList<>();
private MethodGenerator methodGenerator;
public ClassGenerator(String name, Type superClass, String string, short accessflags, String[] strings, TypeinferenceResults typeinferenceResults) {
super(name,superClass.get_Name(),string,accessflags,strings, new DHBWConstantPoolGen());
this.tiResult = typeinferenceResults;
this.superClass = superClass;
cp = (DHBWConstantPoolGen) super.getConstantPool();
factory = new DHBWInstructionFactory(this, cp);
this.setMajor(52); //Java 8 Version 52.0
this.setMinor(0);
}
public DHBWInstructionFactory getInstructionFactory() {
return factory;
}
/**
* Versucht einen Type zu finden von dem dieser TPH ein Subtyp sein muss.
* @param toTPH
* @return Es gilt dann "toTPH extends Type"
*/
public org.apache.commons.bcel6.generic.Type getNearestUsedType(Type t, Menge<TypePlaceholder> usedTypes){
if(t == null){
return this.getInstructionFactory().createObjectType();
}else if(t instanceof TypePlaceholder){ //Es muss sich in diesem Fall um einen TPH handeln:
//return getNearestType((TypePlaceholder) t);
return new TypePlaceholderType((TypePlaceholder) t);
}else{
return t.getBytecodeType(this, getTypeinferenceResults().getTypeReconstructions().get(0));
}
}
public org.apache.commons.bcel6.generic.Type getNearestUsedType(TypePlaceholder toTPH){
return this.getNearestUsedType(toTPH, null);
}
public String createLambdaMethodName() {
return "lambda$methode$"+(lambdaMethodeNr++);
}
@Override
public DHBWConstantPoolGen getConstantPool(){
return this.cp;
}
@Override
public void setConstantPool(ConstantPoolGen gen){
throw new DebugException("Ungültige Operation. ClassGenerator muss ein DHBWConstantPool besitzen");
}
/**
* Anmerkung: Kann in diesem Zustand nur einmal aufgerufen werden.
* @param innerClassAttribute
*/
public void addInnerClass(InnerClass innerClassAttribute) {
//TODO: Muss vor dem ausführen von getJavaClass ausgeführt werden. getJavaClass überschreiben!
int numberOfInnerClasses = 1;
InnerClass[] innerClasses = new InnerClass[numberOfInnerClasses];
innerClasses[numberOfInnerClasses-1] = innerClassAttribute;
int innerClassesUTF8 = this.getConstantPool().addUtf8("InnerClasses");
this.addAttribute(new InnerClasses(innerClassesUTF8,numberOfInnerClasses*8+2,innerClasses,this.getConstantPool().getConstantPool()));
}
public int addBootstrapMethod(BootstrapMethod bMethod) {
int numberOfBootstrapMethods = 1;
int name_index = this.getConstantPool().addUtf8("BootstrapMethods");
int length = 2 + numberOfBootstrapMethods * 4 + bMethod.getNumBootstrapArguments() * 2;
BootstrapMethod[] bootstrap_methods = new BootstrapMethod[numberOfBootstrapMethods];
bootstrap_methods[numberOfBootstrapMethods-1] = bMethod;
BootstrapMethods bootstrapAttribute = new BootstrapMethods(name_index, length, bootstrap_methods, this.getConstantPool().getConstantPool());
this.addAttribute(bootstrapAttribute);
return numberOfBootstrapMethods-1;
}
public void addUsedTPH(TypePlaceholder tph){
if(! this.getUsedTPH().contains(tph, (a, b)->{
return a.get_Name().equals(b.get_Name()); //Vergleich auf Namensgleichheit. Was anderes zählt im Bytecode nicht
}))
{ //Nur wenn noch nicht vorhanden anfügen:
this.usedTPHs.add(tph);
}
}
public Menge<TypePlaceholder> getUsedTPH() {
return usedTPHs;
}
@Override
public JavaClass getJavaClass() {
//Hier werden die letzten Schritte vor der Klassengenerierung ausgeführt:
//Signatur setzen:
String typeParameters = this.generateParameterSignature();
String superClassSignature = this.superClass.getBytecodeSignature(this, null);
String classSignature = typeParameters + superClassSignature;
if(classSignature.length()>0){
this.addAttribute(new Signature(cp.addUtf8("Signature"),2,cp.addUtf8(classSignature),cp.getConstantPool()));
}
return super.getJavaClass();
}
private String generateParameterSignature(){
String ret = "";
if(this.getUsedTPH().size()>0){
ret += "<";
Iterator<TypePlaceholder> it = ((Menge<TypePlaceholder>)this.getUsedTPH().clone()).iterator();
while(it.hasNext()){
TypePlaceholder tph = it.next();
//ret += tph.getBytecodeMethodSignature(this);
//ret += ":";
ret += tph.getClassSignature(this, getTypeinferenceResults().getTypeReconstructions().get(0));
}
ret += ">";
}
return ret;
}
public void addExtraClass(ClassGenerator cg){
extraClasses.put(cg.getClassName(), cg);
}
public Map<String, ClassGenerator> getExtraClasses() {
return extraClasses;
}
public TypeinferenceResults getTypeinferenceResults() {
return tiResult;
}
@Override
public void addMethod(Method m) {
//TODO: Die Prüfung, ob Methode bereits vorhanden vor die Bytecodegenerierung verlegen (Beispielsweise in Method)
String methodNameAndTypes = m.getReturnType().toString()+";"+m.getName()+"("+Arrays.toString(m.getArgumentTypes());
if(methodsNamesAndTypes.contains(methodNameAndTypes)){
return;
}
methodsNamesAndTypes.add(methodNameAndTypes);
super.addMethod(m);
}
public void setMethodeGenerator(MethodGenerator methodGenerator) {
this.methodGenerator = methodGenerator;
}
public MethodGenerator getMethodGenerator() {
return methodGenerator;
}
}

@ -1,36 +0,0 @@
package de.dhbwstuttgart.bytecode;
import java.util.HashMap;
import org.apache.commons.bcel6.classfile.Constant;
import org.apache.commons.bcel6.classfile.ConstantMethodHandle;
import org.apache.commons.bcel6.classfile.ConstantMethodType;
import org.apache.commons.bcel6.generic.ConstantPoolGen;
public class DHBWConstantPoolGen extends ConstantPoolGen{
private static final long serialVersionUID = -8282768548793548585L;
private final HashMap<Constant, Integer> constantTable = new HashMap<>();
//private static final String DELIMITER = "$";
/*
public int addConstantMethodType(ConstantMethodType methodType) {
if(constantTable.containsKey(methodType))return constantTable.get(methodType);
}
public int addConstantMethodHandle(ConstantMethodHandle methodHandle) {
if(constantTable.containsKey(methodHandle))return constantTable.get(methodHandle);
int ret = this.index;
return ret;
}
*/
public int addConstant(Constant c){
if(constantTable.containsKey(c))return constantTable.get(c);
int ret = this.index;
this.constants[this.index++] = c;
constantTable.put(c, ret);
return ret;
}
}

@ -1,149 +0,0 @@
package de.dhbwstuttgart.bytecode;
import java.awt.List;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.bcel6.Constants;
import org.apache.commons.bcel6.classfile.Attribute;
import org.apache.commons.bcel6.classfile.BootstrapMethod;
import org.apache.commons.bcel6.classfile.ConstantInvokeDynamic;
import org.apache.commons.bcel6.classfile.ConstantMethodHandle;
import org.apache.commons.bcel6.classfile.ConstantMethodType;
import org.apache.commons.bcel6.classfile.InnerClass;
import org.apache.commons.bcel6.classfile.Method;
import org.apache.commons.bcel6.classfile.Signature;
import org.apache.commons.bcel6.generic.ClassGen;
import org.apache.commons.bcel6.generic.ConstantPoolGen;
import org.apache.commons.bcel6.generic.INVOKEDYNAMIC;
import org.apache.commons.bcel6.generic.InstructionFactory;
import org.apache.commons.bcel6.generic.InstructionList;
import org.apache.commons.bcel6.generic.LocalVariableInstruction;
import org.apache.commons.bcel6.generic.MethodGen;
import org.apache.commons.bcel6.generic.Type;
import de.dhbwstuttgart.syntaxtree.FormalParameter;
import de.dhbwstuttgart.syntaxtree.ParameterList;
import de.dhbwstuttgart.syntaxtree.statement.Block;
import de.dhbwstuttgart.syntaxtree.statement.Return;
import de.dhbwstuttgart.syntaxtree.type.FunN;
import de.dhbwstuttgart.typeinference.TypeinferenceResultSet;
public class DHBWInstructionFactory extends InstructionFactory{
private DHBWConstantPoolGen cp;
private ClassGenerator cg;
private static Map<String, Integer> storeIndexes = new HashMap<>();
public DHBWInstructionFactory(ClassGenerator cg, DHBWConstantPoolGen cp) {
super(cg, cp);
this.cp = cp;
this.cg = cg;
}
/**
*
* @param interfaceMethodName - Momentan immer "apply"
* @param invokeDynamicMethodType - Der Methodentyp
* @param interfaceMethodType
* @param lambdaMethod
* @return
*/
public INVOKEDYNAMIC createInvokeDynamic( String interfaceMethodName, String invokeDynamicMethodType, FunN interfaceMethodType, MethodGen lambdaMethod, TypeinferenceResultSet rs) {
//Zuerst die Bootstrap-Methode erstellen: Diese müssen dann in ein BootstrapMethods-Attribut zusammengefasst und dem Classfile hinzugefügt werden
//this.cp.addMethodref(lambdaMethod);
ArrayList<Integer> arguments = new ArrayList<Integer>();
/*
* Die Argumente für die Bootstrap-Methode. Im Decompilierten Beispiel sind das:
* #19 ()V
* #20 invokespecial Lambda3.lambda$methode$0:()V
* #19 ()V
*
* #20 ist ein MethodHandle_info Structure
* Die Argumente werden der Bootstrap Methode beim Aufrufen übergeben: @see https://docs.oracle.com/javase/8/docs/api/java/lang/invoke/LambdaMetafactory.html#metafactory-java.lang.invoke.MethodHandles.Lookup-java.lang.String-java.lang.invoke.MethodType-java.lang.invoke.MethodType-java.lang.invoke.MethodHandle-java.lang.invoke.MethodType-
* TODO: Die korrekten Argumente anfügen.
* - samMethodType - Signature and return type of method to be implemented by the function object.
* - implMethod - A direct method handle describing the implementation method which should be called (with suitable adaptation of argument types, return types, and with captured arguments prepended to the invocation arguments) at invocation time.
* - instantiatedMethodType - The signature and return type that should be enforced dynamically at invocation time. This may be the same as samMethodType, or may be a specialization of it.
*/
String lambdaTypeParameterList = "()";
ConstantMethodType lambdaMethodType1 = new ConstantMethodType(this.cp.addUtf8(interfaceMethodType.getBytecodeInvokeDynamicSignatureUpperBound(cg))); //TODO: Hier den Grund finden, warum Object stehen muss.
ConstantMethodType lambdaMethodType = new ConstantMethodType(this.cp.addUtf8(interfaceMethodType.getBytecodeInvokeDynamicSignature(cg, rs)));
int implMethodKind = 7; // 7 = InvokeSpecial @see https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-5.html#jvms-5.4.3.5
ConstantMethodHandle implMethod = new ConstantMethodHandle(implMethodKind,cg.getConstantPool().addMethodref(lambdaMethod)); //Das zweite Argument ist der MethodRef zur LambdaMethode
//Argumentliste für die Bootstrap Methode zusammensetzen:
arguments.add(cp.addConstant(lambdaMethodType1));
arguments.add(cp.addConstant(implMethod));
arguments.add(cp.addConstant(lambdaMethodType));
int innerClassIndex = cp.addClass("java.lang.invoke.MethodHandles$Lookup");
int innerClassName = cp.addUtf8("Lookup");
int outerClassIndex = cp.addClass("java.lang.invoke.MethodHandles");
int accessFlags = Constants.ACC_FINAL + Constants.ACC_STATIC + Constants.ACC_PUBLIC;
InnerClass innerClassAttribute = new InnerClass(innerClassIndex, outerClassIndex, innerClassName,accessFlags);
//Diese InnereKlasse muss später im ClassFile vorkommen, da sie von der Bootstrap Methode benutzt wird.
//TODO: Dies kann man möglicherweise auslagern. Die ClassGen Klasse erweiter, welche sich dann die InnerenKlassen mertk, welche gebraucht werden
cg.addInnerClass(innerClassAttribute);
String bootstrapSignature = "(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;";
int lambdaMetafactoryRefIndex = cp.addMethodref("java.lang.invoke.LambdaMetafactory", "metafactory", bootstrapSignature);
//reference kind 6 steht für invokestatic
int lambdaMetafactoryHandle = cp.addConstant(new ConstantMethodHandle(6, lambdaMetafactoryRefIndex));
int[] argumentsArray = new int[arguments.size()];
for(int i = 0; i<arguments.size();i++){
argumentsArray[i] = arguments.get(i);
}
BootstrapMethod bMethod = new BootstrapMethod(lambdaMetafactoryHandle, argumentsArray);
int index;
/*
* Spezifikation: @see https://docs.oracle.com/javase/specs/jvms/se8/html/index.html
*
* CONSTANT_InvokeDynamic_info structure:
* - a symbolic reference to a method handle (bootstrap_method_attr_index)
* - a method name and a method descriptor (name_and_type_index)
*
* @see https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4.10
*/
/*
*
* Was es mit der Inneren Klasse auf sich hat:
* (public static final #48= #47 of #51; //Lookup=class java/lang/invoke/MethodHandles$Lookup of class java/lang/invoke/MethodHandles
* Lösung: Ist wohl einfach nur nötig, um die Metafactory durch die Bootstrap-Methode aufzurufen
*
* TODO: Rausfinden was es mit dem NameAndType Eintrag in der InvokeDynamic_info Struktur auf sich hat:
* Für ein Runnable ()->{}; ist es: run:(LLambda3;)Ljava/lang/Runnable;
* Wieso das zusätzliche Argument vom Typ (this)
*
* TODO: bootstrap_methode den Klassenattributen hinzufügen
*
*/
int bootstrap_method_attr_index = cg.addBootstrapMethod(bMethod);
//TODO: der Typ der Lambda Methode muss den Typ von this als erstes Argument enthalten, damit this innerhalb der Lambda Methode verwendet werden kann
int invokeDynamicFunktionstyp = cp.addNameAndType(interfaceMethodName, invokeDynamicMethodType);
ConstantInvokeDynamic cInvokeDynamic = new ConstantInvokeDynamic(bootstrap_method_attr_index, invokeDynamicFunktionstyp);
index = cp.addConstant(cInvokeDynamic);
return new INVOKEDYNAMIC(index);
}
public static Type createObjectType() {
return new org.apache.commons.bcel6.generic.ObjectType("java.lang.Object");
}
public Attribute createSignatureAttribute(String signature) {
return new Signature(cp.addUtf8("Signature"),2,cp.addUtf8(signature),cp.getConstantPool());
}
}

@ -1,115 +0,0 @@
package de.dhbwstuttgart.bytecode;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Vector;
import org.apache.commons.bcel6.classfile.Attribute;
import org.apache.commons.bcel6.classfile.ConstantPool;
import org.apache.commons.bcel6.classfile.ConstantUtf8;
import org.apache.commons.bcel6.classfile.Method;
import org.apache.commons.bcel6.classfile.Signature;
import org.apache.commons.bcel6.classfile.StackMap;
import org.apache.commons.bcel6.classfile.StackMapEntry;
import org.apache.commons.bcel6.classfile.Visitor;
import org.apache.commons.bcel6.generic.BranchInstruction;
import org.apache.commons.bcel6.generic.ConstantPoolGen;
import org.apache.commons.bcel6.generic.Instruction;
import org.apache.commons.bcel6.generic.InstructionFactory;
import org.apache.commons.bcel6.generic.InstructionList;
import org.apache.commons.bcel6.generic.LocalVariableInstruction;
import org.apache.commons.bcel6.generic.MethodGen;
import org.apache.commons.bcel6.generic.StackMapTableGen;
import org.apache.commons.bcel6.generic.Type;
import org.apache.commons.bcel6.Const;
import de.dhbwstuttgart.logger.Logger;
import de.dhbwstuttgart.logger.Section;
import de.dhbwstuttgart.syntaxtree.FormalParameter;
import de.dhbwstuttgart.syntaxtree.ParameterList;
import de.dhbwstuttgart.syntaxtree.statement.Block;
import de.dhbwstuttgart.syntaxtree.statement.Return;
import de.dhbwstuttgart.syntaxtree.statement.Statement;
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
import de.dhbwstuttgart.typeinference.Menge;
import de.dhbwstuttgart.typeinference.TypeinferenceResultSet;
public class MethodGenerator extends MethodGen{
private Map<String, Integer> storeIndexes = new HashMap<>();
public MethodGenerator(int access_flags, Type return_type, Type[] arg_types, String[] arg_names, String method_name,
String class_name, InstructionList il, ConstantPoolGen cp) {
super(access_flags, return_type, arg_types, arg_names, method_name, class_name, il, cp);
for(String name: arg_names){
getStoreIndex(name);
}
}
public Method createMethod(ClassGenerator cg, ParameterList parameter, de.dhbwstuttgart.syntaxtree.type.Type retType, Block block, TypeinferenceResultSet rs){
MethodGen method = this;
DHBWInstructionFactory factory = cg.getInstructionFactory();
InstructionList blockInstructions = block.genByteCode(cg, rs);
InstructionList il = this.getInstructionList();
il.append(blockInstructions);//Die vom Block generierten Instructions an die InstructionList der Methode anfügen
//Ein return Statement anfügen, falls nicht vorhanden:
//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.commons.bcel6.generic.Type.VOID)); }
else {
if (!(block.get_Statement().lastElement() instanceof Return) &&
this.getType().equals(org.apache.commons.bcel6.generic.Type.VOID)) {
il.append(factory.createReturn( org.apache.commons.bcel6.generic.Type.VOID));
}
}
method.getInstructionList().setPositions();
method.stripAttributes(true);
method.setMaxStack(); //Die Stack Größe automatisch berechnen lassen (erst nach dem alle Instructions angehängt wurden)
method.setMaxLocals();
//Die korrekte Signatur für die Methode anhängen. Hier sind dann auch die Parameter von RefTypes enthalten:
String paramTypesSig = "(";
for(FormalParameter p : parameter){
paramTypesSig += p.getType().getBytecodeSignature(cg, rs);
Logger.getLogger("MethodGenerator").error(paramTypesSig, Section.CODEGEN);
}
paramTypesSig += ")";
String retTypeSig = retType.getBytecodeSignature(cg, rs);
method.addAttribute(factory.createSignatureAttribute(paramTypesSig+retTypeSig));
System.out.println(this.getInstructionList().size());
StackMap stackMap = new StackMapTableGen(this, cp).getStackMap();
if(stackMap != null)method.addCodeAttribute(stackMap);
return method.getMethod();
}
public LocalVariableInstruction createLoad(org.apache.commons.bcel6.generic.Type bytecodeType, String variableName) {
return InstructionFactory.createLoad(bytecodeType, getStoreIndex(variableName));
}
public LocalVariableInstruction createStore(org.apache.commons.bcel6.generic.Type bytecodeType, String variableName) {
return InstructionFactory.createStore(bytecodeType, getStoreIndex(variableName));
}
public Integer getStoreIndex(String variableName) {
if(storeIndexes.get(variableName) == null){
Integer index = storeIndexes.size()+1;
storeIndexes.put(variableName, index);
}
return storeIndexes.get(variableName);
}
}

@ -1,22 +0,0 @@
package de.dhbwstuttgart.bytecode;
import org.apache.commons.bcel6.Constants;
import org.apache.commons.bcel6.generic.ReferenceType;
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
public class TypePlaceholderType extends ReferenceType{
private final TypePlaceholder tph;
public TypePlaceholderType(TypePlaceholder tph) {
super(Constants.T_REFERENCE, "T" + tph.get_Name() + ";");
this.tph = tph;
if(this.tph == null)throw new NullPointerException();
}
public TypePlaceholder getTPH() {
return tph;
}
}

@ -1,16 +0,0 @@
package de.dhbwstuttgart.bytecode;
import org.apache.commons.bcel6.Constants;
import org.apache.commons.bcel6.classfile.Utility;
import org.apache.commons.bcel6.generic.ObjectType;
import org.apache.commons.bcel6.generic.ReferenceType;
import org.apache.commons.bcel6.generic.Type;
public class WildcardType extends ReferenceType{
public WildcardType(String class_name, String preString) {
super(Constants.T_REFERENCE, preString + "L" + class_name.replace('.', '/') + ";");
//this.type = Constants.T_UNKNOWN;
}
}

@ -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

@ -3,66 +3,6 @@ package de.dhbwstuttgart.core;
import java.util.*;
import de.dhbwstuttgart.logger.Logger;
import de.dhbwstuttgart.logger.LoggerConfiguration;
import de.dhbwstuttgart.syntaxtree.SourceFile;
import de.dhbwstuttgart.typeinference.Menge;
import de.dhbwstuttgart.typeinference.TypeinferenceResultSet;
import de.dhbwstuttgart.typeinference.exceptions.DebugException;
import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException;
public class ConsoleInterface {
private static final String directory = System.getProperty("user.dir");
private static final Logger log = Logger.getLogger( ConsoleInterface.class.getName() );
/**
* @param args
*/
public static void main(String[] args) {
Menge<String> filenames = new Menge<String>();
for(String file : args){
filenames.add(file);
}
Logger.setStandardConfiguration(new LoggerConfiguration()); // sämtliches Logging unterdrücken
run(filenames);
}
public static void run(Menge<String> filenames){
Menge<TypeinferenceResultSet> resultSet = null;
MyCompilerAPI compiler = MyCompiler.getAPI(new LoggerConfiguration());
try{
/////////////////////////
// Parsen:
/////////////////////////
Menge<SourceFile> sourceFiles = compiler.parse(filenames);
/////////////////////////
// Typrekonstruktion:
/////////////////////////
try{
resultSet = compiler.typeReconstruction(sourceFiles);
}catch(TypeinferenceException texc){
texc.printStackTrace();
throw new DebugException("Fehler bei Typinferenzalgorithmus. Message: "+texc.getMessage());
}
///////////////////////
// Ausgabe:
///////////////////////
if(resultSet == null)System.out.println("Keine Lösung!");
ArrayList<String> resultJavaCodes = new ArrayList<String>();
for(TypeinferenceResultSet result : resultSet){
String javaCode = result.getInterferedClass().printJavaCode(result);
if(!resultJavaCodes.contains(javaCode))resultJavaCodes.add(javaCode);
}
for(String out : resultJavaCodes){
System.out.println("\nMögliche Typisierung:\n\n");
System.out.println(out);
}
}catch(Exception e){
e.printStackTrace();
if(resultSet == null)throw new DebugException("Fehler bei Typinferenzalgorithmus. Message: "+e.getMessage());
}
}
}

@ -1,17 +1,6 @@
// 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

@ -1,292 +1,10 @@
package de.dhbwstuttgart.core;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.Reader;
import java.io.StringReader;
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;
import de.dhbwstuttgart.syntaxtree.type.RefType;
import de.dhbwstuttgart.syntaxtree.type.Type;
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
import de.dhbwstuttgart.typeinference.ByteCodeResult;
import de.dhbwstuttgart.typeinference.FunNInterface;
import de.dhbwstuttgart.typeinference.FunVoidNInterface;
import de.dhbwstuttgart.typeinference.Pair;
import de.dhbwstuttgart.typeinference.ResultSet;
import de.dhbwstuttgart.typeinference.TypeinferenceResultSet;
import de.dhbwstuttgart.typeinference.TypeinferenceResults;
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
import de.dhbwstuttgart.typeinference.exceptions.DebugException;
import de.dhbwstuttgart.typeinference.exceptions.ParserError;
import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException;
public class MyCompiler implements MyCompilerAPI{
public class MyCompiler {
// PL: Der Zusammenhang zwischen paralist und vParaOrg muesste
// noch geklaert werden 05-01-07
public static final int NO_LINENUMBER = -1;
protected static Logger inferencelog = Logger.getLogger(MyCompiler.class.getName());
protected String OutputDir = "";
public Menge<Pair> testPair = null;
/**
* Author: J�rg B�uerle<br/>
* Der private Konstruktor. Es soll von au�en kein Compiler angelegt werden
* k�nnen, sondern nur eine API zur Verf�gung gestellt werden.
* @param logger Konfiguration für Debug Ausgabe TODO
*/
private MyCompiler(){
this.init();
}
/**
* Author: Jörg Bäuerle<br/>
* Stellt eine neue Instanz der CompilerAPI zur Verf�gung.
* Diese Methode sollte von der IDE aus aufgerufen werden,
* um eine Quellcode-Datei zu kompilieren.
* @return Die Compiler-API
*/
public static MyCompilerAPI getAPI(LoggerConfiguration loggerConfig){
Logger.setStandardConfiguration(loggerConfig);
return new MyCompiler();
}
/**
* Parst den Quellcode und baut den abstrakten Syntaxbaum auf. Danach wird
* automatisch der von Thomas Ott implementierte Algorithmus
* <code>NewTVar(jclass)</code> (siehe Algorithmus 5.17 TRProg, Martin Pl�micke)
* aufgerufen.
* <br/>Author: J�rg B�uerle
* @param reader
* @throws IOException
* @throws JavaParser.yyException
*/
private void parse_backup(Reader reader) throws IOException, JavaParser.yyException{
}
/////////////////////////////////////////////////////////////////////////////////////////////////
// Implementierte API-Methoden:
/////////////////////////////////////////////////////////////////////////////////////////////////
/**
* Author: J�rg B�uerle<br/>
* Initialisiert den Compiler
*/
public void init(){
TypePlaceholder.deleteRegistry();
}
/**
* Author: J�rg B�uerle<br/>
* Ruft die Parse-Methode.
* @param file Die Quellcode-Datei
* @throws FileNotFoundException Wenn die Quellcode-Datei nicht existiert.
* @throws IOException Wenn was schief l�uft.
* @throws JavaParser.yyException Wenn ein Fehler beim Parsen auftritt.
*/
public SourceFile parse(File file) throws FileNotFoundException, IOException, JavaParser.yyException{
FileReader fr = new FileReader(file);
SourceFile ret = this.parse2SyntaxTree(fr);
fr.close();
return ret;
}
/**
* Author: J�rg B�uerle<br/>
* Ruft den Typrekonstruktionsalgorithmus auf.
* @return Die Menge aller m�glichen Typkombinationen
* @throws NullPointerException Wenn noch kein abstrakter Syntaxbaum vorhanden
* ist. @throws CTypeReconstructionException Wenn ein Fehler bei der
* Typrekonstruktion auftritt.
*/
public Menge<TypeinferenceResultSet> typeReconstruction(Menge<SourceFile> m_AbstractSyntaxTree) throws NullPointerException{
inferencelog.info("##########################################", Section.TYPEINFERENCE);
inferencelog.info("# TypeReconstruction-Algorithmus - START #", Section.TYPEINFERENCE);
inferencelog.info("##########################################\n", Section.TYPEINFERENCE);
TypeAssumptions globalAssumptions = makeFunNAssumptions();
Menge<TypeinferenceResultSet> result = new Menge<TypeinferenceResultSet>();
for(SourceFile srcFile : m_AbstractSyntaxTree){
result.addAll(srcFile.typeReconstruction(globalAssumptions));
}
inferencelog.info("#########################################", Section.TYPEINFERENCE);
inferencelog.info("# TypeReconstruction-Algorithmus - ENDE #", Section.TYPEINFERENCE);
inferencelog.info("#########################################\n", Section.TYPEINFERENCE);
return result;
}
/**
* Erstellt die FunN-Assumptions
* Fun0-FunN (momentan für N = 6)
* @return
*/
private TypeAssumptions makeFunNAssumptions(){
TypeAssumptions ret = new TypeAssumptions();
//Basic Assumptions für die FunN Interfaces:
//TODO: Hier mehr als Fun1-Fun5 implementieren
for(int i = 0; i<6; i++){
FunNInterface funN = new FunNInterface(i);
ret.add(funN.getPublicFieldAssumptions());
}
//Keine FunVoidInterfaces in den Assumptions.
//for(int i = 0; i<6; i++){
// FunVoidNInterface funN = new FunVoidNInterface(i);
// ret.add(funN.getPublicFieldAssumptions());
//}
return ret;
}
/**
* Die Main-Funktion, �ber die der Compiler auch per Konsole gestartet
* werden kann.
* @param args Klassendatei
*/
public static void main(String[] args){
MyCompilerAPI compiler = MyCompiler.getAPI(new LoggerConfiguration());
// Hier koennten ggf. Aenderungen der Ausgabeeinstellungen
// (Debuginfos) vorgenommen werden -> LOG4J
try {
compiler.parse(new File(args[0]));
} catch (FileNotFoundException e) {
System.err.println("Die Datei \""+args[0]+"\" konnte nicht gefunden werden.");
System.exit(0);
} catch (IOException e) {
System.err.println("Fehler beim Parsen:");
System.err.println(e);
System.exit(0);
} catch (yyException e) {
System.err.println("Fehler beim Parsen:");
System.err.println(e);
System.exit(0);
}
}
public void setOutputDir(String dir){
char c = dir.charAt(dir.length()-1);
if (c != '/' & c != '\\') dir = dir + "/";
OutputDir = dir;
// Verzeichnis(se) ggf. anlegen
File f = new File(dir);
f.mkdirs();
}
public String getOutputDir(){
return OutputDir;
}
/**
* Parst den Inhalt einer Datei zu einem Syntaxbaum.
*/
private SourceFile parse2SyntaxTree(Reader fileContent) throws ParserError{
//StringReader reader = new StringReader(fileContent);
//////////////////////////////////////
// Scanner und Parser erzeugen:
//////////////////////////////////////
Scanner scanner = new Scanner(fileContent);
JavaParser parser = new JavaParser();
//////////////////////////////////////
// Parsen ==> Ergebnis: srcFile
//////////////////////////////////////
SourceFile srcFile = null;
try {
srcFile = (SourceFile) parser.yyparse( scanner );
} catch (IOException | yyException e) {
e.printStackTrace();
if(e instanceof yyException)throw new ParserError((yyException)e);
}
//////////////////////////////////////
// Postprocessing:
//////////////////////////////////////
srcFile.parserPostProcessing(null); //Muss mit null aufgerufen werden.
//Fertig:
return srcFile;
}
/**
* Diese Funktion nimmt einen Menge von Dateinamen. Alle diese Dateien werden zu einem SyntaxBaum geparst.
* @return
*/
public Menge<SourceFile> parse(Menge<String> filenames) throws ParserError {
Menge<SourceFile> m_AbstractSyntaxTree = new Menge<SourceFile>();
for(String filename : filenames){
StringBuffer fileData = new StringBuffer();
BufferedReader reader;
try {
reader = new BufferedReader(
new FileReader(filename));
} catch (FileNotFoundException e) {
throw new DebugException("Die Datei "+ filename+" konnte nicht gelesen werden.");
}
char[] buf = new char[1024];
int numRead=0;
try {
while((numRead=reader.read(buf)) != -1){
String readData = String.valueOf(buf, 0, numRead);
fileData.append(readData);
}
reader.close();
} catch (IOException e) {
e.printStackTrace();
}
StringReader srcreader = new StringReader(fileData.toString());
//Den aus der Datei ausgelesenen Quellcode zu einem Syntaxbaum parsen:
m_AbstractSyntaxTree.add(parse2SyntaxTree(srcreader)); // Alle Dateien nacheinander hintereinander anhängen...
}
return m_AbstractSyntaxTree;
}
@Override
public SourceFile parse(String sourceCode) {
return parse2SyntaxTree(new StringReader(sourceCode));
}
@Override
public Menge<ByteCodeResult> generateBytecode(Menge<SourceFile> m_AbstractSyntaxTree, TypeinferenceResults typeinferenceResults) {
//SourceFile parsedFile = this.m_AbstractSyntaxTree.firstElement();
//Class parsedClass = parsedFile.KlassenVektor.firstElement();
Menge<ByteCodeResult> ret = new Menge<>();
for(SourceFile sf : m_AbstractSyntaxTree){
ret.addAll(sf.generateBytecode(typeinferenceResults));
}
return ret;
}
}

@ -1,23 +1,5 @@
// ino.module.MyCompilerAPI.8570.package
package de.dhbwstuttgart.core;
// ino.end
// ino.module.MyCompilerAPI.8570.import
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import de.dhbwstuttgart.typeinference.Menge;
import de.dhbwstuttgart.parser.JavaParser;
import de.dhbwstuttgart.syntaxtree.SourceFile;
import de.dhbwstuttgart.typeinference.ByteCodeResult;
import de.dhbwstuttgart.typeinference.ResultSet;
import de.dhbwstuttgart.typeinference.TypeinferenceResultSet;
import de.dhbwstuttgart.typeinference.TypeinferenceResults;
import de.dhbwstuttgart.typeinference.exceptions.ParserError;
import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException;
// ino.class.MyCompilerAPI.21328.description type=javadoc
/**
* Schnittstellen-Klasse zum Compiler. Diese Klasse soll der
* IDE als Compiler-API zum Kompilieren einer Quellcode-Datei
@ -26,106 +8,12 @@ import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException;
* @author Jörg Bäuerle
* @version $Date: 2013/09/09 11:04:24 $
*/
// ino.end
// ino.class.MyCompilerAPI.21328.declaration
public interface MyCompilerAPI
// ino.end
// ino.class.MyCompilerAPI.21328.body
{
// ino.method.init.21331.decldescription type=javadoc
/**
* Author: Jörg Bäuerle<br/>
* Initialisiert den Compiler
*/
// ino.end
// ino.method.init.21331.declaration
public void init();
// ino.end
// ino.method.parse.21334.decldescription type=javadoc
/**
* Author: Jörg Bäuerle<br/>
* Parst eine Quellcodedatei und baut den abstrakten Syntaxbaum auf.
* @param file Die Quellcode-Datei
* @throws FileNotFoundException Wenn die Quellcode-Datei nicht existiert.
* @throws IOException Wenn was schief läuft.
* @throws JavaParser.yyException Wenn ein Fehler beim Parsen auftritt.
*/
// ino.end
// ino.method.parse.21334.declaration
public SourceFile parse(File file)
throws FileNotFoundException, IOException, JavaParser.yyException;
// ino.end
// ino.method.parse.21337.decldescription type=javadoc
/**
* Author: Jörg Bäuerle<br/>
* Parst einen String und baut den abstrakten Syntaxbaum auf.
* @param srcCode Der zu parsende Quellcode
* @throws IOException Wenn was schief läuft.
* @throws JavaParser.yyException Wenn ein Fehler beim Parsen auftritt.
// ino.end
// ino.method.parse.21337.declaration
public void parse(String srcCode)
throws IOException, JavaParser.yyException;
// ino.end
*/
// ino.method.typeReconstruction.21340.decldescription type=javadoc
/**
* Author: Jörg Bäuerle<br/>
* Ruft den Typrekonstruktionsalgorithmus auf.
* @return Die Menge aller möglichen Typkombinationen
* @throws NullPointerException Wenn noch kein abstrakter Syntaxbaum vorhanden
* ist. @throws CTypeReconstructionException Wenn ein Fehler bei der
* Typrekonstruktion auftritt.
*/
// ino.end
// ino.method.typeReconstruction.21340.declaration
public Menge<TypeinferenceResultSet> typeReconstruction(Menge<SourceFile> m_AbstractSyntaxTree) throws NullPointerException;
// ino.end
// ino.method.setOutputDir.21349.decldescription type=javadoc
/**
* Author: Juergen Schmiing <br>
* Legt das Ausgabeverzeichnis fuer die class-Files fest.
*/
// ino.end
// ino.method.setOutputDir.21349.declaration
public void setOutputDir(String dir);
// ino.end
// ino.method.getOutputDir.21352.decldescription type=javadoc
/**
* Author: Juergen Schmiing <br>
* Gibt das Ausgabeverzeichnis fuer die class-Files zurueck.
*/
// ino.end
// ino.method.getOutputDir.21352.declaration
public String getOutputDir();
// ino.end
/**
* Parst zusammenhängende JavaKlassen in verschiedenen Dateien.
* @param filenames - Eine Liste von Quellcodedateien, welche gseparst werden sollen
* @return
*/
public Menge<SourceFile> parse(Menge<String> filenames) throws ParserError;
/**
* Parst den SourceCode einer Datei.
* @param sourceCode - SourceCode einer Java-Quellcodedatei
* @return den aus dem sourceCode generierten Syntaxbaum
*/
public SourceFile parse(String sourceCode) throws ParserError;
/**
* Generiert für jede geparste Klasse im SourceFile ein ByteCodeResult.
* Dafür müssen die Schritte Parsen und typeReconstruction ausgeführt werden.
* @return
*/
public Menge<ByteCodeResult> generateBytecode(Menge<SourceFile> m_AbstractSyntaxTree, TypeinferenceResults typeinferenceResults);
}
// ino.end

@ -1,165 +0,0 @@
package de.dhbwstuttgart.logger;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.LogRecord;
public class Logger {
private static LoggerConfiguration standardConfiguration = null;
private static final HashMap<String, Logger> LOGGER_DIRECTORY = new HashMap<>();
private String name;
private final HashMap<Section, java.util.logging.Logger> logger;
private static final LogHistory LOG_HISTORY = new LogHistory();
protected Logger(String name, LoggerConfiguration config) {
this.name = name;
this.logger = new HashMap<>();
if(config != null){
config.forEach((s,o)->{
java.util.logging.Logger log = java.util.logging.Logger.getLogger( name );
log.setLevel(Level.FINE);
log.addHandler(new OutputHandler(o));
logger.put(s, log);
});
}
}
/**
* Logt eine Debug Message, welche zusätzlich einer bestimmten Section zugewiesen wird.
* Dadurch lässt sich die DEBUG ausgabe übersichtlicher gestalten.
* @param message
* @param section
*/
public void debug(String message, Section section){
output(message, Level.FINE, section);
}
/**
* Liefert den Logger mit dem angegebenen Namen.
* Üblicherweise wird diese Methode mit dem Namen der Klasse aufgerufen, in welcher der Logger tätig ist.
* @param name - Name der Klasse ( Ermittelbar mittels <Klasse>.class.getName() )
* @return
*/
public static Logger getLogger(String name) {
Logger ret;
if(LOGGER_DIRECTORY.containsKey(name)){
ret = LOGGER_DIRECTORY.get(name);
}else{
ret = new Logger(name, standardConfiguration);
LOGGER_DIRECTORY.put(name, ret);
}
return ret;
}
public static SectionLogger getSectionLogger(String name, Section s) {
Logger ret;
if(LOGGER_DIRECTORY.containsKey(name)){
ret = LOGGER_DIRECTORY.get(name);
}else{
ret = new Logger(name, standardConfiguration);
LOGGER_DIRECTORY.put(name, ret);
}
return new SectionLogger(ret,s);
}
protected void output(String msg , Level logLevel, Section section){
Logger.LOG_HISTORY.add(new LogLine(msg, this.name, section, logLevel));
if(logger.containsKey(section)){
java.util.logging.Logger log = logger.get(section);
log.log(logLevel, msg);
}
}
public void info(String message, Section s) {
output(message, Level.INFO, s);
}
public void error(String message, Section s) {
output(message, Level.WARNING, s);
}
/**
* wird hier null übergeben, so wird sämtliches Logging unterdrückt.
*/
public static void setStandardConfiguration(LoggerConfiguration config) {
Logger.standardConfiguration = config;
}
public static String getWholeLog(){
String ret = "";
LOG_HISTORY.removeIf((logLine)->logLine==null);
Logger.LOG_HISTORY.sort((log1, log2)->log1.timestamp.compareTo(log2.timestamp));
ret += Logger.LOG_HISTORY.toString();
return ret;
}
}
class OutputHandler extends Handler{
private PrintStream output;
public OutputHandler(PrintStream output){
this.output = output;
}
@Override
public void publish(LogRecord record) {
output.println(record.getMessage());
}
@Override
public void flush() {
}
@Override
public void close() throws SecurityException {
}
}
class LogHistory extends ArrayList<LogLine>{
private static final long serialVersionUID = -1785228323497318261L;
@Override
public String toString(){
StringBuilder ret = new StringBuilder();
for(LogLine l : this){
ret.append(l.toString() + "\n");
}
return ret.toString();
}
}
class LogLine {
Date timestamp;
String message;
String name;
Section section;
Level level;
LogLine(String msg, String loggerName, Section section, Level logLevel){
this.timestamp = new Date();
this.message = msg;
this.name = loggerName;
this.section = section;
this.level = logLevel;
}
public String toString(){
String ret = "";
ret += name + ": ";
ret += message;
ret += " - " + section.name();
return ret;
}
public String toJSON(){
return "";
}
}

@ -1,48 +0,0 @@
package de.dhbwstuttgart.logger;
import java.io.PrintStream;
import java.util.HashMap;
import de.dhbwstuttgart.typeinference.Menge;
import de.dhbwstuttgart.typeinference.exceptions.DebugException;
public class LoggerConfiguration{
private final HashMap<Section,Menge<PrintStream>> outputs = new HashMap<>(Section.values().length);
public LoggerConfiguration setOutput(Section forSection, PrintStream output){
if(outputs.containsKey(forSection)){
//throw new DebugException("Eine outputStream für Section "+forSection+" ist bereits vorhanden");
if(outputs.get(forSection).equals(output)){
//do nothing
}else{
outputs.get(forSection).add(output);
}
}else{
Menge<PrintStream> outMenge = new Menge<>();
outMenge.add(output);
outputs.put(forSection, outMenge);
}
return this;
}
public void forEach(ConfigurationEvaluater action){
for(Section key : outputs.keySet()){
for(PrintStream out : outputs.get(key)){
action.apply(key, out);
}
}
}
public void mergeConfiguration(LoggerConfiguration config){
for(Section key : config.outputs.keySet()){
for(PrintStream out : config.outputs.get(key)){
this.setOutput(key, out);
}
}
}
}
interface ConfigurationEvaluater {
public void apply(Section s, PrintStream o);
}

@ -1,8 +0,0 @@
package de.dhbwstuttgart.logger;
public enum Section {
TYPEINFERENCE,
PARSER,
CODEGEN,
UNIFY, FINITECLOSURE, ASSUMPTIONS;
}

@ -1,26 +0,0 @@
package de.dhbwstuttgart.logger;
import java.util.logging.Level;
/**
* Sämtliche Logging Ausgaben werden in die bei der Erstellung des Loggers übergebene Section eingeteilt
* @author janulrich
*
*/
public class SectionLogger {
private Logger log;
private Section section;
protected SectionLogger(Logger logger, Section s){
this.log = logger;
this.section = s;
}
public void debug(String message){
log.debug(message, section);
}
public void info(String string) {
log.info(string, section);
}
public void error(String string) {
log.error(string, section);
}
}

@ -1,50 +0,0 @@
package de.dhbwstuttgart.logger;
import java.util.Stack;
public class Timestamp{
String name;
Stack<Long> timestamps = new Stack<>();
Long accumulatedTime = 0L;
Timestamp(String name){
this.name = name;
}
public void start(){
timestamps.push(System.currentTimeMillis());
}
public Long stop(){
if(timestamps.isEmpty())return 0L;
Long timeStart = timestamps.pop();
Long currentTime = getTime();
Long difference = currentTime-timeStart;
accumulatedTime += difference;
return difference;
}
public Long currentTime(){
if(timestamps.isEmpty())return 0L;
Long timeStart = timestamps.peek();
Long currentTime = getTime();
return currentTime-timeStart;
}
@Override
public boolean equals(Object obj) {
if(!(obj instanceof Timestamp))return false;
return this.name.equals(((Timestamp)obj).name);
}
public String toString(){
String ret = "Zeit für Aktivität "+this.name+": "+this.accumulatedTime;
return ret;
}
private Long getTime(){
return System.currentTimeMillis();
}
}

@ -1,74 +0,0 @@
package de.dhbwstuttgart.logger;
import java.util.HashMap;
import java.util.Stack;
import de.dhbwstuttgart.typeinference.Menge;
import de.dhbwstuttgart.typeinference.exceptions.DebugException;
public class Timewatch {
private static final Timewatch time = new Timewatch();
private final Timestamp startTime;
private Timers timers = new Timers();
private Timewatch(){
//Privater Konstruktor
startTime = new Timestamp("Timewatch Global");
startTime.start();
}
public static Timewatch getTimewatch() {
return time;
}
public String dumpTimeData(){
String ret = "Momentan insgesamt verstrichene Zeit: "+this.startTime.currentTime() +"\n";
ret += timers.toString();
return ret;
}
public Timestamp start(String name){
if(!timers.contains(name)){
Timestamp ret = new Timestamp(name);
timers.add(ret);
ret.start();
return ret;
}else{
//Timer läuft noch... einfach neue Instanz starten:
Timestamp ret = timers.get(name);
ret.start();
return ret;
}
}
}
class Timers{
private Menge<Timestamp> timers = new Menge<>();
public Timestamp get(String name) {
for(Timestamp timer:timers){
if(timer.name.equals(name))return timer;
}
throw new DebugException("Fehler in Timewatch: Der gesuchte Timer "+name+" ist nicht vorhanden.");
}
public void add(Timestamp timer) {
timers.add(timer);
}
public boolean contains(String name) {
return timers.contains(new Timestamp(name));
}
public String toString(){
String ret ="";
for(Timestamp timer : timers){
ret += timer.toString() + "\n";
}
return ret;
}
}

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

@ -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();
}
}

@ -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

@ -0,0 +1,25 @@
package de.dhbwstuttgart.parser;
import de.dhbwstuttgart.parser.antlr.Java8BaseListener;
import de.dhbwstuttgart.parser.antlr.Java8Parser;
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(")");
}
}

@ -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;
}
}

@ -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

@ -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

@ -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

@ -0,0 +1,7 @@
package de.dhbwstuttgart.parser;
/**
* Created by janulrich on 26.01.17.
*/
public class JavaXParser {
}

@ -0,0 +1,46 @@
package de.dhbwstuttgart.parser;
import de.dhbwstuttgart.parser.antlr.Java8Lexer;
import de.dhbwstuttgart.parser.antlr.Java8Parser;
import org.antlr.v4.runtime.ANTLRInputStream;
import org.antlr.v4.runtime.CommonTokenStream;
import de.dhbwstuttgart.syntaxtree.*;
import de.dhbwstuttgart.syntaxtree.modifier.*;
import java.util.Scanner;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.io.IOException;
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() + "\n";
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);
Java8Parser.CompilationUnitContext tree = parser.compilationUnit();
SyntaxTreeGenerator generator = new SyntaxTreeGenerator();
SourceFile f = generator.convert((Java8Parser.CompilationUnitContext) tree);
String pkgName = f.getPkgName();
System.out.println(pkgName);
System.out.println("classes:");
for(ClassOrInterface c : f.KlassenVektor){
for(Modifier mod : c.getModifiers().getModifierList()){
System.out.println(mod.getClass().getName());
}
System.out.println(c.getClassName().toString());
}
}
catch(java.util.NoSuchElementException e){
System.out.println("Error: Source seems to be empty.");
}
catch(IOException e){
System.out.println("An exception occured which is on our TODO list.");
e.printStackTrace();
}
}
}

@ -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

@ -0,0 +1,150 @@
package de.dhbwstuttgart.parser;
import de.dhbwstuttgart.parser.antlr.Java8Parser;
import de.dhbwstuttgart.syntaxtree.*;
import de.dhbwstuttgart.syntaxtree.modifier.*;
import de.dhbwstuttgart.syntaxtree.statement.Block;
import de.dhbwstuttgart.syntaxtree.type.RefType;
import de.dhbwstuttgart.typecheck.*;
import java.util.ArrayList;
import java.util.List;
import org.antlr.v4.runtime.tree.TerminalNode;
public class SyntaxTreeGenerator{
JavaClassRegistry reg = new JavaClassRegistry();
String pkgName = null;
List<JavaClassName> imports = null;
public void getNames(Java8Parser.CompilationUnitContext ctx){
if(ctx.packageDeclaration() != null){
this.pkgName = "";
for(TerminalNode t : ctx.packageDeclaration().Identifier()){
this.pkgName = this.pkgName + "." + t.toString();
}
this.pkgName = this.pkgName.substring(1);
}
String nameString = "";
for (Java8Parser.TypeDeclarationContext typeDecl : ctx.typeDeclaration()){
if(typeDecl.interfaceDeclaration() != null){
if(typeDecl.interfaceDeclaration().normalInterfaceDeclaration() != null){
if(this.pkgName != null){
nameString = this.pkgName + "." + typeDecl.interfaceDeclaration().normalInterfaceDeclaration().Identifier().toString();
}
else{
nameString = typeDecl.interfaceDeclaration().normalInterfaceDeclaration().Identifier().toString();
}
this.reg.existingClasses.add(new JavaClassName(nameString));
}
}
else{
if(typeDecl.classDeclaration().normalClassDeclaration() != null){
if(this.pkgName != ""){
nameString = this.pkgName + "." + typeDecl.classDeclaration().normalClassDeclaration().Identifier().toString();
}
else{
nameString = typeDecl.classDeclaration().normalClassDeclaration().Identifier().toString();
}
this.reg.existingClasses.add(new JavaClassName(nameString));
}
}
}
}
public SourceFile convert(Java8Parser.CompilationUnitContext ctx){
List<ClassOrInterface> classes = new ArrayList<>();
this.getNames(ctx);
for(Java8Parser.TypeDeclarationContext typeDecl : ctx.typeDeclaration()){
ClassOrInterface newClass = null;
if(typeDecl.classDeclaration() != null){
newClass = convertClass(typeDecl.classDeclaration());
}
else{
newClass = convertInterface(typeDecl.interfaceDeclaration());
}
classes.add(newClass);
}
return new SourceFile(this.pkgName, classes, this.imports);
}
private ClassOrInterface convertClass(Java8Parser.ClassDeclarationContext ctx) {
ClassOrInterface newClass = null;
if(ctx.normalClassDeclaration() != null){
newClass = convertNormal(ctx.normalClassDeclaration());
}
else{
newClass = convertEnum(ctx.enumDeclaration());
}
return newClass;
}
private ClassOrInterface convertNormal(Java8Parser.NormalClassDeclarationContext ctx){
Modifiers modifiers = null;
if(ctx.classModifier() != null){
List<Modifier> modList = new ArrayList();
for(Java8Parser.ClassModifierContext mod : ctx.classModifier()){
Modifier newModifier = convert(mod);
modList.add(newModifier);
}
modifiers = new Modifiers(modList);
}
JavaClassName name = convert(ctx.Identifier());
Block class_block = null;
List<Field> fielddecl = null;
GenericDeclarationList genericClassParameters = null;
int offset = 0;
RefType superClass = null;
Boolean isInterface = false;
List<RefType> implementedInterfaces = null;
return new ClassOrInterface(modifiers, name, class_block, fielddecl, genericClassParameters, offset, superClass, isInterface, implementedInterfaces);
}
private Modifier convert(Java8Parser.ClassModifierContext ctx){
Modifier newModifier = null;
if(ctx.annotation() == null){
TerminalNode t = (TerminalNode)ctx.getChild(0);
if(t.getText().equals("public")){
newModifier = new Public();
}
else if(t.getText().equals("private")){
newModifier = new Private();
}
else if(t.getText().equals("protected")){
newModifier = new Protected();
}
else if(t.getText().equals("abstract")){
newModifier = new Abstract();
}
else if(t.getText().equals("static")){
newModifier = new Static();
}
else if(t.getText().equals("strictfp")){
newModifier = new Strictfp();
}
else{
newModifier = new Final();
}
}
return newModifier;
}
/**
Converts a TerminalNode to JavaClassName. If pkgName is set, it will be included like expected.
**/
private JavaClassName convert(TerminalNode t){
String name = "";
if(this.pkgName != null){
name = this.pkgName + "." + t.toString();
}
else{
name = t.toString();
}
return new JavaClassName(name);
}
private ClassOrInterface convertEnum(Java8Parser.EnumDeclarationContext ctx){
return null;
}
private ClassOrInterface convertInterface(Java8Parser.InterfaceDeclarationContext ctx){
return null;
}
}

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

@ -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

File diff suppressed because it is too large Load Diff

@ -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

@ -0,0 +1,584 @@
// Generated from Java8.g4 by ANTLR 4.5.3
package de.dhbwstuttgart.parser.antlr;
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);
}
}
}

@ -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

@ -0,0 +1,18 @@
* 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.
== Fragen/PProbleme SyntaxTreeGenerator ==
* ClassRegistry: Unklar, woher diese kommen soll.
* Konstruktor für Class fehlt.
* Namenskonflikt Class vs. Class in Java?

@ -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

@ -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
* Fü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 d�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

@ -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

@ -0,0 +1,63 @@
package de.dhbwstuttgart.syntaxtree;
import de.dhbwstuttgart.core.IItemWithOffset;
import de.dhbwstuttgart.typecheck.JavaClassName;
import de.dhbwstuttgart.syntaxtree.modifier.Modifiers;
import de.dhbwstuttgart.syntaxtree.statement.Block;
import de.dhbwstuttgart.syntaxtree.statement.Expr;
import de.dhbwstuttgart.syntaxtree.type.RefType;
import java.util.ArrayList;
import java.util.List;
/**
* Stellt jede Art von Klasse dar. Auch abstrakte Klassen und Interfaces
*/
public class ClassOrInterface extends GTVDeclarationContext implements IItemWithOffset, Generic{
protected Modifiers modifiers;
protected JavaClassName name;
private Block class_block;
private List<Field> fielddecl = new ArrayList<>();
private GenericDeclarationList genericClassParameters;
private int offset;
private RefType superClass;
protected boolean isInterface;
private List<RefType> implementedInterfaces;
public ClassOrInterface(Modifiers modifiers, JavaClassName name, Block class_block, List<Field> fielddecl, GenericDeclarationList genericClassParameters, int offset, RefType superClass, Boolean isInterface, List<RefType> implementedInterfaces){
if(modifiers != null){
this.modifiers = modifiers;
}
if(name != null){
this.name = name;
}
if(class_block != null){
this.class_block = class_block;
}
if(fielddecl != null){
this.fielddecl = fielddecl;
}
if(genericClassParameters != null){
this.genericClassParameters = genericClassParameters;
}
this.offset = offset;
if(superClass != null){
this.superClass = superClass;
}
this.isInterface = isInterface;
if(implementedInterfaces != null){
this.implementedInterfaces = implementedInterfaces;
}
}
// Gets class name
public JavaClassName getClassName(){
return this.name;
}
// Get modifiers
public Modifiers getModifiers(){
return this.modifiers;
}
}

@ -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

@ -1,209 +1,16 @@
package de.dhbwstuttgart.syntaxtree;
import org.apache.commons.bcel6.Constants;
import org.apache.commons.bcel6.classfile.ConstantPool;
import org.apache.commons.bcel6.generic.ClassGen;
import org.apache.commons.bcel6.generic.ConstantPoolGen;
import org.apache.commons.bcel6.generic.InstructionFactory;
import org.apache.commons.bcel6.generic.InstructionHandle;
import org.apache.commons.bcel6.generic.InstructionList;
import org.apache.commons.bcel6.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.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.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;
import org.apache.bcel.Constants;
import org.apache.bcel.generic.InstructionList;
import de.dhbwstuttgart.typecheck.JavaClassName;
import de.dhbwstuttgart.syntaxtree.statement.Block;
public class Constructor extends Method {
/**
* Parser kann nicht zwischen einem Konstruktor und einer Methode unterscheiden.
* 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());
//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)){
this.get_Block().statements.add(0, new SuperCall(this.get_Block()));
this.parserPostProcessing(parent);
}
}
@Override
public TypeAssumptions createTypeAssumptions(Class classmember) {
this.parent = classmember;
Class parentClass = this.getParentClass();
TypeAssumptions ret = new TypeAssumptions();
ret.addAssumption(new ConstructorAssumption(this, parentClass));
return ret;
}
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, 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{
throw new DebugException("Fehlender SuperCall im Konstruktor");
}
//method.setMaxStack(); //Die Stack Größe automatisch berechnen lassen (erst nach dem alle Instructions angehängt wurden)
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) {
this.genByteCode(cg, new InstructionList());
}
// super statement muss drin sein
// stmt genByteCode + im block genByteCode implementieren & dann Hierarchie ausprobieren
// de.dhbw.systanxtree.stmts supercall
// Aufrufhierarchie: Class->Felder->Konstruktor->Methode innerhalb Konstruktor->Block->Statements (in diesem Fall nur super())->hier wird bytecode f<>r superaufruf generiert
@Override
public void parserPostProcessing(SyntaxTreeNode parent){
super.parserPostProcessing(parent);
if(this.parameterlist != null){
for(FormalParameter fp : this.parameterlist){
fp.parserPostProcessing(this);
}
}
for(GenericTypeVar gtv : this.getGenericParameter()){
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() {
return this.getType().getName();
public Constructor(String name, RefType returnType, ParameterList parameterList, Block block, GenericDeclarationList gtvDeclarations, int offset) {
super(name, returnType, parameterList, block, gtvDeclarations, offset);
}
}
/*
// 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
}
*/

@ -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

@ -1,178 +1,18 @@
package de.dhbwstuttgart.syntaxtree;
import org.apache.commons.bcel6.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;
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
import de.dhbwstuttgart.typeinference.ConstraintsSet;
import de.dhbwstuttgart.typeinference.GenericTypeInsertable;
import de.dhbwstuttgart.typeinference.JavaCodeResult;
import de.dhbwstuttgart.typeinference.ResultSet;
import de.dhbwstuttgart.typeinference.TypeInsertable;
import de.dhbwstuttgart.typeinference.Typeable;
import de.dhbwstuttgart.typeinference.TypeinferenceResultSet;
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertPoint;
public abstract class Field extends GTVDeclarationContext implements TypeInsertable, Typeable, Generic, GenericTypeInsertable{
public abstract class Field extends GTVDeclarationContext implements Generic {
protected Menge<DeclId> declid = new Menge<DeclId>(); // Menge, da 'int a, b, c, ...' auch eingeparst werden muss
private Type typ;
private String name;
private int offset;
private GenericDeclarationList genericParameters;
public Field(int offset){
this.offset = offset;
}
@Override
public void setOffset(int offset){
this.offset = offset;
}
@Override
public int getOffset(){
return this.offset;
}
@Override
public void setType(Type typ) {
this.typ = typ;
}
@Override
public Type getType() {
return typ;
}
@Override
public Menge<GenericTypeVar> getGenericParameter() {
Menge<GenericTypeVar> ret = new Menge<>();
if(this.genericParameters == null)return ret;
ret.addAll(this.genericParameters.getMenge());
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);
/**
* Diese Methode generiert die Assumptions für dieses Feld der Klasse classmember
* @param classmember
* @return
*/
public abstract TypeAssumptions createTypeAssumptions(Class classmember);
public abstract ConstraintsSet TYPE(TypeAssumptions publicAssumptions);
public String getIdentifier() {
return this.get_Name().firstElement().get_Name();
}
@Override
public String getDescription(){
return this.getIdentifier();
}
@Override
public TypeInsertPoint createTypeInsertPoint(TypePlaceholder tph,
ResultSet resultSet) {
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 Field(String name, RefType type, int offset){
this.name = name;
}
public boolean isPublic() {
//TODO: momentan ist jedes Feld public!
return true;
}
@Override
public String getGenericVarDeclarationString(String genericVarDeclaration) {
if(this.genericParameters != null){
return ", "+genericVarDeclaration;
}else{
return "<"+genericVarDeclaration+">";
}
}
@Override
public int getGenericVarDeclarationOffset(){
// Falls Generische Parameterliste vorhanden, hier Wert der Liste zurückgegebn
if(this.genericParameters != null){
return this.genericParameters.getEndOffset();
}else{
return this.offset;
}
}
@Override
public Menge<SyntaxTreeNode> getChildren() {
Menge<SyntaxTreeNode> ret = new Menge<>();
if(this.getType()!=null)ret.add(this.getType());
ret.addAll(this.getGenericParameter());
return ret;
}
@Override
public void setGenericParameter(GenericDeclarationList params) {
this.genericParameters = params;
}
@Override
public boolean isClass() {
return false;
}
}

@ -1,31 +1,14 @@
package de.dhbwstuttgart.syntaxtree;
import org.apache.commons.bcel6.generic.FieldGen;
import org.apache.commons.bcel6.generic.FieldInstruction;
import org.apache.commons.bcel6.generic.InstructionList;
import org.apache.commons.bcel6.generic.ObjectType;
import org.apache.commons.bcel6.Const;
import org.apache.commons.bcel6.generic.ClassGen;
import org.apache.bcel.generic.FieldGen;
import org.apache.bcel.generic.FieldInstruction;
import org.apache.bcel.generic.InstructionList;
import org.apache.bcel.generic.ObjectType;
import org.apache.bcel.Const;
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;
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.ResultSet;
import de.dhbwstuttgart.typeinference.TypeinferenceResultSet;
import de.dhbwstuttgart.typeinference.UndConstraint;
import de.dhbwstuttgart.typeinference.assumptions.FieldAssumption;
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException;
/**
* Eine Feldinitialisation steht für eine Felddeklaration mit gleichzeitiger Wertzuweisung
* Beispiel: 'public Feld FeldVar = FeldWert;'
@ -35,166 +18,15 @@ 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(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;
public FieldDeclaration(String name, RefType typ, Expr value){
super(name, typ, 0);//Dieser Deklarator wird nicht vom Parser aufgerufen. Dadurch gibt es auch keinen Offset
this.wert = value;
}
@Override
public String toString()
{
if(getWert()!=null)return super.toString() + "=" + getWert().toString();
return super.toString();
}
public JavaCodeResult printJavaCode(ResultSet 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) );
toAttach.attach( ";");
ret.attach(toAttach);
return ret;
}
@Override
public TypeAssumptions createTypeAssumptions(Class classmember) {
//////////////////////////////
//Felder:
//////////////////////////////
TypeAssumptions assumptions = new TypeAssumptions();
/*
* Der Feld-Assumption muss ein TPH als Typ hinzugefügt werden, falls er Typlos initialisiert wurde. Dies kann auch der Type-Algorithmus der Inst/FieldVar - Klasse machen.
* Wird das Feld mit einem Typ initialisiert so muss dieser auch in die Assumptions.
*/
if(this.getType() == null)throw new TypeinferenceException("Der Typ eines Feldes darf nicht null sein", this);
//assumptions.add(TypeAssumptions.createFieldVarAssumption(classmember.getName(), this.getName(), this.getType()));
assumptions.addAssumption(new FieldAssumption(this,classmember));
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))
throw new TypeinferenceException("Typlose Felder müssen mit Wert initialisiert werden", this);
ConstraintsSet ret = new ConstraintsSet();
TypeAssumptions localAssumptions = publicAssumptions.clone();
for(GenericTypeVar gp : this.getGenericParameter()){
localAssumptions.add(gp.createAssumptions());
}
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);
}
*/
UndConstraint c1 = ConstraintsSet.createSingleConstraint(thisType, thisType);
ret.add(c1); //Damit die TypVariable des Felds in den Constraints auftaucht
if(this.wert!=null){
//Falls bei der Deklaration ein Wert zugewiesen wird, verhält sich das Constraintserzeugen wie bei dem Assign-Statement:
ret.add(this.wert.TYPEExpr(localAssumptions));
ret.add(ConstraintsSet.createSingleConstraint(this.wert.getType().TYPE(localAssumptions,this), thisType));
}
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.
* Dieser muss in jeden Konstruktor eingefügt werden um das Feld zu initialisieren.
* @param cg
* @return - Die InstructionList, welche das Feld initialisiert
*/
public InstructionList genByteCode(ClassGenerator cg, TypeinferenceResultSet rs) {
//Das Feld an die Klasse anfügen:
FieldGen field = new FieldGen(0, this.getType().getBytecodeType(cg, rs), this.getDescription(), cg.getConstantPool());
field.addAttribute(cg.getInstructionFactory().createSignatureAttribute(this.getType().getBytecodeSignature(cg, rs)));
cg.addField(field.getField());
//Die Felddekleration an den Konstruktor anhängen:
InstructionList il = new InstructionList();
il.append(new This(this).genByteCode(cg, rs));
if(wert != null){
il.append(this.wert.genByteCode(cg, rs));
}
FieldInstruction putFieldInstruction =
cg.getInstructionFactory().createFieldAccess(this.getParentClass().getName().toString(),
this.getDescription(), this.getType().getBytecodeType(cg, rs), Const.PUTFIELD);
il.append(putFieldInstruction );
return il;
}
/*@Override
public void genByteCode(ClassGen cg) {
// TODO Auto-generated method stub
}*/
}

@ -1,246 +1,15 @@
// ino.module.FormalParameter.8561.package
package de.dhbwstuttgart.syntaxtree;
// ino.end
// ino.module.FormalParameter.8561.import
import de.dhbwstuttgart.typeinference.Menge;
import de.dhbwstuttgart.bytecode.ClassGenerator;
import de.dhbwstuttgart.logger.Logger;
import de.dhbwstuttgart.syntaxtree.type.RefType;
import de.dhbwstuttgart.syntaxtree.misc.DeclId;
import de.dhbwstuttgart.syntaxtree.type.Type;
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
import de.dhbwstuttgart.typeinference.JavaCodeResult;
import de.dhbwstuttgart.typeinference.ResultSet;
import de.dhbwstuttgart.typeinference.TypeInsertable;
import de.dhbwstuttgart.typeinference.Typeable;
import de.dhbwstuttgart.typeinference.TypeinferenceResultSet;
import de.dhbwstuttgart.typeinference.exceptions.NotImplementedException;
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
public class FormalParameter extends SyntaxTreeNode
{
// 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
protected static Logger inferencelog = Logger.getLogger("inference");
// ino.end
private RefType type;
private String name;
public FormalParameter(DeclId name){
this.set_DeclId(name);
public FormalParameter(String name, RefType type, int offset){
this.name = name;
this.type = type;
}
@Override
public boolean equals(Object object) {
//if(!super.equals(object))return false; //Nicht die Position im SyntaxBaum prüfen.
if(!(object instanceof FormalParameter))return false;
FormalParameter equals = (FormalParameter)object;
if((this.type==null)!=(equals.type == null))return false;
if(this.type != null){
return this.type.equals(equals.type);
}
return true;
}
// ino.method.setType.23404.defdescription type=javadoc
/**
* <br/>Author: J�rg B�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();
}
// 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: J�rg B�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: J�rg B�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(){
String ret = "";
if(this.getType() != null)ret += this.getType().toString();
if(this.getIdentifier() != null)ret += " "+getIdentifier();
return ret;
}
public JavaCodeResult printJavaCode(ResultSet resultSet) {
JavaCodeResult ret = new JavaCodeResult();
if(this.getType() != null)ret.attach(this.getType().printJavaCode(resultSet));
if(this.getIdentifier() != null)ret.attach(" "+getIdentifier());
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) {
if(this.getOffset()<=0)return null;
Type t = resultSet.getTypeEqualTo(tph);
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 = "";
if(this.getType() != null && !(this.getType() instanceof TypePlaceholder)){
ret += this.getType().toString();//getBytecodeSignature(null, null);
}
return ret+this.getIdentifier();
}
}
// ino.end

@ -1,15 +1,8 @@
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 {
@Override
public GTVDeclarationContext getGTVDeclarationContext(){
return this;
}
public abstract boolean isClass();
}

@ -1,17 +1,9 @@
package de.dhbwstuttgart.syntaxtree;
import java.util.Iterator;
import de.dhbwstuttgart.typeinference.Menge;
import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar;
/**
* Wird von allen Klassen implementiert, welche generische Parameter halten können. (Class, Method und Field)
* @author janulrich
*
*/
public interface Generic {
public void setGenericParameter(GenericDeclarationList params);
public Iterable<GenericTypeVar> getGenericParameter();
}

@ -1,72 +1,30 @@
package de.dhbwstuttgart.syntaxtree;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import de.dhbwstuttgart.typeinference.Menge;
import de.dhbwstuttgart.parser.GenericVarDeclarationList;
import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar;
import java.util.*;
/**
* 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 ArrayList<>();
public GenericDeclarationList(Menge<GenericTypeVar> values, int endOffset) {
this.addAll(values);
public GenericDeclarationList(List<GenericTypeVar> values, int endOffset) {
gtvs = values;
this.offsetOfLastElement = endOffset;
}
private void addAll(Menge<GenericTypeVar> values) {
this.gtvs.addAll(values);
}
public int getEndOffset(){
return offsetOfLastElement;
}
@Override
public int getOffset() {
return getEndOffset();
}
@Override
public int getVariableLength() {
return 0;
}
@Override
public Iterator<GenericTypeVar> iterator() {
return this.gtvs.iterator();
}
@Override
public Menge<SyntaxTreeNode> getChildren() {
Menge<SyntaxTreeNode> ret = new Menge<>();
for(GenericTypeVar gtv : gtvs){
ret.add(gtv);
}
return ret;
}
public int size() {
return gtvs.size();
}
public Menge<GenericTypeVar> getMenge() {
return this.gtvs;
}
public void add(GenericTypeVar t) {
this.gtvs.add(t);
return null;
}
}

@ -0,0 +1,52 @@
package de.dhbwstuttgart.syntaxtree;
import de.dhbwstuttgart.syntaxtree.type.RefType;
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)
{
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;
}
}

@ -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

@ -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
*/

@ -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

@ -1,57 +1,18 @@
// ino.module.Method.8564.package
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.commons.bcel6.Constants;
import org.apache.commons.bcel6.classfile.Signature;
import org.apache.commons.bcel6.generic.ClassGen;
import org.apache.commons.bcel6.generic.ConstantPoolGen;
import org.apache.commons.bcel6.generic.InstructionFactory;
import org.apache.commons.bcel6.generic.InstructionHandle;
import org.apache.commons.bcel6.generic.InstructionList;
import org.apache.commons.bcel6.generic.MethodGen;
import de.dhbwstuttgart.syntaxtree.type.RefType;
import org.apache.bcel.Constants;
import org.apache.bcel.generic.InstructionList;
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.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
/**
* Stellt eine Methode dar. Problem: Parser kann nicht zwischen Methode und
* Konstruktor unterscheiden. Daher kann diese Klasse beides sein. Dies wird mit
@ -60,378 +21,22 @@ import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertPoint;
* @author janulrich
*
*/
public class Method extends Field implements IItemWithOffset, TypeInsertable
public class Method extends Field implements IItemWithOffset
{
private Block block;
public ParameterList parameterlist = new ParameterList();
public ParameterList parameterlist = new ParameterList(null);
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 List<String> types_in_parameterlist = new ArrayList<>();
private Modifiers modifiers;
protected static Logger inferencelog = Logger.getLogger("inference");
protected static Logger parserlog = Logger.getLogger("parser");
public Method(int offset) {
super(offset);
public Method(String name, RefType returnType, ParameterList parameterList, Block block,
GenericDeclarationList gtvDeclarations, int offset) {
super(name, returnType, offset);
this.name = name;
this.parameterlist = parameterList;
this.block = block;
}
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.setGenericParameter(gtvDeclarations);
this.setReturnType(returnType);
}
public JavaClassName getTypeName()
{
if (this.getType() == null)
return null;
else
return this.getType().getName();
}
public Block get_Block()
{
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;
}
/**
* Author: Jrg Buerle<br/>
*
* @return Die Anzahl der Methoden-Paramater
*/
public int getParameterCount()
{
if (this.getParameterList() == null)
return 0;
else
return this.getParameterList().getParameterCount();
}
public ExceptionList get_ExceptionList()
{
// otth: gibt die Exceptionliste zurueck
return this.exceptionlist;
}
public int getOverloadedID()
{
return (overloadedID);
}
public void setOverloadedID(int overloadedID)
{
this.overloadedID = overloadedID;
}
public String get_Method_Name()
{
DeclId hilf = declid.elementAt(0);
return hilf.get_Name();
}
public Menge get_Type_Paralist()
{
return types_in_parameterlist;
}
public int getLineNumber()
{
return m_LineNumber;
}
public void setLineNumber(int lineNumber)
{
m_LineNumber = lineNumber;
}
public int getOffset()
{
return m_Offset;
}
public int getVariableLength()
{
return get_Method_Name().length();
}
public void setOffset(int Offset)
{
m_Offset = Offset;
}
/**
* <br>
* Author: Jrg Buerle
*
* @return
*/
public int getTypeLineNumber()
{
return this.getLineNumber();
}
/**
* <br/>
* Author: Martin Pl�micke
*
* @return
*/
public String toString()
{
return this.getType() + " " + this.get_Name() + ((block != null) ? block.toString() : "");
}
/**
* Legt fuer die ByteCodeGen fest, ob Bytecode innerhalb der Methode
* generiert wird.
*/
public void setAbstract(boolean b)
{
isAbstract = b;
}
/**
* Gibt zurueck, ob ByteCode innerhabl der Methode generiert wird.
*/
public boolean isAbstract()
{
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();
localAss.add(ass); // Die globalen Assumptions anhängen
// Generische Parameterdeklarationen den Assumptions anfügen:
for (GenericTypeVar gtv : this.getGenericParameter()) {
localAss.add(gtv.createAssumptions());
}
for (GenericTypeVar gtv : this.getGenericParameter()) {
ret.add(gtv.TYPE(localAss));
}
// TypeCheck, falls es sich um einen RefType handelt:
this.returntype = this.returntype.checkTYPE(localAss, this);
// 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));
// eine Verknüpfung mit der Type Assumption aus dem Assumption Set
// und dem ermittelten Typ der Methode:
ret.add(ConstraintsSet.createSingleConstraint(this.block.getType().TYPE(localAss, this), this.returntype.TYPE(localAss, this)));
return ret;
}
/**
* @author Andreas Stadelmeier, a10023
* @return die TypInformationen der Statements dieser Methode.
*/
public String getTypeInformation() {
if (this.parameterlist != null)
return "Methode " + this.get_Name() + " Parameter: "
+ this.parameterlist.getTypeInformation() + ", Block: "
+ this.block.getTypeInformation();
return "Methode " + this.get_Name() + " : " + this.getType()
+ ", Block: " + this.block.getTypeInformation();
}
@Override
public JavaCodeResult printJavaCode(ResultSet resultSet) {
JavaCodeResult ret = new JavaCodeResult();
ret.attach(this.getType().printJavaCode(resultSet)).attach(" ")
.attach(this.get_Method_Name()).attach("(")
.attach(this.getParameterList().printJavaCode(resultSet))
.attach(")\n");
ret.attach(this.block.printJavaCode(resultSet));
return ret;
}
/**
* Liefert die MethodAssumption zu dieser Methode
*/
@Override
public TypeAssumptions createTypeAssumptions(Class classmember) {
Class parentClass = classmember;// this.getParentClass();
TypeAssumptions ret = new TypeAssumptions();
ret.addAssumption(new MethodAssumption(this, parentClass));
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>();
ret.add(this.block);
ret.add(this.parameterlist);
ret.addAll(this.getGenericParameter());
ret.add(this.returntype);
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
// nötig sein. (Parser ändern)
}
/**
* Der Typ einer Methode ist ihr Returntype
*/
@Override
public Type getType() {
// Methode und Block teilen sich einen ReturnType:
return this.returntype;
}
public static Method createEmptyMethod(Block withBlock, String withSignature, Class parent) {
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();
DImethod.set_Name(withSignature);
ret.set_DeclId(DImethod);
Block tempBlock = new Block();
ret.set_Block(tempBlock);
ret.parserPostProcessing(parent);
return ret;
}
@Override
public boolean equals(Object obj) {
if (!(obj instanceof Method))
return false;
Method equals = (Method) obj;
if ((this.returntype != null && equals.returntype == null))
return false;
if ((this.returntype == null && equals.returntype != null))
return false;
if (this.returntype != null && equals.returntype != null)
if (!this.returntype.equals(equals.returntype))
return false;
if (!this.parameterlist.equals(equals.parameterlist))
return false;
return super.equals(obj);
}
public void genByteCode(ClassGenerator cg, Class classObj) {
List<TypeinferenceResultSet> typeInterferenceResults = cg.getTypeinferenceResults().getTypeReconstructions(this, cg);
DHBWInstructionFactory _factory = cg.getInstructionFactory();
for(TypeinferenceResultSet t: typeInterferenceResults){
addMethodToClassGenerator(cg, _factory, t);
}
}
private void addMethodToClassGenerator(ClassGenerator cg, DHBWInstructionFactory _factory, TypeinferenceResultSet t) {
DHBWConstantPoolGen _cp = cg.getConstantPool();
InstructionList il = new InstructionList();
ArrayList<org.apache.commons.bcel6.generic.Type> argumentTypes = new ArrayList<org.apache.commons.bcel6.generic.Type>();
ArrayList<String> argumentNames = new ArrayList<String>();
if(this.parameterlist != null && this.parameterlist.size() > 0){
generateArgumentList(argumentTypes, argumentNames, cg, t);
}
short constants = Constants.ACC_PUBLIC;
if(this.modifiers != null && this.modifiers.includesModifier(new Static())) constants += Constants.ACC_STATIC;
Type returnType = this.getType();
MethodGenerator method = new MethodGenerator(constants, returnType.getBytecodeType(cg, t), argumentTypes.toArray(new org.apache.commons.bcel6.generic.Type[parameterlist.size()]) , argumentNames.toArray(new String[parameterlist.size()]), this.get_Method_Name(), getParentClass().name, il, _cp);
cg.setMethodeGenerator(method);
cg.addMethod(method.createMethod(cg, getParameterList(), returnType, get_Block(), t));
}
private void generateArgumentList(ArrayList<org.apache.commons.bcel6.generic.Type> argumentTypes, ArrayList<String> argumentNames, ClassGenerator cg, TypeinferenceResultSet t) {
for(FormalParameter parameter : this.parameterlist){
argumentTypes.add(parameter.getType().getBytecodeType(cg, t));
argumentNames.add(parameter.getIdentifier());
}
}
}

@ -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<>();
}
}

@ -1,170 +1,34 @@
// 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 de.dhbwstuttgart.bytecode.ClassGenerator;
import de.dhbwstuttgart.syntaxtree.type.RefType;
import de.dhbwstuttgart.typeinference.JavaCodeResult;
import de.dhbwstuttgart.typeinference.ResultSet;
import de.dhbwstuttgart.typeinference.TypeinferenceResultSet;
// ino.end
import java.util.List;
// 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;
// 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: J�rg B�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";
//String ret = "ParameterListe, "+formalparameter.size()+" Einträge [ ";
String ret = " [ ";
for(FormalParameter param : this.formalparameter){
ret += param.toString()+", ";
}
return ret + "]";
}
public JavaCodeResult printJavaCode(ResultSet resultSet) {
JavaCodeResult ret = new JavaCodeResult();
Iterator<FormalParameter> it = this.formalparameter.iterator();
while(it.hasNext()){
FormalParameter param = it.next();
ret.attach(param.printJavaCode(resultSet));
if(it.hasNext())ret.attach(", ");
}
//if(this.formalparameter.size()>0)ret = ret.substring(0, ret.length() - 2);
return ret;
}
@Override
public Iterator<FormalParameter> iterator() {
return this.formalparameter.iterator();
return null;
}
@Override
public boolean equals(Object obj) {
if(!(obj instanceof ParameterList))return false;
ParameterList equals = (ParameterList)obj;
if((this.formalparameter == null )!=(equals.formalparameter==null))return false;
if(this.formalparameter!=null)return this.formalparameter.equals(equals.formalparameter);
return true;
}
@Override
public int getOffset() {
if(formalparameter == null || formalparameter.size()==0)return 0;
return formalparameter.firstElement().getOffset();
}
@Override
public int getVariableLength() {
return 0;
}
@Override
public Menge<? extends SyntaxTreeNode> getChildren() {
return formalparameter;
}
public int size() {
return this.formalparameter.size();
}
public org.apache.commons.bcel6.generic.Type[] getBytecodeTypeList(ClassGenerator cg, TypeinferenceResultSet rs){
org.apache.commons.bcel6.generic.Type[] ret = new org.apache.commons.bcel6.generic.Type[formalparameter.size()];
int i = 0;
for(FormalParameter f : formalparameter){
ret[i] = f.getType().getBytecodeType(cg, rs);
i++;
}
return ret;
}
public String[] getParameterNameArray() {
String[] ret = new String[formalparameter.size()];
int i = 0;
for(FormalParameter f : formalparameter){
ret[i] = f.getIdentifier();
i++;
}
return ret;
}
}
// ino.end

File diff suppressed because it is too large Load Diff

@ -1,138 +1,9 @@
package de.dhbwstuttgart.syntaxtree;
import org.apache.commons.bcel6.generic.ClassGen;
import java.util.List;
import de.dhbwstuttgart.typeinference.Menge;
import de.dhbwstuttgart.bytecode.ClassGenerator;
import de.dhbwstuttgart.core.IItemWithOffset;
import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar;
import de.dhbwstuttgart.syntaxtree.type.Type;
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
import de.dhbwstuttgart.typeinference.Pair;
import de.dhbwstuttgart.typeinference.ResultSet;
import de.dhbwstuttgart.typeinference.TypeInsertable;
import de.dhbwstuttgart.typeinference.TypeinferenceResultSet;
import de.dhbwstuttgart.typeinference.exceptions.DebugException;
import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException;
import de.dhbwstuttgart.typeinference.typedeployment.GenericTypeInsertPoint;
import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertPoint;
import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertSet;
public abstract class SyntaxTreeNode implements IItemWithOffset{
protected SyntaxTreeNode parent;
/**
* Wird nach dem Parsen aufgerufen.
* Erfüllt folgenden Aufgaben:
* 1. Füllt fehlende Typangaben mit TPHs auf.
* 2. Verknüpft die Knoten des Syntaxbaums. (setzt Parent)
* 3. Wechselt RefTypes gegebenenfalls mit GenericTypeVars aus.
* 4. Führt einen Teil des Syntaxckecks durch.
*
*/
public void parserPostProcessing(SyntaxTreeNode parent) {
if(parent == null)throw new NullPointerException();
this.parent = parent;
for(SyntaxTreeNode node : this.getChildren())
if(node!=null)node.parserPostProcessing(this);
}
public SyntaxTreeNode getParent() {
//if(this.parent == null)throw new NullPointerException();
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();
}
/**
* Eine Beschreibung/Name des SyntaxTree-Nodes
* Hat nichts mit der Description im Bytecode zu tun,
* wird für die Anzeige des AST im Plugin verwendet
* @return
*/
public String getDescription(){
return this.toString();
}
@Override
public boolean equals(Object object){
if(!(object instanceof SyntaxTreeNode))return false;
SyntaxTreeNode equal = (SyntaxTreeNode)object;
if(!equal.getDescription().equals(this.getDescription()))return false;
if(this.getParent()!=null)
if(!this.getParent().equals(equal.getParent()))return false; //auch das Elternelement überprüfen.
return true;
}
/**
* Methode zur Generierung der TypeInsertPoints
* @param insertSet - Generierte InsertPoints werden dem insertSet angefügt
* @param result - Das ResultSet auf dessen Basis die InsertPoints generiert werden
*/
public void addTypeInsertPoints(TypeInsertSet insertSet,ResultSet result) {
for(SyntaxTreeNode node : this.getChildren()){
node.addTypeInsertPoints(insertSet, result);
}
TypeInsertPoint tip = null; //Der TypInsertPoint für diesen Knoten
//Fall der Knoten ein TypeInsertable ist, kann direkt der TypeInsertPoint generiert werden.
if(this instanceof TypeInsertable){
TypeInsertable that = (TypeInsertable)this;
Type t = that.getType();
if(t instanceof TypePlaceholder){
tip = that.createTypeInsertPoint((TypePlaceholder) t, result);
insertSet.add(tip);//ret.addAll(((TypePlaceholder)t).getTypeInsertPoints(result));
}
/*
//Für den Fall, dass dieser Knoten Generische Variablen halten kann.
if(that instanceof Generic && that.getOffset()>=0){
//Alle unresolvedTPHs ermitteln und GenericTypeVarInsertPoints bilden:
Menge<TypePlaceholder> uTPHs = insertSet.getUnresolvedTPHs();
if(uTPHs.size()>0){//Nur wenn es auch unresolvedTPHs gibt:
Menge<Pair> gPairs = result.getConstraintsFor(uTPHs);
if(gPairs.size()>0){
GenericTypeInsertPoint genericTIP = new GenericTypeInsertPoint(that,gPairs,result);
insertSet.add(genericTIP);
}
}
}
*/
}
}
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){
if(node.equals(this))return this;
node = inNode.getParent();
}
if(this.getParent()!=null)return this.getParent().getMatchingParentNode(inNode);
return null;
}
public GTVDeclarationContext getGTVDeclarationContext(){
if(this.getParent()==null)
throw new NullPointerException();//throw new DebugException("getGTVDeclarationContext auf unzulässiger Klasse aufgerufen");
return this.getParent().getGTVDeclarationContext();
}
}

@ -1,74 +0,0 @@
package de.dhbwstuttgart.syntaxtree.factory;
import de.dhbwstuttgart.bytecode.ClassGenerator;
import de.dhbwstuttgart.syntaxtree.Class;
import de.dhbwstuttgart.syntaxtree.Constructor;
import de.dhbwstuttgart.syntaxtree.Method;
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.statement.Block;
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 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);
Method method = ASTFactory.createMethod("<init>", paralist, block, superClass);
method.setType(new de.dhbwstuttgart.syntaxtree.type.Void(block, 0));
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
Class generatedClass = new Class(className, type, modifiers, supertypeGenPara);
generatedClass.addField(ASTFactory.createEmptyConstructor(generatedClass));
generatedClass.parserPostProcessing(parent);
return generatedClass;
}
public static Class createObjectClass() {
Class generatedClass = new Class("java.lang.Object", 0);
return generatedClass;
}
}

@ -1,39 +0,0 @@
package de.dhbwstuttgart.syntaxtree.factory;
import de.dhbwstuttgart.syntaxtree.type.Type;
import de.dhbwstuttgart.typeinference.Menge;
import de.dhbwstuttgart.typeinference.Pair;
import de.dhbwstuttgart.typeinference.unify.model.PairOperator;
public class UnifyPairMengenBuilder {
private Menge<Pair> buildMenge = new Menge<Pair>();
public void addPair(Type t1, Type t2) {
buildMenge.add(new Pair(t1, t2));
}
public void addPair(Type t1, Type t2, PairOperator pairOp) {
buildMenge.add(new Pair(t1, t2, pairOp));
}
public Menge<Pair> getPairMenge() {
return buildMenge;
}
public Menge<Menge<Pair>> getNestedPairMenge() {
Menge<Menge<Pair>> nested = new Menge<>();
for(Pair p : buildMenge) {
Menge<Pair> m = new Menge<Pair>();
m.add(p);
nested.add(m);
}
return nested;
}
public void clear() {
buildMenge = new Menge<Pair>();
}
}

@ -1,223 +0,0 @@
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;
import de.dhbwstuttgart.typeinference.assumptions.ClassAssumption;
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
import de.dhbwstuttgart.typeinference.unify.model.ExtendsType;
import de.dhbwstuttgart.typeinference.unify.model.FiniteClosure;
import de.dhbwstuttgart.typeinference.unify.model.FunNType;
import de.dhbwstuttgart.typeinference.unify.model.UnifyPair;
import de.dhbwstuttgart.typeinference.unify.model.PairOperator;
import de.dhbwstuttgart.typeinference.unify.model.PlaceholderType;
import de.dhbwstuttgart.typeinference.unify.model.ReferenceType;
import de.dhbwstuttgart.typeinference.unify.model.SuperType;
import de.dhbwstuttgart.typeinference.unify.model.TypeParams;
import de.dhbwstuttgart.typeinference.unify.model.UnifyType;
public class UnifyTypeFactory {
private final static NullSyntaxTreeNode NULL_NODE = new NullSyntaxTreeNode();
public static FiniteClosure generateFC(TypeAssumptions fromAss){
HashSet<UnifyPair> pairs = new HashSet<>();
for(ClassAssumption cAss : fromAss.getClassAssumptions()){
UnifyType tl = UnifyTypeFactory.convert(cAss.getAssumedClass().getType().TYPE(fromAss, cAss.getAssumedClass()));
Type superClass = cAss.getAssumedClass().getSuperClass();
if(superClass != null){
UnifyType tr = UnifyTypeFactory.convert(superClass.TYPE(fromAss, cAss.getAssumedClass()));
pairs.add(generateSmallerPair(tl, tr));
}
}
return new FiniteClosure(pairs);
}
public static UnifyPair generateSmallerPair(UnifyType tl, UnifyType tr){
return new UnifyPair(tl, tr, PairOperator.SMALLER);
}
public static UnifyPair generateSmallerDotPair(UnifyType tl, UnifyType tr){
return new UnifyPair(tl, tr, PairOperator.SMALLERDOT);
}
public static UnifyType convert(Type t){
//Es wurde versucht ein Typ umzuwandeln, welcher noch nicht von der Factory abgedeckt ist
if(t instanceof GenericTypeVar){
return UnifyTypeFactory.convert((GenericTypeVar)t);
}else if(t instanceof FunN){
return UnifyTypeFactory.convert((FunN)t);
}else if(t instanceof TypePlaceholder){
return UnifyTypeFactory.convert((TypePlaceholder)t);
}else if(t instanceof ExtendsWildcardType){
return UnifyTypeFactory.convert((ExtendsWildcardType)t);
}else if(t instanceof SuperWildcardType){
return UnifyTypeFactory.convert((SuperWildcardType)t);
}else if(t instanceof RefType){
return UnifyTypeFactory.convert((RefType)t);
}
throw new NotImplementedException("Der Typ "+t+" kann nicht umgewandelt werden");
}
public static UnifyType convert(RefType t){
UnifyType ret;
if(t.getParaList() != null && t.getParaList().size() > 0){
Menge<UnifyType> params = new Menge<>();
for(Type pT : t.getParaList()){
params.add(UnifyTypeFactory.convert(pT));
}
ret = new ReferenceType(t.get_Name(),new TypeParams(params));
}else{
ret = new ReferenceType(t.get_Name());
}
return ret;
}
public static UnifyType convert(FunN t){
UnifyType ret;
Menge<UnifyType> params = new Menge<>();
if(t.getParaList() != null && t.getParaList().size() > 0){
for(Type pT : t.getParaList()){
params.add(UnifyTypeFactory.convert(pT));
}
}
ret = FunNType.getFunNType(new TypeParams(params));
return ret;
}
public static UnifyType convert(TypePlaceholder tph){
return new PlaceholderType(tph.get_Name());
}
public static UnifyType convert(ExtendsWildcardType t){
return new ExtendsType(UnifyTypeFactory.convert(t.get_ExtendsType()));
}
public static UnifyType convert(SuperWildcardType t){
return new SuperType(UnifyTypeFactory.convert(t.get_SuperType()));
}
public static UnifyType convert(GenericTypeVar t){
return new PlaceholderType(TypePlaceholder.fresh(NULL_NODE).get_Name());
//return new ReferenceType(t.get_Name());
}
public static UnifyConstraintsSet convert(ConstraintsSet constraints) {
UnifyConstraintsSet ret = new UnifyConstraintsSet();
for(OderConstraint oC : constraints.getOderConstraints()){
ret.add(UnifyTypeFactory.convert(oC));
}
return ret;
}
public static UnifyOderConstraint convert(OderConstraint set) {
UnifyOderConstraint ret = new UnifyOderConstraint();
for(UndConstraint oC : set.getUndConstraints()){
ret.addConstraint(UnifyTypeFactory.convert(oC));
}
return ret;
}
public static UnifyUndConstraint convert(UndConstraint set) {
UnifyUndConstraint ret = new UnifyUndConstraint();
for(EinzelElement<Pair> oC : set.getPairs()){
ret.add(UnifyTypeFactory.convert(oC));
}
return ret;
}
public static UnifyPair convert(EinzelElement<Pair> p) {
return convert(p.getItem());
}
public static UnifyPair convert(Pair p) {
if(!p.OperatorSmaller())throw new NotImplementedException();
UnifyPair ret = generateSmallerDotPair(UnifyTypeFactory.convert(p.TA1)
, UnifyTypeFactory.convert(p.TA2));
return ret;
}
public static Pair convert(UnifyPair mp) {
Type tl = UnifyTypeFactory.convert(mp.getLhsType());
Type tr = UnifyTypeFactory.convert(mp.getRhsType());
return new Pair(tl, tr, mp.getPairOp());
}
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);
ret.set_ParaList(convert(t.getTypeParams()));
return ret;
}
public static Type convert(FunNType t) {
RefType ret = new RefType(t.getName(),null,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);
return new SuperWildcardType(innerType);
}
public static Type convert(ExtendsType t) {
RefType innerType = new RefType(t.getExtendedType().getName(),NULL_NODE,0);
return new ExtendsWildcardType(innerType);
}
public static Type convert(PlaceholderType t) {
TypePlaceholder ret = TypePlaceholder.getInstance(t.getName());
if(ret == null){ //Dieser TPH wurde vom Unifikationsalgorithmus erstellt
ret = TypePlaceholder.fresh(t.getName(), NULL_NODE);
}
return ret;
}
public static Type convert(UnifyType t) {
if(t instanceof FunNType)return convert((FunNType) t);
if(t instanceof ReferenceType)return convert((ReferenceType) t);
if(t instanceof SuperType)return convert((SuperType) t);
if(t instanceof ExtendsType)return convert((ExtendsType) t);
if(t instanceof PlaceholderType)return convert((PlaceholderType) t);
throw new NotImplementedException("Der Typ "+t+" kann nicht umgewandelt werden");
}
private static List<Type> convert(TypeParams typeParams) {
List<Type> ret = new ArrayList<>();
for(UnifyType uT : typeParams){
Type toAdd = convert(uT);
ret.add(toAdd);
}
return ret;
}
}

@ -1,30 +0,0 @@
package de.dhbwstuttgart.syntaxtree.factory;
import de.dhbwstuttgart.typeinference.Menge;
import de.dhbwstuttgart.typeinference.Pair;
import de.dhbwstuttgart.syntaxtree.Class;
import de.dhbwstuttgart.syntaxtree.type.RefType;
import de.dhbwstuttgart.syntaxtree.type.Type;
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())))
classes.add(new Class(t1.get_Name(), t1.getOffset()));
if(t2 instanceof RefType)
if(!classes.stream().anyMatch(x -> x.getName().equals(t2.getName())))
classes.add(new Class(t2.get_Name(), t2.getOffset()));
fc.add(new Pair(t1, t2));
}
public void clear() {
fc = new Menge<Pair>();
classes = new Menge<Class>();
}
}

@ -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);
}
}

@ -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

@ -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

@ -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

@ -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

@ -1,35 +1,17 @@
// 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) {
return new JavaCodeResult("abstract");
}
}
// ino.end

@ -1,35 +1,15 @@
// ino.module.Final.8586.package
package de.dhbwstuttgart.syntaxtree.modifier;
import de.dhbwstuttgart.typeinference.JavaCodeResult;
import de.dhbwstuttgart.typeinference.ResultSet;
// ino.class.Final.24022.description type=javadoc
/**
* Stellt den Modifier Final dar.
*
*/
// ino.end
// ino.class.Final.24022.declaration
public class Final extends Modifier
// ino.end
// ino.class.Final.24022.body
{
// ino.method.getBitmask.24026.definition
public short getBitmask()
// ino.end
// ino.method.getBitmask.24026.body
{
return 0x10;
}
// ino.end
@Override
public JavaCodeResult printJavaCode(ResultSet resultSet) {
return new JavaCodeResult("final");
}
}
// ino.end

@ -3,8 +3,6 @@
*/
package de.dhbwstuttgart.syntaxtree.modifier;
import de.dhbwstuttgart.typeinference.JavaCodeResult;
import de.dhbwstuttgart.typeinference.ResultSet;
/**
* @author Daniel
@ -16,8 +14,5 @@ public class InterfaceModifier extends Modifier {
return 0x0200;
}
@Override
public JavaCodeResult printJavaCode(ResultSet resultSet) {
return new JavaCodeResult("interface");
}
}

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