mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-09 04:59:31 -06:00
bugfix in the Phrasebook UI
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user