• 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>t018llstar</title>
6
7<!-- ANTLR includes -->
8<script type="text/javascript" src="../../lib/antlr3-all.js"></script>
9<script type="text/javascript" src="t018llstarLexer.js"></script>
10<script type="text/javascript" src="t018llstarParser.js"></script>
11
12
13<!-- JsUnit include -->
14<script type="text/javascript" src="../jsunit/app/jsUnitCore.js"></script>
15
16<!-- Test Code -->
17<script type="text/javascript">
18    TestParser = function() {
19        TestParser.superclass.constructor.apply(this, arguments);
20        this.reportedErrors = [];
21    };
22    org.antlr.lang.extend(TestParser, t018llstarParser, {
23        emitErrorMessage: function(msg) {
24            this.reportedErrors.push(msg);
25        }
26    });
27
28    function testValid() {
29        var xinput = [
30                "char c;",
31                "int x;",
32                "",
33                "void bar(int x);",
34                "",
35                "int foo(int y, char d) {",
36                "  int i;",
37                "  for (i=0; i<3; i=i+1) {",
38                "    x=3;",
39                "    y=5;",
40                "  }",
41                "}"
42            ].join("\n"),
43            xoutput = [
44                "bar is a declaration",
45                "foo is a definition"
46            ].join("\n");
47        var cstream = new org.antlr.runtime.ANTLRStringStream(xinput),
48            lexer = new t018llstarLexer(cstream),
49            tstream = new org.antlr.runtime.CommonTokenStream(lexer),
50            parser = new TestParser(tstream);
51
52        parser.program();
53        assertEquals(xoutput, parser.olog.join("\n"));
54    }
55</script>
56
57</head>
58<body>
59    <h1>t018llstar</h1>
60</body>
61</html>
62