Änderungen am Lexer

This commit is contained in:
JanUlrich 2014-07-09 10:52:23 +02:00
parent d5258d2d09
commit 39bcd6702b
9 changed files with 10022 additions and 5971 deletions

View File

@ -169,18 +169,6 @@ null {
{ws}|\n { /* System.out.print(yytext()); */ }
\\.\n {org.apache.log4j.Logger.getLogger("parser").debug("Kommentar: "+yytext());}
"->" {this.token = new Token(JavaParser.LAMBDAASSIGNMENT, yytext(), yyline, yychar);return true;}
">" {this.token = new Token(JavaParser.ENDOFGENERICVARDECLARATION, yytext(), yyline, yychar);return true;}

View File

@ -7,6 +7,7 @@ Backup von JavaParser.jay 10.April 17 Uhr
package mycompiler.myparser;
import mycompiler.myclass.FieldDeclaration;
import mycompiler.myclass.GenericDeclarationList;
import mycompiler.myclass.Field;
import java.util.Vector;
import mycompiler.SourceFile;
@ -200,6 +201,7 @@ public Vector<Pair> testPair = new Vector<Pair>();
%token OP
%token EOF
%token LAMBDAASSIGNMENT
%token <Token> ENDOFGENERICVARDECLARATION
%type <Class> classdeclaration
%type <Interface> interfacedeclaration
@ -903,13 +905,13 @@ fielddeclarator :
}
genericdeclarationlist : '<' boundedMethodParameters '>'
genericdeclarationlist : '<' boundedMethodParameters ENDOFGENERICVARDECLARATION
{
GenericDeclarationList ret = new GenericDeclarationList($2);
ret.setOffset($3.getOffset());
GenericDeclarationList ret = new GenericDeclarationList($2,$3.getOffset());
$$ = ret;
}
fielddeclaration : fielddeclarator ';'
{
$$=$1;

View File

@ -1195,7 +1195,7 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface, IItemWit
classBodyCode.attach(bodyString);
//Zuerst die generischen Parameter für diese Klasse berechnen:
this.createGenericTypeVars(classBodyCode.getUnresolvedTPH());
//this.createGenericTypeVars(classBodyCode.getUnresolvedTPH());
if(this.genericClassParameters != null && this.genericClassParameters.size()>0){
ret.attach("<");
@ -1218,7 +1218,7 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface, IItemWit
* Errechnet die Generischen Parameter der Klasse für diese Klasse.
* Die berechneten Variablen werden anschließend in die this.genericTypeVars eingesetzt. Dabei werden alte genericTypeVars überschrieben.
* @param tphs : Alle übriggebliebenen TypePLaceholder
*/
private void createGenericTypeVars(Vector<TypePlaceholder> tphs){
this.genericClassParameters = new GenericDeclarationList(new Vector<GenericTypeVar>());
for(TypePlaceholder tph : tphs){
@ -1226,7 +1226,7 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface, IItemWit
if(!this.genericClassParameters.contains(toAdd))this.genericClassParameters.add(toAdd);
}
}
*/
/**
* Errechnet die Generischen Parameter der Klasse für diese Klasse.
* Die berechneten Variablen werden anschließend in die this.genericTypeVars eingesetzt. Dabei werden alte genericTypeVars überschrieben.

View File

@ -13,9 +13,8 @@ import mycompiler.mytype.GenericTypeVar;
*/
public class GenericDeclarationList extends Vector<GenericTypeVar>{
public GenericDeclarationList(Vector<GenericTypeVar> vector) {
public GenericDeclarationList(Vector<GenericTypeVar> vector, int offset) {
// TODO Auto-generated constructor stub
}
}

View File

@ -169,18 +169,6 @@ null {
{ws}|\n { /* System.out.print(yytext()); */ }
\\.\n {org.apache.log4j.Logger.getLogger("parser").debug("Kommentar: "+yytext());}
"->" {this.token = new Token(JavaParser.LAMBDAASSIGNMENT, yytext(), yyline, yychar);return true;}
">" {this.token = new Token(JavaParser.ENDOFGENERICVARDECLARATION, yytext(), yyline, yychar);return true;}

File diff suppressed because it is too large Load Diff

View File

@ -7,6 +7,7 @@ Backup von JavaParser.jay 10.April 17 Uhr
package mycompiler.myparser;
import mycompiler.myclass.FieldDeclaration;
import mycompiler.myclass.GenericDeclarationList;
import mycompiler.myclass.Field;
import java.util.Vector;
import mycompiler.SourceFile;
@ -200,6 +201,7 @@ public Vector<Pair> testPair = new Vector<Pair>();
%token OP
%token EOF
%token LAMBDAASSIGNMENT
%token <Token> ENDOFGENERICVARDECLARATION
%type <Class> classdeclaration
%type <Interface> interfacedeclaration
@ -903,13 +905,13 @@ fielddeclarator :
}
genericdeclarationlist : '<' boundedMethodParameters '>'
genericdeclarationlist : '<' boundedMethodParameters ENDOFGENERICVARDECLARATION
{
GenericDeclarationList ret = new GenericDeclarationList($2);
ret.setOffset($3.getOffset());
GenericDeclarationList ret = new GenericDeclarationList($2,$3.getOffset());
$$ = ret;
}
fielddeclaration : fielddeclarator ';'
{
$$=$1;

View File

@ -29,8 +29,8 @@ public class GeneralParserTest{
public void run(){
Vector<String> filenames = new Vector<String>();
filenames.add("FieldInitializationTest.jav");
filenames.add("ImportTest.jav");
filenames.add("BoundedParameter.jav");
//filenames.add("ImportTest.jav");
//filenames.add("BoundedParameter.jav");
filenames.add("GenericFieldVarTest.jav");
MyCompilerAPI compiler = MyCompiler.getAPI();
try{

File diff suppressed because it is too large Load Diff