1
0
forked from GitHub/gf-core

minibar: show abstract syntax trees without or with function names

Click once to show abstract syntax trees without function names. Click again
to add function names.
This commit is contained in:
hallgren
2013-03-28 16:00:04 +00:00
parent 525b983b4c
commit 0e45b8513f
2 changed files with 23 additions and 15 deletions

View File

@@ -228,11 +228,14 @@ Some implementation details:
trees without function names. Click again to add function names. trees without function names. Click again to add function names.
<li>[Added 2013-03-27] Click on a linearization to obtain a table with all <li>[Added 2013-03-27] Click on a linearization to obtain a table with all
variants and forms. Click again to hide the table. variants and forms. Click again to hide the table.
<li>[Added 2013-03-28] Abstract syntax tree visualizations: click once to
show abstract syntax trees without function names. Click again to add
function names.
</ul> </ul>
<hr> <hr>
<div class=modtime><small> <div class=modtime><small>
<!-- hhmts start -->Last modified: Wed Mar 27 17:43:38 CET 2013 <!-- hhmts end --> <!-- hhmts start -->Last modified: Thu Mar 28 16:56:32 CET 2013 <!-- hhmts end -->
</small></div> </small></div>
<address> <address>
<a href="http://www.cse.chalmers.se/~hallgren/">TH</a> <a href="http://www.cse.chalmers.se/~hallgren/">TH</a>

View File

@@ -213,12 +213,24 @@ Translations.prototype.show_groupedtranslations=function(translationsResult) {
} }
function tree_button(img_url) {
var imgs=[tree_icon,img_url+"&nofun=true",img_url]
var current=0;
function cycle() {
current++;
if(current>=imgs.length) current=0;
i.src=imgs[current]
}
var i=button_img(tree_icon,cycle);
return i
}
Translations.prototype.abstree_button=function(abs) { Translations.prototype.abstree_button=function(abs) {
var f=this.options.tree_img_format; var f=this.options.tree_img_format;
var i=button_img(tree_icon,function(){toggle_img(i)}); var img=this.server.current_grammar_url+"?command=abstrtree&format="+f+"&tree="+encodeURIComponent(abs)
i.title="Click to display abstract syntax tree" var btn=tree_button(img);
i.other=this.server.current_grammar_url+"?command=abstrtree&format="+f+"&tree="+encodeURIComponent(abs); btn.title="Click to display abstract syntax tree"
return i; return btn
} }
Translations.prototype.alignment_button=function(abs,all,toLangs) { Translations.prototype.alignment_button=function(abs,all,toLangs) {
@@ -235,16 +247,9 @@ Translations.prototype.parsetree_button=function(abs,lang) {
var img=this.server.current_grammar_url var img=this.server.current_grammar_url
+"?command=parsetree&format="+f+"&nodefont=arial" +"?command=parsetree&format="+f+"&nodefont=arial"
+"&from="+lang+"&tree="+encodeURIComponent(abs); +"&from="+lang+"&tree="+encodeURIComponent(abs);
var imgs=[tree_icon,img+"&nofun=true",img] var btn=tree_button(img)
var current=0; btn.title="Click to display parse tree. Click again to show function names."
function cycle() { return btn;
current++;
if(current>=imgs.length) current=0;
i.src=imgs[current]
}
var i=button_img(tree_icon,cycle);
i.title="Click to display parse tree. Click again to show function names."
return i;
} }
function draw_brackets(b) { function draw_brackets(b) {