minibar: better implementation of word replacement

Instead of trying to reconstruct the abstract tree from the bracketed string,
use the node numbers (the field called "fid") to identify which node in the
abstact syntax tree a word in the bracketed string corresponds to.
This commit is contained in:
hallgren
2012-04-02 16:05:11 +00:00
parent c2a72daa74
commit 7ee66302d1
2 changed files with 44 additions and 26 deletions

View File

@@ -178,6 +178,7 @@ Translations.prototype.parsetree_button=function(abs,lang) {
function draw_brackets(b) {
return b.token
? span_class("token",text(b.token))
: node("span",{"class":"brackets",title:(b.fun||"_")+":"+b.cat},
: node("span",{"class":"brackets",
title:(b.fun||"_")+":"+b.cat+" "+b.fid+":"+b.index},
b.children.map(draw_brackets))
}