• 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>t039labels</title>
6
7<!-- ANTLR includes -->
8<script type="text/javascript" src="../../lib/antlr3-all.js"></script>
9<script type="text/javascript" src="t039labelsLexer.js"></script>
10<script type="text/javascript" src="t039labelsParser.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    var TLexer = function() {
19        TLexer.superclass.constructor.apply(this, arguments);
20    };
21    org.antlr.lang.extend(TLexer, t039labelsLexer, {
22        recover: function(re) {
23            /* don't recover, just crash */
24            throw re;
25        }
26    });
27
28    var TParser = function() {
29        TParser.superclass.constructor.apply(this, arguments);
30    };
31    org.antlr.lang.extend(TParser, t039labelsParser, {
32        recover: function(re) {
33            /* don't recover, just crash */
34            throw re;
35        }
36    });
37
38
39    function testValid1() {
40        var cstream = new org.antlr.runtime.ANTLRStringStream('a, b, c, 1, 2 A FOOBAR GNU1 A BLARZ'),
41            lexer = new TLexer(cstream),
42            tstream = new org.antlr.runtime.CommonTokenStream(lexer),
43            parser = new TParser(tstream);
44
45        var ret = parser.a(),
46            ids = ret[0],
47            w = ret[1];
48
49        var i, a=[];
50        for (i=0; i<ids.length; i++) {
51            a.push(ids[i].getText());
52        }
53        assertArrayEquals(["a", "b", "c", "1", "2", "A"], a);
54        assertEquals(w.getText(), "GNU1");
55    }
56</script>
57
58</head>
59<body>
60    <h1>t039labels</h1>
61</body>
62</html>
63