xref: /aosp_15_r20/external/antlr/runtime/JavaScript/tests/functional/t035ruleLabelPropertyRef.html (revision 16467b971bd3e2009fad32dd79016f2c7e421deb)
1*16467b97STreehugger Robot<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2*16467b97STreehugger Robot<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
3*16467b97STreehugger Robot<head>
4*16467b97STreehugger Robot<meta http-equiv="content-type" content="text/html;charset=utf-8" />
5*16467b97STreehugger Robot<title>t035ruleLabelPropertyRef</title>
6*16467b97STreehugger Robot
7*16467b97STreehugger Robot<!-- ANTLR includes -->
8*16467b97STreehugger Robot<script type="text/javascript" src="../../lib/antlr3-all.js"></script>
9*16467b97STreehugger Robot<script type="text/javascript" src="t035ruleLabelPropertyRefLexer.js"></script>
10*16467b97STreehugger Robot<script type="text/javascript" src="t035ruleLabelPropertyRefParser.js"></script>
11*16467b97STreehugger Robot
12*16467b97STreehugger Robot
13*16467b97STreehugger Robot<!-- JsUnit include -->
14*16467b97STreehugger Robot<script type="text/javascript" src="../jsunit/app/jsUnitCore.js"></script>
15*16467b97STreehugger Robot
16*16467b97STreehugger Robot<!-- Test Code -->
17*16467b97STreehugger Robot<script type="text/javascript">
18*16467b97STreehugger Robot    var TLexer = function() {
19*16467b97STreehugger Robot        TLexer.superclass.constructor.apply(this, arguments);
20*16467b97STreehugger Robot    };
21*16467b97STreehugger Robot    org.antlr.lang.extend(TLexer, t035ruleLabelPropertyRefLexer, {
22*16467b97STreehugger Robot        recover: function(re) {
23*16467b97STreehugger Robot            /* don't recover, just crash */
24*16467b97STreehugger Robot            throw re;
25*16467b97STreehugger Robot        }
26*16467b97STreehugger Robot    });
27*16467b97STreehugger Robot
28*16467b97STreehugger Robot    var TParser = function() {
29*16467b97STreehugger Robot        TParser.superclass.constructor.apply(this, arguments);
30*16467b97STreehugger Robot    };
31*16467b97STreehugger Robot    org.antlr.lang.extend(TParser, t035ruleLabelPropertyRefParser, {
32*16467b97STreehugger Robot        recover: function(re) {
33*16467b97STreehugger Robot            /* don't recover, just crash */
34*16467b97STreehugger Robot            throw re;
35*16467b97STreehugger Robot        }
36*16467b97STreehugger Robot    });
37*16467b97STreehugger Robot
38*16467b97STreehugger Robot
39*16467b97STreehugger Robot    function testValid1() {
40*16467b97STreehugger Robot        var cstream = new org.antlr.runtime.ANTLRStringStream("   a a a a  "),
41*16467b97STreehugger Robot            lexer = new TLexer(cstream),
42*16467b97STreehugger Robot            tstream = new org.antlr.runtime.CommonTokenStream(lexer),
43*16467b97STreehugger Robot            parser = new TParser(tstream);
44*16467b97STreehugger Robot
45*16467b97STreehugger Robot        var a = parser.a(),
46*16467b97STreehugger Robot            start = a[0],
47*16467b97STreehugger Robot            stop = a[1],
48*16467b97STreehugger Robot            text = a[2];
49*16467b97STreehugger Robot
50*16467b97STreehugger Robot        assertEquals(start.index, 1);
51*16467b97STreehugger Robot        assertEquals(stop.index, 7);
52*16467b97STreehugger Robot        assertEquals(text, "a a a a");
53*16467b97STreehugger Robot    }
54*16467b97STreehugger Robot</script>
55*16467b97STreehugger Robot
56*16467b97STreehugger Robot</head>
57*16467b97STreehugger Robot<body>
58*16467b97STreehugger Robot    <h1>t035ruleLabelPropertyRef</h1>
59*16467b97STreehugger Robot</body>
60*16467b97STreehugger Robot</html>
61