[Build] Take package & imports
This commit is contained in:
parent
12d9f5b6cd
commit
71f0c46b00
2 changed files with 26 additions and 20 deletions
|
@ -921,7 +921,10 @@ public class JavaParser extends Parser<JavaElement> {
|
|||
return validator.validate((token) -> token.getValue().equals(";"));
|
||||
}
|
||||
return false;
|
||||
}).<JavaElement>end((javafile, bag) -> javafile);
|
||||
}).<JavaElement>end((parent, bag) -> {
|
||||
((JavaFile)parent).addImport(bag);
|
||||
return parent;
|
||||
});
|
||||
|
||||
|
||||
InitialStateTree<JavaElement> main = new InitialStateTree<>();
|
||||
|
@ -939,7 +942,10 @@ public class JavaParser extends Parser<JavaElement> {
|
|||
return validator.validate((token) -> token.getValue().equals(";"));
|
||||
}
|
||||
return false;
|
||||
}).end((javafile, bag) -> javafile);
|
||||
}).end((parent, bag) -> {
|
||||
((JavaFile)parent).setPackage(bag);
|
||||
return parent;
|
||||
});
|
||||
main.multiple(pack);
|
||||
main.multiple(importState);
|
||||
main.multiple(annotation);
|
||||
|
@ -994,21 +1000,21 @@ public class JavaParser extends Parser<JavaElement> {
|
|||
return 0;
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception{
|
||||
File file = new File("C:\\Users\\jeffc\\eclipse-workspace\\Eclipse_Lhoist_Xavier_plan2Track_IT1\\app\\src\\main\\java\\be\\helmo\\plan2track\\planner\\domain\\Assembly.java");
|
||||
|
||||
BufferedReader reader = new BufferedReader(new FileReader(file));
|
||||
|
||||
time = System.currentTimeMillis();
|
||||
|
||||
Parser<JavaElement> parser = new JavaParser();
|
||||
JavaElement jFile = new JavaElement();
|
||||
parser.parse(reader, jFile);
|
||||
|
||||
System.out.println((System.currentTimeMillis()-time)+"ms");
|
||||
|
||||
System.out.println(TokenValidator.MAX_VALIDATE+" / "+TokenValidator.TOKENS);
|
||||
|
||||
parser.build(new BufferedWriter(new FileWriter(new File("/home/ParserV2.txt"))));
|
||||
}
|
||||
// public static void main(String[] args) throws Exception{
|
||||
// File file = new File("C:\\Users\\jeffc\\eclipse-workspace\\Eclipse_Lhoist_Xavier_plan2Track_IT1\\app\\src\\main\\java\\be\\helmo\\plan2track\\planner\\domain\\Assembly.java");
|
||||
//
|
||||
// BufferedReader reader = new BufferedReader(new FileReader(file));
|
||||
//
|
||||
// time = System.currentTimeMillis();
|
||||
//
|
||||
// Parser<JavaElement> parser = new JavaParser();
|
||||
// JavaElement jFile = new JavaElement();
|
||||
// parser.parse(reader, jFile);
|
||||
//
|
||||
// System.out.println((System.currentTimeMillis()-time)+"ms");
|
||||
//
|
||||
// System.out.println(TokenValidator.MAX_VALIDATE+" / "+TokenValidator.TOKENS);
|
||||
//
|
||||
// parser.build(new BufferedWriter(new FileWriter(new File("/home/ParserV2.txt"))));
|
||||
// }
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue