/usr/share/gtk-doc/html/ctpl/ctpl-CtplLexer.html is in libctpl-doc 0.3.3.dfsg-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 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>CtplLexer</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
<link rel="home" href="index.html" title="CTPL Reference Manual">
<link rel="up" href="ch02.html" title="API reference">
<link rel="prev" href="ctpl-CtplToken.html" title="CtplToken">
<link rel="next" href="ctpl-CtplLexerExpr.html" title="CtplLexerExpr">
<meta name="generator" content="GTK-Doc V1.17 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="ctpl-CtplToken.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="ch02.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">CTPL Reference Manual</th>
<td><a accesskey="n" href="ctpl-CtplLexerExpr.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#ctpl-CtplLexer.synopsis" class="shortcut">Top</a>
|
<a href="#ctpl-CtplLexer.description" class="shortcut">Description</a>
</td></tr>
</table>
<div class="refentry">
<a name="ctpl-CtplLexer"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="ctpl-CtplLexer.top_of_page"></a>CtplLexer</span></h2>
<p>CtplLexer — Syntax analyser</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<a name="ctpl-CtplLexer.synopsis"></a><h2>Synopsis</h2>
<pre class="synopsis">
#include <ctpl/ctpl.h>
#define <a class="link" href="ctpl-CtplLexer.html#CTPL-LEXER-ERROR:CAPS" title="CTPL_LEXER_ERROR">CTPL_LEXER_ERROR</a>
enum <a class="link" href="ctpl-CtplLexer.html#CtplLexerError" title="enum CtplLexerError">CtplLexerError</a>;
<a class="link" href="ctpl-CtplToken.html#CtplToken" title="CtplToken"><span class="returnvalue">CtplToken</span></a> * <a class="link" href="ctpl-CtplLexer.html#ctpl-lexer-lex" title="ctpl_lexer_lex ()">ctpl_lexer_lex</a> (<em class="parameter"><code><a class="link" href="ctpl-CtplInputStream.html#CtplInputStream" title="CtplInputStream"><span class="type">CtplInputStream</span></a> *stream</code></em>,
<em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
<a class="link" href="ctpl-CtplToken.html#CtplToken" title="CtplToken"><span class="returnvalue">CtplToken</span></a> * <a class="link" href="ctpl-CtplLexer.html#ctpl-lexer-lex-string" title="ctpl_lexer_lex_string ()">ctpl_lexer_lex_string</a> (<em class="parameter"><code>const <a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *template</code></em>,
<em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
<a class="link" href="ctpl-CtplToken.html#CtplToken" title="CtplToken"><span class="returnvalue">CtplToken</span></a> * <a class="link" href="ctpl-CtplLexer.html#ctpl-lexer-lex-path" title="ctpl_lexer_lex_path ()">ctpl_lexer_lex_path</a> (<em class="parameter"><code>const <a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *path</code></em>,
<em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
</pre>
</div>
<div class="refsect1">
<a name="ctpl-CtplLexer.description"></a><h2>Description</h2>
<p>
Syntax analyser creating a <a class="link" href="ctpl-CtplToken.html" title="CtplToken">token tree</a>
from an input data in the CTPL language.
</p>
<p>
To analyse some data, use <a class="link" href="ctpl-CtplLexer.html#ctpl-lexer-lex" title="ctpl_lexer_lex ()"><code class="function">ctpl_lexer_lex()</code></a>, <a class="link" href="ctpl-CtplLexer.html#ctpl-lexer-lex-string" title="ctpl_lexer_lex_string ()"><code class="function">ctpl_lexer_lex_string()</code></a> or
<a class="link" href="ctpl-CtplLexer.html#ctpl-lexer-lex-path" title="ctpl_lexer_lex_path ()"><code class="function">ctpl_lexer_lex_path()</code></a>; to destroy the created token tree, use
<a class="link" href="ctpl-CtplToken.html#ctpl-token-free" title="ctpl_token_free ()"><code class="function">ctpl_token_free()</code></a>.
</p>
<p>
</p>
<div class="example">
<a name="idp6411296"></a><p class="title"><b>Example 11. Usage of the lexer and error management</b></p>
<div class="example-contents">
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7
8
9
10
11
12</pre></td>
<td class="listing_code"><pre class="programlisting">CtplToken <span class="gtkdoc opt">*</span>tree<span class="gtkdoc opt">;</span>
GError <span class="gtkdoc opt">*</span>error <span class="gtkdoc opt">=</span> NULL<span class="gtkdoc opt">;</span>
tree <span class="gtkdoc opt">=</span> <span class="function"><a href="ctpl-CtplLexer.html#ctpl-lexer-lex">ctpl_lexer_lex</a></span> <span class="gtkdoc opt">(</span>input<span class="gtkdoc opt">, &</span>error<span class="gtkdoc opt">);</span>
<span class="keyword">if</span> <span class="gtkdoc opt">(</span>tree <span class="gtkdoc opt">==</span> NULL<span class="gtkdoc opt">) {</span>
<span class="function">fprintf</span> <span class="gtkdoc opt">(</span>stderr<span class="gtkdoc opt">,</span> <span class="string">"Failed to analyse input data: %s</span><span class="gtkdoc esc">\n</span><span class="string">"</span><span class="gtkdoc opt">,</span> error<span class="gtkdoc opt">-></span>message<span class="gtkdoc opt">);</span>
<span class="function"><a href="/usr/share/gtk-doc/html/glib/glib-Error-Reporting.html#g-clear-error">g_clear_error</a></span> <span class="gtkdoc opt">(&</span>error<span class="gtkdoc opt">);</span>
<span class="gtkdoc opt">}</span> <span class="keyword">else</span> <span class="gtkdoc opt">{</span>
<span class="comment">/* do what you want with the tree here */</span>
<span class="function"><a href="ctpl-CtplToken.html#ctpl-token-free">ctpl_token_free</a></span> <span class="gtkdoc opt">(</span>tree<span class="gtkdoc opt">);</span>
<span class="gtkdoc opt">}</span></pre></td>
</tr>
</tbody>
</table>
</div>
</div>
<p><br class="example-break">
</p>
</div>
<div class="refsect1">
<a name="ctpl-CtplLexer.details"></a><h2>Details</h2>
<div class="refsect2">
<a name="CTPL-LEXER-ERROR:CAPS"></a><h3>CTPL_LEXER_ERROR</h3>
<pre class="programlisting">#define CTPL_LEXER_ERROR (ctpl_lexer_error_quark ())
</pre>
<p>
Domain of CtplLexer errors.
</p>
</div>
<hr>
<div class="refsect2">
<a name="CtplLexerError"></a><h3>enum CtplLexerError</h3>
<pre class="programlisting">typedef enum _CtplLexerError
{
CTPL_LEXER_ERROR_SYNTAX_ERROR,
CTPL_LEXER_ERROR_FAILED
} CtplLexerError;
</pre>
<p>
Error codes that lexing functions can throw, from the <a class="link" href="ctpl-CtplLexer.html#CTPL-LEXER-ERROR:CAPS" title="CTPL_LEXER_ERROR"><code class="literal">CTPL_LEXER_ERROR</code></a>
domain.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><a name="CTPL-LEXER-ERROR-SYNTAX-ERROR:CAPS"></a><span class="term"><code class="literal">CTPL_LEXER_ERROR_SYNTAX_ERROR</code></span></p></td>
<td>The input data contains invalid syntax
</td>
</tr>
<tr>
<td><p><a name="CTPL-LEXER-ERROR-FAILED:CAPS"></a><span class="term"><code class="literal">CTPL_LEXER_ERROR_FAILED</code></span></p></td>
<td>An error occurred without any precision on what
failed.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="ctpl-lexer-lex"></a><h3>ctpl_lexer_lex ()</h3>
<pre class="programlisting"><a class="link" href="ctpl-CtplToken.html#CtplToken" title="CtplToken"><span class="returnvalue">CtplToken</span></a> * ctpl_lexer_lex (<em class="parameter"><code><a class="link" href="ctpl-CtplInputStream.html#CtplInputStream" title="CtplInputStream"><span class="type">CtplInputStream</span></a> *stream</code></em>,
<em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>
Analyses some given data and tries to create a tree of tokens representing
it.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>stream</code></em> :</span></p></td>
<td>A <a class="link" href="ctpl-CtplInputStream.html#CtplInputStream" title="CtplInputStream"><span class="type">CtplInputStream</span></a> holding the data to analyse</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
<td>A <a href="/usr/share/gtk-doc/html/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> return location for error reporting, or <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore
errors.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>A new <a class="link" href="ctpl-CtplToken.html#CtplToken" title="CtplToken"><span class="type">CtplToken</span></a> tree holding all read tokens or <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> on error.
The new tree should be freed with <a class="link" href="ctpl-CtplToken.html#ctpl-token-free" title="ctpl_token_free ()"><code class="function">ctpl_token_free()</code></a> when no longer
needed.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="ctpl-lexer-lex-string"></a><h3>ctpl_lexer_lex_string ()</h3>
<pre class="programlisting"><a class="link" href="ctpl-CtplToken.html#CtplToken" title="CtplToken"><span class="returnvalue">CtplToken</span></a> * ctpl_lexer_lex_string (<em class="parameter"><code>const <a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *template</code></em>,
<em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>
Convenient function to lex a template from a string.
See <a class="link" href="ctpl-CtplLexer.html#ctpl-lexer-lex" title="ctpl_lexer_lex ()"><code class="function">ctpl_lexer_lex()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>template</code></em> :</span></p></td>
<td>A string containing the template data</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
<td>Return location for errors, or <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore them.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>A new <a class="link" href="ctpl-CtplToken.html#CtplToken" title="CtplToken"><span class="type">CtplToken</span></a> tree or <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> on error.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="ctpl-lexer-lex-path"></a><h3>ctpl_lexer_lex_path ()</h3>
<pre class="programlisting"><a class="link" href="ctpl-CtplToken.html#CtplToken" title="CtplToken"><span class="returnvalue">CtplToken</span></a> * ctpl_lexer_lex_path (<em class="parameter"><code>const <a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *path</code></em>,
<em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>
Convenient function to lex a template from a file.
See <a class="link" href="ctpl-CtplLexer.html#ctpl-lexer-lex" title="ctpl_lexer_lex ()"><code class="function">ctpl_lexer_lex()</code></a>.
</p>
<p>
Errors can come from the <a href="/usr/share/gtk-doc/html/gio/gio-GIOError.html#G-IO-ERROR:CAPS"><code class="literal">G_IO_ERROR</code></a> domain if the file loading fails, or
from the <a class="link" href="ctpl-CtplLexer.html#CTPL-LEXER-ERROR:CAPS" title="CTPL_LEXER_ERROR"><code class="literal">CTPL_LEXER_ERROR</code></a> domain if the lexing fails.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>path</code></em> :</span></p></td>
<td>The path of the file from which read the template, in the GLib's
filename encoding</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
<td>Return location for errors, or <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore them</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>A new <a class="link" href="ctpl-CtplToken.html#CtplToken" title="CtplToken"><span class="type">CtplToken</span></a> tree or <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> on error.</td>
</tr>
</tbody>
</table></div>
</div>
</div>
</div>
<div class="footer">
<hr>
Generated by GTK-Doc V1.17</div>
</body>
</html>
|