SubComposant limits
This commit is contained in:
parent
cffe1eb19d
commit
afbb114086
1 changed files with 60 additions and 1 deletions
|
@ -110,6 +110,8 @@ public class ParserComposantGenerator {
|
||||||
StateTree<Element> operations = new StateTree<>();
|
StateTree<Element> operations = new StateTree<>();
|
||||||
StateTree<Element> operation = new StateTree<>();
|
StateTree<Element> operation = new StateTree<>();
|
||||||
|
|
||||||
|
StateTree<Element> sub_operations = new StateTree<>();
|
||||||
|
|
||||||
StateTree<Element> gotoValidator = new StateTree<>();
|
StateTree<Element> gotoValidator = new StateTree<>();
|
||||||
gotoValidator.then((v) -> v.validate(
|
gotoValidator.then((v) -> v.validate(
|
||||||
(t) -> t.getType().equals(TokenType.NAME),
|
(t) -> t.getType().equals(TokenType.NAME),
|
||||||
|
@ -123,7 +125,7 @@ public class ParserComposantGenerator {
|
||||||
|
|
||||||
parent.currentDeclared = comp;
|
parent.currentDeclared = comp;
|
||||||
return parent;
|
return parent;
|
||||||
}).then(new RedirectStateTree<>(operations, (bag) -> {
|
}).then(new RedirectStateTree<>(sub_operations, (bag) -> {
|
||||||
return "operations";
|
return "operations";
|
||||||
}))
|
}))
|
||||||
.end((composant, bag) -> {
|
.end((composant, bag) -> {
|
||||||
|
@ -265,6 +267,63 @@ public class ParserComposantGenerator {
|
||||||
return composant;
|
return composant;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
StateTree<Element> sub_suit = sub_operations.then(new RedirectStateTree<>(operation, (bag) -> {
|
||||||
|
Integer count = bag.get("count");
|
||||||
|
if(count == null) count = 0;
|
||||||
|
bag.set("count", count+1);
|
||||||
|
return "operation"+count;
|
||||||
|
})).loop();
|
||||||
|
sub_suit.then((v) -> v.validate((t) -> t.getValue().equals(",")))
|
||||||
|
.end((composant, bag) -> {
|
||||||
|
Composant current = (Composant)composant;
|
||||||
|
if(current.currentDeclared != null) current = current.currentDeclared;
|
||||||
|
MultipleWayComposant way = current.current;
|
||||||
|
|
||||||
|
int count = bag.get("count");
|
||||||
|
LinkedComposant linked = new LinkedComposant();
|
||||||
|
for(int i = 0; i < count; i++){
|
||||||
|
Bag op = bag.get("operation"+i);
|
||||||
|
if(op.get() == null) continue;
|
||||||
|
linked.elements.add(op.get());
|
||||||
|
}
|
||||||
|
way.elements.add(linked);
|
||||||
|
return composant;
|
||||||
|
}).then(suit);
|
||||||
|
sub_suit.then((v) -> v.validate((t) -> t.getValue().equals(";")))
|
||||||
|
.end((composant, bag) -> {
|
||||||
|
Composant current = (Composant)composant;
|
||||||
|
if(current.currentDeclared != null) current = current.currentDeclared;
|
||||||
|
MultipleWayComposant way = current.current;
|
||||||
|
|
||||||
|
int count = bag.get("count");
|
||||||
|
LinkedComposant linked = new LinkedComposant();
|
||||||
|
for(int i = 0; i < count; i++){
|
||||||
|
Bag op = bag.get("operation"+i);
|
||||||
|
if(op.get() == null) continue;
|
||||||
|
linked.elements.add(op.get());
|
||||||
|
}
|
||||||
|
way.elements.add(linked);
|
||||||
|
current.include();
|
||||||
|
return composant;
|
||||||
|
});
|
||||||
|
sub_suit.end((composant, bag) -> {
|
||||||
|
Composant current = (Composant)composant;
|
||||||
|
if(current.currentDeclared != null) current = current.currentDeclared;
|
||||||
|
MultipleWayComposant way = current.current;
|
||||||
|
|
||||||
|
int count = bag.get("count");
|
||||||
|
LinkedComposant linked = new LinkedComposant();
|
||||||
|
for(int i = 0; i < count; i++){
|
||||||
|
Bag op = bag.get("operation"+i);
|
||||||
|
if(op.get() == null) continue;
|
||||||
|
linked.elements.add(op.get());
|
||||||
|
}
|
||||||
|
way.elements.add(linked);
|
||||||
|
current.include();
|
||||||
|
return composant;
|
||||||
|
});
|
||||||
|
|
||||||
StateTree<Element> main = new StateTree<>();
|
StateTree<Element> main = new StateTree<>();
|
||||||
|
|
||||||
StateTree<Element> composant = main.then((v) -> v.validate(
|
StateTree<Element> composant = main.then((v) -> v.validate(
|
||||||
|
|
Loading…
Add table
Reference in a new issue