Declared operations
This commit is contained in:
parent
0a474c1f1d
commit
299267f265
1 changed files with 26 additions and 5 deletions
|
@ -111,8 +111,14 @@ public class ParserComposantGenerator {
|
|||
(t) -> t.getType().equals(TokenType.NAME),
|
||||
(bag, t) -> bag.set(t)))
|
||||
.then((v) -> v.validate((t) -> t.getValue().equals(":")))
|
||||
.end((composant, bag) -> {
|
||||
return composant;
|
||||
.<Element>end((composant, bag) -> {
|
||||
Composant parent = (Composant)composant;
|
||||
Composant comp = new Composant();
|
||||
comp.title = parent.title+"_"+bag.<Token>get().getValue();
|
||||
parent.declare(bag.<Token>get().getValue(), comp.current);
|
||||
|
||||
System.out.println("go on "+comp);
|
||||
return comp;
|
||||
});
|
||||
|
||||
StateTree<Element> redirection = new StateTree<>();
|
||||
|
@ -226,7 +232,8 @@ public class ParserComposantGenerator {
|
|||
linked.elements.add(op.get());
|
||||
}
|
||||
way.elements.add(linked);
|
||||
System.out.println(",\t"+way);
|
||||
((Composant)composant).include();
|
||||
System.out.println(";\t"+way);
|
||||
return composant;
|
||||
}).then(suit);
|
||||
suit.end((composant, bag) -> {
|
||||
|
@ -294,13 +301,16 @@ public class ParserComposantGenerator {
|
|||
|
||||
private String title;
|
||||
|
||||
private List<Element> path;
|
||||
private List<Element> declared;
|
||||
private MultipleWayComposant path;
|
||||
private Map<String, MultipleWayComposant> declared;
|
||||
private List<Element> next;
|
||||
|
||||
private MultipleWayComposant current;
|
||||
|
||||
public Composant(){
|
||||
this.declared = new HashMap<>();
|
||||
this.next = new ArrayList<>();
|
||||
|
||||
current = new MultipleWayComposant();
|
||||
}
|
||||
|
||||
|
@ -309,6 +319,17 @@ public class ParserComposantGenerator {
|
|||
this.title = bag.<Token>get().getValue();
|
||||
}
|
||||
|
||||
public void include(){
|
||||
if(path == null){
|
||||
path = current;
|
||||
current = new MultipleWayComposant();
|
||||
}
|
||||
}
|
||||
|
||||
public void declare(String value, MultipleWayComposant composant){
|
||||
this.declared.put(value, composant);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(){
|
||||
return title+"(";
|
||||
|
|
Loading…
Add table
Reference in a new issue