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),
|
(t) -> t.getType().equals(TokenType.NAME),
|
||||||
(bag, t) -> bag.set(t)))
|
(bag, t) -> bag.set(t)))
|
||||||
.then((v) -> v.validate((t) -> t.getValue().equals(":")))
|
.then((v) -> v.validate((t) -> t.getValue().equals(":")))
|
||||||
.end((composant, bag) -> {
|
.<Element>end((composant, bag) -> {
|
||||||
return composant;
|
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<>();
|
StateTree<Element> redirection = new StateTree<>();
|
||||||
|
@ -226,7 +232,8 @@ public class ParserComposantGenerator {
|
||||||
linked.elements.add(op.get());
|
linked.elements.add(op.get());
|
||||||
}
|
}
|
||||||
way.elements.add(linked);
|
way.elements.add(linked);
|
||||||
System.out.println(",\t"+way);
|
((Composant)composant).include();
|
||||||
|
System.out.println(";\t"+way);
|
||||||
return composant;
|
return composant;
|
||||||
}).then(suit);
|
}).then(suit);
|
||||||
suit.end((composant, bag) -> {
|
suit.end((composant, bag) -> {
|
||||||
|
@ -294,13 +301,16 @@ public class ParserComposantGenerator {
|
||||||
|
|
||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
private List<Element> path;
|
private MultipleWayComposant path;
|
||||||
private List<Element> declared;
|
private Map<String, MultipleWayComposant> declared;
|
||||||
private List<Element> next;
|
private List<Element> next;
|
||||||
|
|
||||||
private MultipleWayComposant current;
|
private MultipleWayComposant current;
|
||||||
|
|
||||||
public Composant(){
|
public Composant(){
|
||||||
|
this.declared = new HashMap<>();
|
||||||
|
this.next = new ArrayList<>();
|
||||||
|
|
||||||
current = new MultipleWayComposant();
|
current = new MultipleWayComposant();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -309,6 +319,17 @@ public class ParserComposantGenerator {
|
||||||
this.title = bag.<Token>get().getValue();
|
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
|
@Override
|
||||||
public String toString(){
|
public String toString(){
|
||||||
return title+"(";
|
return title+"(";
|
||||||
|
|
Loading…
Add table
Reference in a new issue