📄 scanner.sgml
字号:
</para><para><structfield>scan_binary</structfield> specifies if binary numbersare recognized (the default is <literal>FALSE</literal>).</para><para><structfield>scan_octal</structfield> specifies if octal numbersare recognized (the default is <literal>TRUE</literal>).</para><para><structfield>scan_float</structfield> specifies if floating point numbersare recognized (the default is <literal>TRUE</literal>).</para><para><structfield>scan_hex</structfield> specifies if hexadecimal numbersare recognized (the default is <literal>TRUE</literal>).</para><para><structfield>scan_hex_dollar</structfield> specifies if '$' is recognizedas a prefix for hexadecimal numbers (the default is <literal>FALSE</literal>).</para><para><structfield>scan_string_sq</structfield> specifies if strings can beenclosed in single quotes (the default is <literal>TRUE</literal>).</para><para><structfield>scan_string_dq</structfield> specifies if strings can beenclosed in double quotes (the default is <literal>TRUE</literal>).</para><para><structfield>numbers_2_int</structfield> specifies if binary, octal andhexadecimal numbers are reported as <link linkend="G-TOKEN-INT-CAPS">G_TOKEN_INT</link> (the default is <literal>TRUE</literal>).</para><para><structfield>int_2_float</structfield> specifies if all numbers are reported as <link linkend="G-TOKEN-FLOAT-CAPS">G_TOKEN_FLOAT</link> (the default is <literal>FALSE</literal>).</para><para><structfield>identifier_2_string</structfield> specifies if identifiersare reported as strings (the default is <literal>FALSE</literal>).</para><para><structfield>char_2_token</structfield> specifies if charactersare reported by setting <literal>token = ch</literal> or as <link linkend="G-TOKEN-CHAR-CAPS">G_TOKEN_CHAR</link> (the default is <literal>TRUE</literal>).</para><para><structfield>symbol_2_token</structfield> specifies if symbols are reported by setting <literal>token = v_symbol</literal> or as<link linkend="G-TOKEN-SYMBOL-CAPS">G_TOKEN_SYMBOL</link> (the default is <literal>FALSE</literal>).</para><para><structfield>scope_0_fallback</structfield> specifies if a symbol is searched for in the default scope in addition to the current scope(the default is <literal>FALSE</literal>).</para></refsect2><refsect2><title><anchor id="g-scanner-input-file">g_scanner_input_file ()</title><programlisting>void g_scanner_input_file (<link linkend="GScanner">GScanner</link> *scanner, <link linkend="gint">gint</link> input_fd);</programlisting><para>Prepares to scan a file.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>scanner</parameter> :</entry><entry>a <link linkend="GScanner">GScanner</link>.</entry></row><row><entry align="right"><parameter>input_fd</parameter> :</entry><entry>a file descriptor.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-scanner-sync-file-offset">g_scanner_sync_file_offset ()</title><programlisting>void g_scanner_sync_file_offset (<link linkend="GScanner">GScanner</link> *scanner);</programlisting><para>Rewinds the filedescriptor to the current buffer position and blows the file read ahead buffer. This is useful for third party uses ofthe scanners filedescriptor, which hooks onto the current scanning position.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>scanner</parameter> :</entry><entry>a <link linkend="GScanner">GScanner</link>.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-scanner-input-text">g_scanner_input_text ()</title><programlisting>void g_scanner_input_text (<link linkend="GScanner">GScanner</link> *scanner, const <link linkend="gchar">gchar</link> *text, <link linkend="guint">guint</link> text_len);</programlisting><para>Prepares to scan a text buffer.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>scanner</parameter> :</entry><entry>a <link linkend="GScanner">GScanner</link>.</entry></row><row><entry align="right"><parameter>text</parameter> :</entry><entry>the text buffer to scan.</entry></row><row><entry align="right"><parameter>text_len</parameter> :</entry><entry>the length of the text buffer.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-scanner-peek-next-token">g_scanner_peek_next_token ()</title><programlisting><link linkend="GTokenType">GTokenType</link> g_scanner_peek_next_token (<link linkend="GScanner">GScanner</link> *scanner);</programlisting><para>Gets the next token, without removing it from the input stream.The token data is placed in the<structfield>next_token</structfield>,<structfield>next_value</structfield>,<structfield>next_line</structfield>, and<structfield>next_position</structfield> fields of the <link linkend="GScanner">GScanner</link> structure.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>scanner</parameter> :</entry><entry>a <link linkend="GScanner">GScanner</link>.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>the type of the token.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-scanner-get-next-token">g_scanner_get_next_token ()</title><programlisting><link linkend="GTokenType">GTokenType</link> g_scanner_get_next_token (<link linkend="GScanner">GScanner</link> *scanner);</programlisting><para>Gets the next token, removing it from the input stream.The token data is placed in the<structfield>token</structfield>,<structfield>value</structfield>,<structfield>line</structfield>, and<structfield>position</structfield> fields of the <link linkend="GScanner">GScanner</link> structure.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>scanner</parameter> :</entry><entry>a <link linkend="GScanner">GScanner</link>.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>the type of the token.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-scanner-cur-line">g_scanner_cur_line ()</title><programlisting><link linkend="guint">guint</link> g_scanner_cur_line (<link linkend="GScanner">GScanner</link> *scanner);</programlisting><para>Gets the current line in the input stream (counting from 1).</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>scanner</parameter> :</entry><entry>a <link linkend="GScanner">GScanner</link>.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>the current line.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-scanner-cur-position">g_scanner_cur_position ()</title><programlisting><link linkend="guint">guint</link> g_scanner_cur_position (<link linkend="GScanner">GScanner</link> *scanner);</programlisting><para>Gets the current position in the current line (counting from 0).</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>scanner</parameter> :</entry><entry>a <link linkend="GScanner">GScanner</link>.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>the current position on the line.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-scanner-cur-token">g_scanner_cur_token ()</title><programlisting><link linkend="GTokenType">GTokenType</link> g_scanner_cur_token (<link linkend="GScanner">GScanner</link> *scanner);</programlisting><para>Gets the current token type.This is simply the <structfield>token</structfield> field in the <link linkend="GScanner">GScanner</link>structure.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>scanner</parameter> :</entry><entry>a <link linkend="GScanner">GScanner</link>.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>the current token type.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-scanner-cur-value">g_scanner_cur_value ()</title><programlisting><link linkend="GTokenValue">GTokenValue</link> g_scanner_cur_value (<link linkend="GScanner">GScanner</link> *scanner);</programlisting><para>Gets the current token value.This is simply the <structfield>value</structfield> field in the <link linkend="GScanner">GScanner</link>structure.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>scanner</parameter> :</entry><entry>a <link linkend="GScanner">GScanner</link>.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>the current token value.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-scanner-eof">g_scanner_eof ()</title><programlisting><link linkend="gboolean">gboolean</link> g_scanner_eof (<link linkend="GScanner">GScanner</link> *scanner);</programlisting><para>Returns <literal>TRUE</literal> if the scanner has reached the end of the file or text buffer.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>scanner</parameter> :</entry><entry>a <link linkend="GScanner">GScanner</link>.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry><literal>TRUE</literal> if the scanner has reached the end of the file or text buffer.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-scanner-set-scope">g_scanner_set_scope ()</title><programlisting><link linkend="guint">guint</link> g_scanner_set_scope (<link linkend="GScanner">GScanner</link> *scanner, <link linkend="guint">guint</link> scope_id);</programlisting><para>Sets the current scope.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>scanner</parameter> :</entry><entry>a <link linkend="GScanner">GScanner</link>.</entry></row><row><entry align="right"><parameter>scope_id</parameter> :</entry><entry>the new scope id.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>the old scope id.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-scanner-scope-add-symbol">g_scanner_scope_add_symbol ()</title><programlisting>void g_scanner_scope_add_symbol (<link linkend="GScanner">GScanner</link> *scanner, <link linkend="guint">guint</link> scope_id, const <link linkend="gchar">gchar</link> *symbol, <link linkend="gpointer">gpointer</link> value);</programlisting><para>Adds a symbol to the given scope.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*">
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -