diff options
| author | hallgren <hallgren@chalmers.se> | 2013-03-28 16:00:04 +0000 |
|---|---|---|
| committer | hallgren <hallgren@chalmers.se> | 2013-03-28 16:00:04 +0000 |
| commit | 63c0b7ae5de4798a5b1c0a11e501fccd1f7a025e (patch) | |
| tree | ab09a4a1913193ba705f6aa822f3dda56282594e /src | |
| parent | 08046137cb702787dd1620ce5e451926a73725ae (diff) | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/www/minibar/about.html | 5 | ||||
| -rw-r--r-- | src/www/minibar/minibar_translations.js | 33 |
2 files changed, 23 insertions, 15 deletions
diff --git a/src/www/minibar/about.html b/src/www/minibar/about.html index 5383dd45f..c8c73e095 100644 --- a/src/www/minibar/about.html +++ b/src/www/minibar/about.html @@ -228,11 +228,14 @@ Some implementation details: 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 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> <hr> <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> <address> <a href="http://www.cse.chalmers.se/~hallgren/">TH</a> diff --git a/src/www/minibar/minibar_translations.js b/src/www/minibar/minibar_translations.js index 4aa571486..1ad9d6c44 100644 --- a/src/www/minibar/minibar_translations.js +++ b/src/www/minibar/minibar_translations.js @@ -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) { var f=this.options.tree_img_format; - var i=button_img(tree_icon,function(){toggle_img(i)}); - i.title="Click to display abstract syntax tree" - i.other=this.server.current_grammar_url+"?command=abstrtree&format="+f+"&tree="+encodeURIComponent(abs); - return i; + var img=this.server.current_grammar_url+"?command=abstrtree&format="+f+"&tree="+encodeURIComponent(abs) + var btn=tree_button(img); + btn.title="Click to display abstract syntax tree" + return btn } 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 +"?command=parsetree&format="+f+"&nodefont=arial" +"&from="+lang+"&tree="+encodeURIComponent(abs); - var imgs=[tree_icon,img+"&nofun=true",img] - var current=0; - function cycle() { - 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; + var btn=tree_button(img) + btn.title="Click to display parse tree. Click again to show function names." + return btn; } function draw_brackets(b) { |
