📄 glib-lexical-scanner.html
字号:
<a name="id3031446"></a><h3><a name="g-scanner-thaw-symbol-table"></a>g_scanner_thaw_symbol_table()</h3><a class="indexterm" name="id3031458"></a><pre class="programlisting">#define g_scanner_thaw_symbol_table(scanner)</pre><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p><code class="literal">g_scanner_thaw_symbol_table</code> is deprecated and should not be used in newly-written code.</p></div><p>This function is deprecated and will be removed in the next majorrelease of GLib. It does nothing.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>scanner</code></em> :</span></td><td>a <a href="glib-Lexical-Scanner.html#GScanner"><span class="type">GScanner</span></a>.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3031513"></a><h3><a name="g-scanner-lookup-symbol"></a>g_scanner_lookup_symbol ()</h3><a class="indexterm" name="id3031524"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gpointer">gpointer</a> g_scanner_lookup_symbol (<a href="glib-Lexical-Scanner.html#GScanner">GScanner</a> *scanner, const <a href="glib-Basic-Types.html#gchar">gchar</a> *symbol);</pre><p>Looks up a symbol in the current scope and return its value. If thesymbol is not bound in the current scope, <code class="literal">NULL</code> is returned.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>scanner</code></em> :</span></td><td>a <a href="glib-Lexical-Scanner.html#GScanner"><span class="type">GScanner</span></a>.</td></tr><tr><td><span class="term"><em class="parameter"><code>symbol</code></em> :</span></td><td>the symbol to look up.</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>the value of <em class="parameter"><code>symbol</code></em> in the current scope, or <code class="literal">NULL</code>if <em class="parameter"><code>symbol</code></em> is not bound in the current scope.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3031637"></a><h3><a name="g-scanner-warn"></a>g_scanner_warn ()</h3><a class="indexterm" name="id3031648"></a><pre class="programlisting">void g_scanner_warn (<a href="glib-Lexical-Scanner.html#GScanner">GScanner</a> *scanner, const <a href="glib-Basic-Types.html#gchar">gchar</a> *format, ...);</pre><p>Outputs a warning message, via the <a href="glib-Lexical-Scanner.html#GScanner"><span class="type">GScanner</span></a> message handler.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>scanner</code></em> :</span></td><td>a <a href="glib-Lexical-Scanner.html#GScanner"><span class="type">GScanner</span></a>.</td></tr><tr><td><span class="term"><em class="parameter"><code>format</code></em> :</span></td><td>the message format. See the <code class="function"><code class="function">printf()</code></code>documentation.</td></tr><tr><td><span class="term"><em class="parameter"><code>...</code></em> :</span></td><td>the parameters to insert into the format string.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3031764"></a><h3><a name="g-scanner-error"></a>g_scanner_error ()</h3><a class="indexterm" name="id3031775"></a><pre class="programlisting">void g_scanner_error (<a href="glib-Lexical-Scanner.html#GScanner">GScanner</a> *scanner, const <a href="glib-Basic-Types.html#gchar">gchar</a> *format, ...);</pre><p>Outputs an error message, via the <a href="glib-Lexical-Scanner.html#GScanner"><span class="type">GScanner</span></a> message handler.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>scanner</code></em> :</span></td><td>a <a href="glib-Lexical-Scanner.html#GScanner"><span class="type">GScanner</span></a>.</td></tr><tr><td><span class="term"><em class="parameter"><code>format</code></em> :</span></td><td>the message format. See the <code class="function"><code class="function">printf()</code></code>documentation.</td></tr><tr><td><span class="term"><em class="parameter"><code>...</code></em> :</span></td><td>the parameters to insert into the format string.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3031887"></a><h3><a name="g-scanner-unexp-token"></a>g_scanner_unexp_token ()</h3><a class="indexterm" name="id3031898"></a><pre class="programlisting">void g_scanner_unexp_token (<a href="glib-Lexical-Scanner.html#GScanner">GScanner</a> *scanner, <a href="glib-Lexical-Scanner.html#GTokenType">GTokenType</a> expected_token, const <a href="glib-Basic-Types.html#gchar">gchar</a> *identifier_spec, const <a href="glib-Basic-Types.html#gchar">gchar</a> *symbol_spec, const <a href="glib-Basic-Types.html#gchar">gchar</a> *symbol_name, const <a href="glib-Basic-Types.html#gchar">gchar</a> *message, <a href="glib-Basic-Types.html#gint">gint</a> is_error);</pre><p>Outputs a message through the scanner's msg_handler, resulting from anunexpected token in the input stream.Note that you should not call <a href="glib-Lexical-Scanner.html#g-scanner-peek-next-token"><code class="function">g_scanner_peek_next_token()</code></a> followed by<a href="glib-Lexical-Scanner.html#g-scanner-unexp-token"><code class="function">g_scanner_unexp_token()</code></a> without an intermediate call to<a href="glib-Lexical-Scanner.html#g-scanner-get-next-token"><code class="function">g_scanner_get_next_token()</code></a>, as <a href="glib-Lexical-Scanner.html#g-scanner-unexp-token"><code class="function">g_scanner_unexp_token()</code></a> evaluates thescanner's current token (not the peeked token) to construct partof the message.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>scanner</code></em> :</span></td><td>a <a href="glib-Lexical-Scanner.html#GScanner"><span class="type">GScanner</span></a>.</td></tr><tr><td><span class="term"><em class="parameter"><code>expected_token</code></em> :</span></td><td>the expected token.</td></tr><tr><td><span class="term"><em class="parameter"><code>identifier_spec</code></em> :</span></td><td>a string describing how the scanner's user refers to identifiers (<code class="literal">NULL</code> defaults to "identifier"). This is used if <em class="parameter"><code>expected_token</code></em> is <span class="type">G_TOKEN_IDENTIFIER</span> or <span class="type">G_TOKEN_IDENTIFIER_NULL</span>.</td></tr><tr><td><span class="term"><em class="parameter"><code>symbol_spec</code></em> :</span></td><td>a string describing how the scanner's user refers to symbols (<code class="literal">NULL</code> defaults to "symbol"). This is used if <em class="parameter"><code>expected_token</code></em> is <span class="type">G_TOKEN_SYMBOL</span> or any token value greater than <span class="type">G_TOKEN_LAST</span>.</td></tr><tr><td><span class="term"><em class="parameter"><code>symbol_name</code></em> :</span></td><td>the name of the symbol, if the scanner's current token is a symbol.</td></tr><tr><td><span class="term"><em class="parameter"><code>message</code></em> :</span></td><td>a message string to output at the end of the warning/error, or <code class="literal">NULL</code>.</td></tr><tr><td><span class="term"><em class="parameter"><code>is_error</code></em> :</span></td><td>if <code class="literal">TRUE</code> it is output as an error. If <code class="literal">FALSE</code> it is output as a warning.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3032218"></a><h3><a name="GScannerMsgFunc"></a>GScannerMsgFunc ()</h3><a class="indexterm" name="id3032228"></a><pre class="programlisting">void (*GScannerMsgFunc) (<a href="glib-Lexical-Scanner.html#GScanner">GScanner</a> *scanner, <a href="glib-Basic-Types.html#gchar">gchar</a> *message, <a href="glib-Basic-Types.html#gboolean">gboolean</a> error);</pre><p>Specifies the type of the message handler function.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>scanner</code></em> :</span></td><td>a <a href="glib-Lexical-Scanner.html#GScanner"><span class="type">GScanner</span></a>.</td></tr><tr><td><span class="term"><em class="parameter"><code>message</code></em> :</span></td><td>the message.</td></tr><tr><td><span class="term"><em class="parameter"><code>error</code></em> :</span></td><td><code class="literal">TRUE</code> if the message signals an error, <code class="literal">FALSE</code> if it signals a warning.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3032337"></a><h3><a name="g-scanner-destroy"></a>g_scanner_destroy ()</h3><a class="indexterm" name="id3032349"></a><pre class="programlisting">void g_scanner_destroy (<a href="glib-Lexical-Scanner.html#GScanner">GScanner</a> *scanner);</pre><p>Frees all memory used by the <a href="glib-Lexical-Scanner.html#GScanner"><span class="type">GScanner</span></a>.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>scanner</code></em> :</span></td><td>a <a href="glib-Lexical-Scanner.html#GScanner"><span class="type">GScanner</span></a>.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3032410"></a><h3><a name="GTokenType"></a>enum GTokenType</h3><a class="indexterm" name="id3032421"></a><pre class="programlisting">typedef enum{ G_TOKEN_EOF = 0, G_TOKEN_LEFT_PAREN = '(', G_TOKEN_RIGHT_PAREN = ')', G_TOKEN_LEFT_CURLY = '{', G_TOKEN_RIGHT_CURLY = '}', G_TOKEN_LEFT_BRACE = '[', G_TOKEN_RIGHT_BRACE = ']', G_TOKEN_EQUAL_SIGN = '=', G_TOKEN_COMMA = ',', G_TOKEN_NONE = 256, G_TOKEN_ERROR, G_TOKEN_CHAR, G_TOKEN_BINARY, G_TOKEN_OCTAL, G_TOKEN_INT, G_TOKEN_HEX, G_TOKEN_FLOAT, G_TOKEN_STRING, G_TOKEN_SYMBOL, G_TOKEN_IDENTIFIER, G_TOKEN_IDENTIFIER_NULL, G_TOKEN_COMMENT_SINGLE, G_TOKEN_COMMENT_MULTI,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -