-
Notifications
You must be signed in to change notification settings - Fork 1
/
parser.htm
74 lines (61 loc) · 1.57 KB
/
parser.htm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<html>
<head>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="viewport" content="width=device-width maximum-scale=1 initial-scale=1 user-scalable=no">
<title>Math expression parser</title>
<style>
body {
background-color: #ddd;
font-family: 'Helvetica Neue', HelveticaNeue, sans-serif;
text-shadow: white 0px 1px 1px;
}
pre {
text-shadow: none;
}
input {
width: 95%;
font-family: monospace;
font-size: 1.3em;
border: 1px solid #bbb;
border-radius: 0.5em;
padding: 0.2em 0.3em 0.2em 0.4em;
background-color: white;
}
table {
text-shadow: none;
background-color: #e6e6e6;
width: 70%;
margin-left: 20px;
border-collapse: collapse;
}
table td, table th {
padding: 0;
}
table td {
border: 1px solid #ccc;
padding: 3px;
}
.footer {
text-shadow: none;
font-size: 0.8em;
color: #888;
margin-top: 2em;
}
</style>
</head>
<body>
<p>Type a math expression:</p>
<p><input type="text" id="code" autocapitalize="off" spellcheck="false"
value="x = 6 + 7" onChange='parse()' onKeyDown='parse()'></input>
<p>Syntax tree:</p>
<pre id="syntax"></pre>
<p>Tokens:</p>
<div id="tokens"></div>
<p class="footer">Supported tested browsers: IE 7+, Firefox 4+,
Safari 5+, Chrome 9+, Opera 11+, Konqueror 4.6+.</p>
<script src="TapDigit.js" type="text/javascript" charset="utf-8"></script>
<script src="ParserTest.js" type="text/javascript" charset="utf-8"></script>
<script>parse();</script>
</body>
</html>