[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 validator.validate((token) -> token.getValue().equals(";"));
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}).<JavaElement>end((javafile, bag) -> javafile);
|
}).<JavaElement>end((parent, bag) -> {
|
||||||
|
((JavaFile)parent).addImport(bag);
|
||||||
|
return parent;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
InitialStateTree<JavaElement> main = new InitialStateTree<>();
|
InitialStateTree<JavaElement> main = new InitialStateTree<>();
|
||||||
|
@ -939,7 +942,10 @@ public class JavaParser extends Parser<JavaElement> {
|
||||||
return validator.validate((token) -> token.getValue().equals(";"));
|
return validator.validate((token) -> token.getValue().equals(";"));
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}).end((javafile, bag) -> javafile);
|
}).end((parent, bag) -> {
|
||||||
|
((JavaFile)parent).setPackage(bag);
|
||||||
|
return parent;
|
||||||
|
});
|
||||||
main.multiple(pack);
|
main.multiple(pack);
|
||||||
main.multiple(importState);
|
main.multiple(importState);
|
||||||
main.multiple(annotation);
|
main.multiple(annotation);
|
||||||
|
@ -994,21 +1000,21 @@ public class JavaParser extends Parser<JavaElement> {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception{
|
// 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");
|
// 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));
|
// BufferedReader reader = new BufferedReader(new FileReader(file));
|
||||||
|
//
|
||||||
time = System.currentTimeMillis();
|
// time = System.currentTimeMillis();
|
||||||
|
//
|
||||||
Parser<JavaElement> parser = new JavaParser();
|
// Parser<JavaElement> parser = new JavaParser();
|
||||||
JavaElement jFile = new JavaElement();
|
// JavaElement jFile = new JavaElement();
|
||||||
parser.parse(reader, jFile);
|
// parser.parse(reader, jFile);
|
||||||
|
//
|
||||||
System.out.println((System.currentTimeMillis()-time)+"ms");
|
// System.out.println((System.currentTimeMillis()-time)+"ms");
|
||||||
|
//
|
||||||
System.out.println(TokenValidator.MAX_VALIDATE+" / "+TokenValidator.TOKENS);
|
// System.out.println(TokenValidator.MAX_VALIDATE+" / "+TokenValidator.TOKENS);
|
||||||
|
//
|
||||||
parser.build(new BufferedWriter(new FileWriter(new File("/home/ParserV2.txt"))));
|
// parser.build(new BufferedWriter(new FileWriter(new File("/home/ParserV2.txt"))));
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ import be.jeffcheasey88.peeratcode.parser.TokenValidator;
|
||||||
import be.jeffcheasey88.peeratcode.parser.state.RedirectStateTree;
|
import be.jeffcheasey88.peeratcode.parser.state.RedirectStateTree;
|
||||||
import be.jeffcheasey88.peeratcode.parser.state.StateTree;
|
import be.jeffcheasey88.peeratcode.parser.state.StateTree;
|
||||||
|
|
||||||
public class ClassTests {
|
public class ClassTests{
|
||||||
|
|
||||||
public static StateTree<JavaElement> get(){
|
public static StateTree<JavaElement> get(){
|
||||||
StateTree<JavaElement> clazz_ = new StateTree<>();
|
StateTree<JavaElement> clazz_ = new StateTree<>();
|
||||||
|
|
Loading…
Add table
Reference in a new issue