• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
3<head>
4<meta http-equiv="content-type" content="text/html;charset=utf-8" />
5<title>t013parser</title>
6
7<!-- ANTLR includes -->
8<script type="text/javascript" src="../../lib/antlr3-all.js"></script>
9<script type="text/javascript" src="t013parserLexer.js"></script>
10<script type="text/javascript" src="t013parserParser.js"></script>
11
12<!-- JsUnit include -->
13<script type="text/javascript" src="../jsunit/app/jsUnitCore.js"></script>
14
15<!-- Test Code -->
16<script type="text/javascript">
17    function testValid() {
18        var cstream = new org.antlr.runtime.ANTLRStringStream("foobar"),
19            lexer = new t013parserLexer(cstream),
20            tstream = new org.antlr.runtime.CommonTokenStream(lexer),
21            parser = new t013parserParser(tstream);
22
23        parser.document();
24        assertEquals(parser.reportedErrors.length, 0);
25        assertEquals(parser.identifiers.length, 1);
26    }
27
28    function testMalformedInput1() {
29        var cstream = new org.antlr.runtime.ANTLRStringStream(""),
30            lexer = new t013parserLexer(cstream),
31            tstream = new org.antlr.runtime.CommonTokenStream(lexer),
32            parser = new t013parserParser(tstream);
33
34        try {
35            parser.document();
36            fail("should have failed on empty input");
37        } catch(e) {
38        }
39    }
40</script>
41
42</head>
43<body>
44    <h1>t013parser</h1>
45</body>
46