-
Notifications
You must be signed in to change notification settings - Fork 5
/
demo.html
114 lines (92 loc) · 3.17 KB
/
demo.html
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<!Doctype HTML>
<html>
<head>
<meta charset="UTF-8">
<style>
#error {
font-weight: bold;
color: red;
}
#solution {
margin: 10px;
background-color: oldlace;
}
#solutionLexerTokens {
margin: 10px;
background-color: lightgoldenrodyellow;
}
#solutionParserTokens {
margin: 10px;
background-color: powderblue;
}
#inputLexerTokens {
margin: 10px;
background-color: lightpink;
}
#inputParserTokens {
margin: 10px;
background-color: palegreen;
}
#modifiedInput {
margin: 10px;
background-color: bisque;
}
#output, #isBalanced{
font-size: 14px;
}
</style>
<script src='lib/require.js'></script>
<!-- Added by Lyn. Needed to load ForgivingTokensVisitor.js -->
<script type="text/javascript">
inBrowser = true; // Flag that tells following JavaScript to run browser-specific code.
</script>
<!-- /* code for CodeMirror editor */ -->
<link rel=stylesheet href="codemirror-5.49.2/doc/docs.css">
<link rel="stylesheet" href="codemirror-5.49.2/lib/codemirror.css">
<script src="codemirror-5.49.2/lib/codemirror.js"></script>
<script src="codemirror-5.49.2/addon/edit/closebrackets.js"></script>
<script src="codemirror-5.49.2/addon/edit/matchbracketsvenbrace.js"></script>
<script src="codemirror-5.49.2/mode/venbrace/venbrace.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<style>
.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black; font-size: 14px;}
.highlighted-scope { background-color: #e0e0e0; }
</style>
</head>
<body>
<img src="demo.png" style="padding:5px"></img>
<br>
<b>Expected Solution (abbreviated):</b><br>
<textarea id="solution" name="solution" rows="5" cols="70">
(10 + (absolute (64 - 70)))
</textarea>
<textarea id="input" name="input" rows="10" cols="100" style="padding:10px"></textarea>
<br>
<button id="submit" onClick="parse();">Translate!</button>
<pre id="isBalanced" style="color:orange">Paren balance indicator here...</pre>
<pre id="error" style="display:none">Error will go here....</pre>
<pre id="output">Output will go here....</pre>
<br>
<!-- (max ((6)*(4)) (57) (()/(3))) -->
<br><b>Solution tokens from lexer before parsing:</b><br>
<textarea id="solutionLexerTokens" name="solutionLexerTokens" rows="10" cols="65">
</textarea>
<br><b>Solution tokens from lexer after parsing:</b><br>
<textarea id="solutionParserTokens" name="solutionParserTokens" rows="10" cols="65">
</textarea>
<br><b>Input raw tokens from lexer before parsing:</b><br>
<textarea id="inputLexerTokens" name="inputLexerTokens" rows="10" cols="65">
</textarea>
<br><b>Input tokens from lexer after parsing:</b><br>
<textarea id="inputParserTokens" name="inputParserParserTokens" rows="10" cols="65">
</textarea>
<br><b>Modifed input consistent with tokens after parsing parsing:</b><br>
<textarea id="modifiedInput" name="modifiedInput" rows="8" cols="60">
</textarea>
<!-- <p id="solution" style="display:none">
(max ((6)*(4)) (57) (()/(3)))
</p> -->
<!-- <p id="solution" style="display:none">((3) + (4))</p> -->
</body>
<script src="demo.js"></script>
</html>