Skip to content

Commit be2bd90

Browse files
committed
* forest.js: add default action.
1 parent 4871506 commit be2bd90

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

forest.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,13 @@ var process_forest, forest_to_html, evaluate_forest;
113113
// Evaluation:
114114

115115
var expr_fns = {
116-
choices: function(c) { return c; },
116+
choices: function(c) { throw "Can't evaluate ambiguous parse."; },
117117
derivation: function(d) { return d; },
118-
symbol: function(i, d) { return i.rule ? i.rule.action(d) : (d ? d : i.tag); }
118+
symbol: function(i, d) {
119+
return i.rule ?
120+
(i.rule.action ? i.rule.action(d) : d[0])
121+
: (d ? d : i.tag);
122+
}
119123
};
120124

121125
evaluate_forest = function evaluate_forest(f) {

0 commit comments

Comments
 (0)