Acronym has changed
[cql-js-moved-to-github.git] / index.html
1 <html>
2   <head>
3     <script type="text/javascript" src="cql.js"></script>
4     <script type="text/javascript">
5         var cp = new CQLParser();
6         
7         function parseInput(query) {
8             try {
9                 cp.parse(query);
10                 document.getElementById("output").value = cp.toXCQL();
11                 document.getElementById("output2").value = cp.toString();;
12                 //re-parse fq to see the o/i matches
13                 var fq = cp.toFQ();
14                 document.getElementById("output3").value = fq;
15                 cp.parseFromFQ(fq);
16                 document.getElementById("output4").value = cp.toString();
17             } catch (e) {
18                 document.getElementById("output").value = e.message;
19                 document.getElementById("output2").value = e.message;
20                 throw e;
21             }
22         }
23     </script>
24     <title>CQL parser</title>
25   </head>
26   <body>
27     <div>
28       <form name="test" onsubmit="parseInput(this.q.value); return false;">
29         Query: 
30         <input type="text" name="q" size="160" onkeyup="parseInput(this.value); return false;"></input>
31         <br>
32         <br>
33         XCQL:
34         <br>
35       </form>
36       <textarea id="output" rows="80" cols="80"></textarea>
37       <textarea id="output2" rows="80" cols="80"></textarea>
38       <textarea id="output3" rows="80" cols="80"></textarea>
39       <textarea id="output4" rows="80" cols="80"></textarea>
40     </div>
41   </body>
42 </html>