Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Double pane Try page #160

Open
wants to merge 4 commits into
base: gh-pages
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions assets/js/try.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ if(typeof console === 'undefined'){
console = {};
console.log = function (str) {$("#out").text(uneval(str))};
}
// noop
print = function (){}

// Can't just do 'print = console.log' because of chromium bug #179628
print = console.log.bind(console);

var printOut = function (str) { $("#out").text(str); };

Expand Down Expand Up @@ -43,8 +44,13 @@ function processGrammar () {
}
}

Jison.print = function () {};
parser = Jison.Generator(cfg, {type: type});
//Jison.print = function () {};
try {
parser = Jison.Generator(cfg, {type: type});
} catch(e) {
$("#gen_out").text("Oops. Error while parsing grammar.\n"+e).addClass('bad');
throw(e);
}

$("#out").removeClass("good").removeClass("bad").html('');
$("#gen_out").removeClass("good").removeClass("bad");
Expand Down
4 changes: 2 additions & 2 deletions assets/styles/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ textarea {
display: block;
width: 586px;
height: 200px;
background: url(/jison/assets/images/jison_x1.png) no-repeat;
background: url(../images/jison_x1.png) no-repeat;
outline-style: none;
margin: 0 auto; /* center the jison logo */
}
#header h1 a:active {
background: url(/jison/assets/images/jison_x1.png) no-repeat 2px 3px;
background: url(../images/jison_x1.png) no-repeat 2px 3px;
}

#header h2 {
Expand Down
45 changes: 45 additions & 0 deletions assets/styles/try.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,51 @@

a img { border: 0px; }


#content {
max-width: none;
}

#content > div {
max-width: 600px;
margin: 0 auto; /* center horizontally */
}


/* -- two column fluid layout */
div#try {
max-width: none;
}

#describe {
float: left;
width: 45%;
margin-left: 2%;
min-width: 20em;
}

#test {
float: left;
width: 46%;
margin-left: 2%;
min-width: 20em;
}

/*
clearing without extra <div>, it could be

#footer { clear: both; }

*/
div#try:after {
content: "";
display: table;
clear: both;
}

/* /- two column fluid layout */


#try textarea {
width: 100%;
}
Expand Down
12 changes: 6 additions & 6 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<title>Jison</title>
<link rel="stylesheet" href="/jison/assets/styles/style.css" type="text/css" media="screen" charset="utf-8" />
<link rel="stylesheet" href="assets/styles/style.css" type="text/css" media="screen" charset="utf-8" />
</head>
<body>

Expand All @@ -25,16 +25,16 @@
-->

<div id="header">
<h1><a href="/jison/">Jison</a></h1>
<h1><a href="">Jison</a></h1>
<h2>Your friendly JavaScript parser generator!</h2>
</div>

<div id="main">
<p><a href="/jison/about/">Hunh</a>?</p>
<p><a href="about/">Hunh</a>?</p>
<p>
Read the <a href="/jison/docs/">documentation</a>, see
some <a href="/jison/demos/">demos</a>, <a href="/jison/try/">try it</a> online, or
<a href="/jison/docs/#installation">install</a>!
Read the <a href="docs/">documentation</a>, see
some <a href="demos/">demos</a>, <a href="try/">try it</a> online, or
<a href="docs/#installation">install</a>!
</p>
</div>

Expand Down
87 changes: 47 additions & 40 deletions try/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<title>Jison / </title>
<link rel="stylesheet" href="/jison/assets/styles/style.css" type="text/css" media="screen" charset="utf-8" />
<link rel="stylesheet" href="../assets/styles/style.css" type="text/css" media="screen" charset="utf-8" />
</head>
<body>
<div id="header">
Expand All @@ -15,27 +15,31 @@ <h1><a href="/jison/">Jison</a></h1>
<li><a href="/jison/try/">try</a></li>
<li><a href="/jison/docs/#installation">install</a></li>
<li><a href="/jison/community/">community</a></li>
</ul>
</ul>

<div id="content">

<link href="../assets/styles/try.css" type="text/css" rel="stylesheet" media="screen" />

<link href="/jison/assets/styles/try.css" type="text/css" rel="stylesheet" media="screen" />
<div>
<h1>Try Jison Online</h1>
<p>Build, test, and download your parser from the web!</p>
</div>

<div id="try">
<h1>Try Jison Online</h1>
<p>Build, test, and download your parser from the web!</p>
<h2>Describe Your Language</h2>

<p>
Load an example:
<select id="examples">
<option value="calculator.jison" selected="true">Calculator</option>
<option value="lambdacalc.jison">Lambda Calculus</option>
<!--<option value="ansic.jison">ANSI C</option>-->
</select>
</p>

<textarea id="grammar" rows="20" cols="80">
<div id="describe">
<h2>Describe Your Language</h2>

<p>
Load an example:
<select id="examples">
<option value="calculator.jison" selected="true">Calculator</option>
<option value="lambdacalc.jison">Lambda Calculus</option>
<!--<option value="ansic.jison">ANSI C</option>-->
</select>
</p>

<textarea id="grammar" rows="20" cols="80">
/* description: Parses end executes mathematical expressions. */

/* lexical grammar */
Expand Down Expand Up @@ -97,43 +101,46 @@ <h2>Describe Your Language</h2>
{$$ = Math.PI;}
;
</textarea>
<p>
<button id="process_btn">Generate Parser</button>
<button id="download_btn" disabled>Download</button>
</p>
<pre id="gen_out"></pre>

<div id="nonterminals"></div>
<div id="productions"></div>
<div id="table"></div>


<div id="parsing">
<p>
<button id="process_btn">Generate Parser</button>
<button id="download_btn" disabled>Download</button>
</p>
<pre id="gen_out"></pre>

<div id="nonterminals"></div>
<div id="productions"></div>
<div id="table"></div>
</div>
<div id="test">
<h2>Test Your Parser</h2>
<textarea id="source" rows="8" cols="80">5*PI^2</textarea><br/>
<p>&nbsp;</p>
<textarea id="source" rows="10" cols="80">5*PI^2</textarea><br/>
<button id="parse_btn">Parse</button>
</div>
<pre id="out"></pre>
<pre id="out"></pre>

<div id="loading"></div>
</div>
<div id="loading"></div>
</div>
</div>

<div id="usf">
<h2>Suggestion</h2>
<p>You may also want to try <a href="usf/index.html">the Jison USF page</a> which includes logic to show the productions and state transition diagram. This can be very useful for debugging your grammar!</p>
</div>

<script src="/jison/assets/js/webtoolkit.js"></script>
<script src="/jison/assets/js/jquery.js"></script>
<script src="/jison/assets/js/json2.js"></script>
<script src="/jison/assets/js/es5.js"></script>
<script src="/jison/assets/js/jison.js"></script>
<script src="/jison/assets/js/try.js"></script>

<script src="../assets/js/webtoolkit.js"></script>
<script src="../assets/js/jquery.js"></script>
<script src="../assets/js/json2.js"></script>
<script src="../assets/js/es5.js"></script>
<script src="../assets/js/jison.js"></script>
<script src="../assets/js/try.js"></script>

</div>
<p id="footer">By <a href="http://zaa.ch">Zach Carter</a>, 2009-2013. MIT Licensed.</p>

<a href="http://github.com/zaach/jison"><img style="position: absolute; top: 0; right: 0; border: 0;" src="http://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub" /></a>

<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-3555129-4']);
Expand Down
23 changes: 12 additions & 11 deletions try/usf/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Jison, parse table visualation page</title>
<link href="/jison/assets/styles/usf.css" type="text/css" rel="stylesheet" media="screen" />
<link href="../../assets/styles/usf.css" type="text/css" rel="stylesheet" media="screen" />
</head>

<body>
<div id="container">
<h2>Jison</h2>
<p><a href="http://github.com/zaach/jison/">Jison</a> is a parser generator written in JavaScript. This page uses Jison to display an interactive parsing table based on the grammar and parsing algorithm chosen, which can be very helpful for debugging.</p>
<p> Special thanks to <a href="http://www.cse.usf.edu/~ligatti/">Dr. Ligatti</a> for suggesting and giving feedback on the interface.<br /> <a href="http://www.cse.usf.edu" id="usf_logo"><img src="/jison/assets/images/usflogo.png" alt="USF" /></a> </p>
<p> Special thanks to <a href="http://www.cse.usf.edu/~ligatti/">Dr. Ligatti</a> for suggesting and giving feedback on the interface.<br />
<a href="http://www.cse.usf.edu" id="usf_logo"><img src="../../assets/images/usflogo.png" alt="USF" /></a> </p>

<h2>Input</h2>

Expand All @@ -23,7 +24,7 @@ <h2>Input</h2>
<p>
Load an example:
<select id="examples">
<option value="basic.jison" selected="true">Basic</option>
<option value="basic.jison" selected="selected">Basic</option>
<option value="basic2.jison">Basic #2</option>
<option value="dism.jison">DISM</option>
<option value="dism_lr0.jison">DISM in LR(0)</option>
Expand Down Expand Up @@ -72,21 +73,21 @@ <h2>Parse a program</h2>
<textarea id="source" rows="8" cols="80"></textarea><br/>
<button id="parse_btn">Parse source</button>
<h3>Result</h3>
<textarea id="out" readonly="true" rows="5" cols="80"/></textarea>
<textarea id="out" readonly="readonly" rows="5" cols="80"></textarea>
</div>

<div id="loading"></div>

<p>
<small><i>Zach Carter ([email protected]) 2009</i><small>
<small><i>Zach Carter ([email protected]) 2009</i></small>
</p>

</div>

<script src="/jison/assets/js/jquery.js"></script>
<script src="/jison/assets/js/json2.js"></script>
<script src="/jison/assets/js/es5.js"></script>
<script src="/jison/assets/js/jison.js"></script>
<script src="/jison/assets/js/usf.js"></script>
<script src="../../assets/js/jquery.js"></script>
<script src="../../assets/js/json2.js"></script>
<script src="../../assets/js/es5.js"></script>
<script src="../../assets/js/jison.js"></script>
<script src="../../assets/js/usf.js"></script>
</body>
</head>
</html>