xref: /aosp_15_r20/external/antlr/runtime/JavaScript/tests/functional/t026actions.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>t026actions</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="t026actionsLexer.js"></script>
10*16467b97STreehugger Robot<script type="text/javascript" src="t026actionsParser.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    function testValid1() {
19*16467b97STreehugger Robot        var stream = new org.antlr.runtime.ANTLRStringStream("foobar _Ab98 \n A12sdf"),
20*16467b97STreehugger Robot            lexer = new t026actionsLexer(stream),
21*16467b97STreehugger Robot            tstream = new org.antlr.runtime.CommonTokenStream(lexer),
22*16467b97STreehugger Robot            parser = new t026actionsParser(tstream),
23*16467b97STreehugger Robot            token;
24*16467b97STreehugger Robot
25*16467b97STreehugger Robot        parser.emitErrorMessage = function() {};
26*16467b97STreehugger Robot        parser.prog();
27*16467b97STreehugger Robot        assertArrayEquals(parser.xlog, ["init;", "after;", "finally;"]);
28*16467b97STreehugger Robot        assertArrayEquals(lexer.xlog, ["action;", "foobar 4 1 0 -1 0 0 5", "attribute;", "action;", "_Ab98 4 1 7 -1 0 7 11", "attribute;", "action;", "A12sdf 4 2 1 -1 0 15 20", "attribute;"]);
29*16467b97STreehugger Robot    }
30*16467b97STreehugger Robot</script>
31*16467b97STreehugger Robot
32*16467b97STreehugger Robot</head>
33*16467b97STreehugger Robot<body>
34*16467b97STreehugger Robot    <h1>t026actions</h1>
35*16467b97STreehugger Robot</body>
36*16467b97STreehugger Robot</html>
37