Skip to content

Commit

Permalink
Reorder modes for functional style.
Browse files Browse the repository at this point in the history
  • Loading branch information
jorendorff committed Sep 24, 2013
1 parent c0cb144 commit d95b485
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions calculator.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ <h1>Compilers 101 Toy Calculator</h1>
<p class="srclink"><a href="docs/calculator-parser.html">parser source</a>
| <a href="docs/calculator-backends.html">back-end source</a></p>
<ul id="options">
<li><label><input type="radio" name="mode" value="calc" checked>calculator mode</label>
<li><label><input type="radio" name="mode" value="fraction">fraction mode</label>
<li><label><input type="radio" name="mode" value="json" checked>JSON mode</label>
<li><label><input type="radio" name="mode" value="blocks">Scratch mode</label>
<li><label><input type="radio" name="mode" value="json">JSON mode</label>
<li><label><input type="radio" name="mode" value="mathml">MathML mode</label>
<li><label><input type="radio" name="mode" value="calc">calculator mode</label>
<li><label><input type="radio" name="mode" value="fraction">fraction mode</label>
<li><label><input type="radio" name="mode" value="graph">graph mode</label>
<li><label><input type="radio" name="mode" value="complex">complex mode</label>
</ul>
Expand Down
20 changes: 10 additions & 10 deletions ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -344,26 +344,26 @@ function go() {
try {
var result = parseModes[mode](question);
switch (mode) {
case 'calc':
Shell.printAnswer(result);
break;

case 'fraction':
Shell.printAnswer(result);
case 'json':
Shell.printAnswer(JSON.stringify(result, undefined, " "));
break;

case 'blocks':
writeNode("normalOutput", result);
break;

case 'json':
Shell.printAnswer(JSON.stringify(result, undefined, " "));
break;

case 'mathml':
writeNode("normalOutput", result.element);
break;

case 'calc':
Shell.printAnswer(result);
break;

case 'fraction':
Shell.printAnswer(result);
break;

case 'graph':
showPlot(result);
break;
Expand Down

0 comments on commit d95b485

Please sign in to comment.