bugfix in the Phrasebook UI

This commit is contained in:
krasimir
2016-06-03 07:14:52 +00:00
parent 1a29ccd2ef
commit eb6058b517
2 changed files with 10 additions and 4 deletions

View File

@@ -18,6 +18,11 @@ public class ChoiceContext {
stack.clear();
}
public void trim() {
while (pos < choices.size())
choices.remove(choices.size()-1);
}
public int choose(SyntaxNode node) {
SyntacticChoice choice = null;
@@ -25,8 +30,7 @@ public class ChoiceContext {
if (choices.get(pos).getNode().unlink() == node.unlink()) {
choice = choices.get(pos);
} else {
while (pos < choices.size())
choices.remove(choices.size()-1);
trim();
}
}
@@ -38,7 +42,7 @@ public class ChoiceContext {
pos++;
return choice.getChoice();
}
public void push(SyntaxNode[] args) {
stack.add(args);
}

View File

@@ -21,7 +21,9 @@ public class SyntaxTree implements Serializable {
}
public Expr getAbstractSyntax(ChoiceContext choices) {
return Expr.readExpr(root.getAbstractSyntax(choices));
Expr expr = Expr.readExpr(root.getAbstractSyntax(choices));
choices.trim();
return expr;
}
@Override