-
Notifications
You must be signed in to change notification settings - Fork 0
/
Index.html
64 lines (59 loc) · 2.08 KB
/
Index.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
<html>
<head>
<meta charset="utf-8">
<title>Index</title>
<script type="text/javascript" src="./Scripts/JSUtils.js"></script>
<script type="text/javascript" src="./Scripts/XMLUtils.js"></script>
<script type="text/javascript" src="./Scripts/AT_KRL_Editor.js"></script>
<script type="text/javascript" src="./Scripts/AT_KRL_Type.js"></script>
<script type="text/javascript" src="./Scripts/AT_KRL_Object.js"></script>
<script type="text/javascript" src="./Scripts/AT_KRL_Expressions.js"></script>
<script type="text/javascript" src="./Scripts/AT_KRL_Fact.js"></script>
<script type="text/javascript" src="./Scripts/AT_KRL_Rule.js"></script>
<script type="text/javascript" src="./Scripts/AT_KRL_Parser.js"></script>
</head>
<body>
<script type="text/javascript">
var e = new AT_KRL_Editor();
var p = new AT_KRL_Parser(e);
var div = document.createElement('div');
var textArea = document.createElement('textarea');
div.appendChild(textArea);
var button = document.createElement('button');
document.body.appendChild(div);
document.body.appendChild(button);
button.onclick = function () {
var text = document.getElementsByTagName('textarea')[0].value;
//try {
var declarations = p.getAllDeclarations(text);
for (var i = 0; i < declarations.length; i++) {
var KRL_Dec = p.parseDeclaration(declarations[i]);
console.log(KRL_Dec);
//console.log(KRL_Dec.getKRL());
}
p.editor.getKRL();
//} catch (e) {
//console.log(e.message);
//e.message;
//}
}
button.innerText = 'Parse';
var empty = document.createElement('button');
document.body.appendChild(empty);
empty.innerText = 'Empty';
empty.onclick = function () {
p.editor.types = [];
p.editor.objects = [];
p.editor.rules = [];
console.clear();
}
textArea.style.width = '100%';
textArea.style.height = (document.body.offsetHeight - button.offsetHeight - 10) + 'px';
textArea.style.resize = 'none';
window.onresize = function () {
textArea.style.width = '100%';
textArea.style.height = (document.body.offsetHeight - button.offsetHeight - 10) + 'px';
}
</script>
</body>
</html>