/usr/share/doc/flex-old-doc/flex_14.html is in flex-old-doc 2.5.4a-10.
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 | html2
<html>
<!-- Created on May 24, 2011 by texi2html 1.82
texi2html was written by:
Lionel Cons <Lionel.Cons@cern.ch> (original author)
Karl Berry <karl@freefriends.org>
Olaf Bachmann <obachman@mathematik.uni-kl.de>
and many others.
Maintained by: Many creative people.
Send bugs and suggestions to <texi2html-bug@nongnu.org>
-->
<head>
<title>Flex - a scanner generator: 14. Miscellaneous macros</title>
<meta name="description" content="Flex - a scanner generator: 14. Miscellaneous macros">
<meta name="keywords" content="Flex - a scanner generator: 14. Miscellaneous macros">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="texi2html 1.82">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.smallquotation {font-size: smaller}
pre.display {font-family: serif}
pre.format {font-family: serif}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: serif; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: serif; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.roman {font-family:serif; font-weight:normal;}
span.sansserif {font-family:sans-serif; font-weight:normal;}
ul.toc {list-style: none}
-->
</style>
</head>
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
<a name="Miscellaneous"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="flex_13.html#End_002dof_002dfile-rules" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="flex_15.html#User-variables" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="flex_13.html#End_002dof_002dfile-rules" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="flex.html#Top" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="flex_15.html#User-variables" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="flex.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="flex_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[Index]</td>
<td valign="middle" align="left">[<a href="flex_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Miscellaneous-macros"></a>
<h1 class="chapter">14. Miscellaneous macros</h1>
<p>The macro <code>YY_USER_ACTION</code> can be defined to provide an
action which is always executed prior to the matched
rule’s action. For example, it could be #define’d to call
a routine to convert yytext to lower-case. When
<code>YY_USER_ACTION</code> is invoked, the variable <code>yy_act</code> gives the
number of the matched rule (rules are numbered starting
with 1). Suppose you want to profile how often each of
your rules is matched. The following would do the trick:
</p>
<table><tr><td> </td><td><pre class="example">#define YY_USER_ACTION ++ctr[yy_act]
</pre></td></tr></table>
<p>where <code>ctr</code> is an array to hold the counts for the different
rules. Note that the macro <code>YY_NUM_RULES</code> gives the total number
of rules (including the default rule, even if you use ‘<samp>-s</samp>’, so
a correct declaration for <code>ctr</code> is:
</p>
<table><tr><td> </td><td><pre class="example">int ctr[YY_NUM_RULES];
</pre></td></tr></table>
<p>The macro <code>YY_USER_INIT</code> may be defined to provide an action
which is always executed before the first scan (and before
the scanner’s internal initializations are done). For
example, it could be used to call a routine to read in a
data table or open a logging file.
</p>
<p>The macro ‘<samp>yy_set_interactive(is_interactive)</samp>’ can be used
to control whether the current buffer is considered
<em>interactive</em>. An interactive buffer is processed more slowly,
but must be used when the scanner’s input source is indeed
interactive to avoid problems due to waiting to fill
buffers (see the discussion of the ‘<samp>-I</samp>’ flag below). A
non-zero value in the macro invocation marks the buffer as
interactive, a zero value as non-interactive. Note that
use of this macro overrides ‘<samp>%option always-interactive</samp>’ or
‘<samp>%option never-interactive</samp>’ (see Options below).
‘<samp>yy_set_interactive()</samp>’ must be invoked prior to beginning to
scan the buffer that is (or is not) to be considered
interactive.
</p>
<p>The macro ‘<samp>yy_set_bol(at_bol)</samp>’ can be used to control
whether the current buffer’s scanning context for the next
token match is done as though at the beginning of a line.
A non-zero macro argument makes rules anchored with
</p>
<p>The macro ‘<samp>YY_AT_BOL()</samp>’ returns true if the next token
scanned from the current buffer will have ’^’ rules
active, false otherwise.
</p>
<p>In the generated scanner, the actions are all gathered in
one large switch statement and separated using <code>YY_BREAK</code>,
which may be redefined. By default, it is simply a
"break", to separate each rule’s action from the following
rule’s. Redefining <code>YY_BREAK</code> allows, for example, C++
users to #define YY_BREAK to do nothing (while being very
careful that every rule ends with a "break" or a
"return"!) to avoid suffering from unreachable statement
warnings where because a rule’s action ends with "return",
the <code>YY_BREAK</code> is inaccessible.
</p>
<hr size="6">
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="flex_13.html#End_002dof_002dfile-rules" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="flex_15.html#User-variables" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="flex.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="flex_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[Index]</td>
<td valign="middle" align="left">[<a href="flex_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<p>
<font size="-1">
This document was generated on <i>May 24, 2011</i> using <a href="http://www.nongnu.org/texi2html/"><i>texi2html 1.82</i></a>.
</font>
<br>
</p>
</body>
</html>
|