/usr/share/doc/bison-doc/html/Java-Parser-Interface.html is in bison-doc 1:3.0.4-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!--
This manual (22 January 2015) is for GNU Bison (version
3.0.4), the GNU parser generator.
Copyright (C) 1988-1993, 1995, 1998-2015 Free Software
Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License,
Version 1.3 or any later version published by the Free Software
Foundation; with no Invariant Sections, with the Front-Cover texts
being "A GNU Manual," and with the Back-Cover Texts as in
(a) below. A copy of the license is included in the section entitled
"GNU Free Documentation License."
(a) The FSF's Back-Cover Text is: "You have the freedom to copy and
modify this GNU manual. Buying copies from the FSF
supports it in developing GNU and promoting software
freedom." -->
<!-- Created by GNU Texinfo 6.0, http://www.gnu.org/software/texinfo/ -->
<head>
<title>Bison 3.0.4: Java Parser Interface</title>
<meta name="description" content="Bison 3.0.4: Java Parser Interface">
<meta name="keywords" content="Bison 3.0.4: Java Parser Interface">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Index-of-Terms.html#Index-of-Terms" rel="index" title="Index of Terms">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Java-Parsers.html#Java-Parsers" rel="up" title="Java Parsers">
<link href="Java-Scanner-Interface.html#Java-Scanner-Interface" rel="next" title="Java Scanner Interface">
<link href="Java-Location-Values.html#Java-Location-Values" rel="prev" title="Java Location Values">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nocodebreak {white-space: nowrap}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: serif; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en">
<a name="Java-Parser-Interface"></a>
<div class="header">
<p>
Next: <a href="Java-Scanner-Interface.html#Java-Scanner-Interface" accesskey="n" rel="next">Java Scanner Interface</a>, Previous: <a href="Java-Location-Values.html#Java-Location-Values" accesskey="p" rel="prev">Java Location Values</a>, Up: <a href="Java-Parsers.html#Java-Parsers" accesskey="u" rel="up">Java Parsers</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Index-of-Terms.html#Index-of-Terms" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="Java-Parser-Interface-1"></a>
<h4 class="subsection">10.2.4 Java Parser Interface</h4>
<p>The name of the generated parser class defaults to <code>YYParser</code>. The
<code>YY</code> prefix may be changed using the <code>%name-prefix</code> directive
or the <samp>-p</samp>/<samp>--name-prefix</samp> option. Alternatively, use
‘<samp>%define parser_class_name {<var>name</var>}</samp>’ to give a custom name to
the class. The interface of this class is detailed below.
</p>
<p>By default, the parser class has package visibility. A declaration
‘<samp>%define public</samp>’ will change to public visibility. Remember that,
according to the Java language specification, the name of the <samp>.java</samp>
file should match the name of the class in this case. Similarly, you can
use <code>abstract</code>, <code>final</code> and <code>strictfp</code> with the
<code>%define</code> declaration to add other modifiers to the parser class.
A single ‘<samp>%define annotations {<var>annotations</var>}</samp>’ directive can
be used to add any number of annotations to the parser class.
</p>
<p>The Java package name of the parser class can be specified using the
‘<samp>%define package</samp>’ directive. The superclass and the implemented
interfaces of the parser class can be specified with the <code>%define
extends</code> and ‘<samp>%define implements</samp>’ directives.
</p>
<p>The parser class defines an inner class, <code>Location</code>, that is used
for location tracking (see <a href="Java-Location-Values.html#Java-Location-Values">Java Location Values</a>), and a inner
interface, <code>Lexer</code> (see <a href="Java-Scanner-Interface.html#Java-Scanner-Interface">Java Scanner Interface</a>). Other than
these inner class/interface, and the members described in the interface
below, all the other members and fields are preceded with a <code>yy</code> or
<code>YY</code> prefix to avoid clashes with user code.
</p>
<p>The parser class can be extended using the <code>%parse-param</code>
directive. Each occurrence of the directive will add a <code>protected
final</code> field to the parser class, and an argument to its constructor,
which initialize them automatically.
</p>
<dl>
<dt><a name="index-YYParser-on-YYParser"></a>Constructor on YYParser: <em></em> <strong>YYParser</strong> <em>(<var>lex_param</var>, …, <var>parse_param</var>, …)</em></dt>
<dd><p>Build a new parser object with embedded <code>%code lexer</code>. There are
no parameters, unless <code>%param</code>s and/or <code>%parse-param</code>s and/or
<code>%lex-param</code>s are used.
</p>
<p>Use <code>%code init</code> for code added to the start of the constructor
body. This is especially useful to initialize superclasses. Use
‘<samp>%define init_throws</samp>’ to specify any uncaught exceptions.
</p></dd></dl>
<dl>
<dt><a name="index-YYParser-on-YYParser-1"></a>Constructor on YYParser: <em></em> <strong>YYParser</strong> <em>(Lexer <var>lexer</var>, <var>parse_param</var>, …)</em></dt>
<dd><p>Build a new parser object using the specified scanner. There are no
additional parameters unless <code>%param</code>s and/or <code>%parse-param</code>s are
used.
</p>
<p>If the scanner is defined by <code>%code lexer</code>, this constructor is
declared <code>protected</code> and is called automatically with a scanner
created with the correct <code>%param</code>s and/or <code>%lex-param</code>s.
</p>
<p>Use <code>%code init</code> for code added to the start of the constructor
body. This is especially useful to initialize superclasses. Use
‘<samp>%define init_throws</samp>’ to specify any uncaught exceptions.
</p></dd></dl>
<dl>
<dt><a name="index-parse-on-YYParser"></a>Method on YYParser: <em>boolean</em> <strong>parse</strong> <em>()</em></dt>
<dd><p>Run the syntactic analysis, and return <code>true</code> on success,
<code>false</code> otherwise.
</p></dd></dl>
<dl>
<dt><a name="index-getErrorVerbose-on-YYParser"></a>Method on YYParser: <em>boolean</em> <strong>getErrorVerbose</strong> <em>()</em></dt>
<dt><a name="index-setErrorVerbose-on-YYParser"></a>Method on YYParser: <em>void</em> <strong>setErrorVerbose</strong> <em>(boolean <var>verbose</var>)</em></dt>
<dd><p>Get or set the option to produce verbose error messages. These are only
available with ‘<samp>%define parse.error verbose</samp>’, which also turns on
verbose error messages.
</p></dd></dl>
<dl>
<dt><a name="index-yyerror-on-YYParser"></a>Method on YYParser: <em>void</em> <strong>yyerror</strong> <em>(String <var>msg</var>)</em></dt>
<dt><a name="index-yyerror-on-YYParser-1"></a>Method on YYParser: <em>void</em> <strong>yyerror</strong> <em>(Position <var>pos</var>, String <var>msg</var>)</em></dt>
<dt><a name="index-yyerror-on-YYParser-2"></a>Method on YYParser: <em>void</em> <strong>yyerror</strong> <em>(Location <var>loc</var>, String <var>msg</var>)</em></dt>
<dd><p>Print an error message using the <code>yyerror</code> method of the scanner
instance in use. The <code>Location</code> and <code>Position</code> parameters are
available only if location tracking is active.
</p></dd></dl>
<dl>
<dt><a name="index-recovering-on-YYParser"></a>Method on YYParser: <em>boolean</em> <strong>recovering</strong> <em>()</em></dt>
<dd><p>During the syntactic analysis, return <code>true</code> if recovering
from a syntax error.
See <a href="Error-Recovery.html#Error-Recovery">Error Recovery</a>.
</p></dd></dl>
<dl>
<dt><a name="index-getDebugStream-on-YYParser"></a>Method on YYParser: <em>java.io.PrintStream</em> <strong>getDebugStream</strong> <em>()</em></dt>
<dt><a name="index-setDebugStream-on-YYParser"></a>Method on YYParser: <em>void</em> <strong>setDebugStream</strong> <em>(java.io.printStream <var>o</var>)</em></dt>
<dd><p>Get or set the stream used for tracing the parsing. It defaults to
<code>System.err</code>.
</p></dd></dl>
<dl>
<dt><a name="index-getDebugLevel-on-YYParser"></a>Method on YYParser: <em>int</em> <strong>getDebugLevel</strong> <em>()</em></dt>
<dt><a name="index-setDebugLevel-on-YYParser"></a>Method on YYParser: <em>void</em> <strong>setDebugLevel</strong> <em>(int <var>l</var>)</em></dt>
<dd><p>Get or set the tracing level. Currently its value is either 0, no trace,
or nonzero, full tracing.
</p></dd></dl>
<dl>
<dt><a name="index-bisonVersion-of-YYParser"></a>Constant of YYParser: <em>String</em> <strong>bisonVersion</strong></dt>
<dt><a name="index-bisonSkeleton-of-YYParser"></a>Constant of YYParser: <em>String</em> <strong>bisonSkeleton</strong></dt>
<dd><p>Identify the Bison version and skeleton used to generate this parser.
</p></dd></dl>
<hr>
<div class="header">
<p>
Next: <a href="Java-Scanner-Interface.html#Java-Scanner-Interface" accesskey="n" rel="next">Java Scanner Interface</a>, Previous: <a href="Java-Location-Values.html#Java-Location-Values" accesskey="p" rel="prev">Java Location Values</a>, Up: <a href="Java-Parsers.html#Java-Parsers" accesskey="u" rel="up">Java Parsers</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Index-of-Terms.html#Index-of-Terms" title="Index" rel="index">Index</a>]</p>
</div>
</body>
</html>
|