mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-23 03:32:51 -06:00
bugfix in the Phrasebook UI
This commit is contained in:
@@ -18,6 +18,11 @@ public class ChoiceContext {
|
|||||||
stack.clear();
|
stack.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void trim() {
|
||||||
|
while (pos < choices.size())
|
||||||
|
choices.remove(choices.size()-1);
|
||||||
|
}
|
||||||
|
|
||||||
public int choose(SyntaxNode node) {
|
public int choose(SyntaxNode node) {
|
||||||
SyntacticChoice choice = null;
|
SyntacticChoice choice = null;
|
||||||
|
|
||||||
@@ -25,8 +30,7 @@ public class ChoiceContext {
|
|||||||
if (choices.get(pos).getNode().unlink() == node.unlink()) {
|
if (choices.get(pos).getNode().unlink() == node.unlink()) {
|
||||||
choice = choices.get(pos);
|
choice = choices.get(pos);
|
||||||
} else {
|
} else {
|
||||||
while (pos < choices.size())
|
trim();
|
||||||
choices.remove(choices.size()-1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,7 +42,7 @@ public class ChoiceContext {
|
|||||||
pos++;
|
pos++;
|
||||||
return choice.getChoice();
|
return choice.getChoice();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void push(SyntaxNode[] args) {
|
public void push(SyntaxNode[] args) {
|
||||||
stack.add(args);
|
stack.add(args);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,9 @@ public class SyntaxTree implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Expr getAbstractSyntax(ChoiceContext choices) {
|
public Expr getAbstractSyntax(ChoiceContext choices) {
|
||||||
return Expr.readExpr(root.getAbstractSyntax(choices));
|
Expr expr = Expr.readExpr(root.getAbstractSyntax(choices));
|
||||||
|
choices.trim();
|
||||||
|
return expr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user