Add sphinx documentation, integrated into our navigation and colour scheme
[ndcode_site.git] / sphinx / bisect_set.html
1
2 <!DOCTYPE html>
3
4 <html xmlns="http://www.w3.org/1999/xhtml">
5   <head>
6     <meta charset="utf-8" />
7     <title>The bisect_set module &#8212; πyacc  documentation</title>
8     <link rel="stylesheet" href="_static/classic.css" type="text/css" />
9     <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
10     
11     <script id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
12     <script src="_static/jquery.js"></script>
13     <script src="_static/underscore.js"></script>
14     <script src="_static/doctools.js"></script>
15     <script src="_static/language_data.js"></script>
16     
17     <link rel="index" title="Index" href="genindex.html" />
18     <link rel="search" title="Search" href="search.html" />
19     <link rel="next" title="The bison_lr1dfa module" href="bison_lr1dfa.html" />
20     <link rel="prev" title="Welcome to πyacc’s documentation" href="index.html" /> 
21   </head><body>
22     <div class="related" role="navigation" aria-label="related navigation">
23       <h3>Navigation</h3>
24       <ul>
25         <li class="right" style="margin-right: 10px">
26           <a href="genindex.html" title="General Index"
27              accesskey="I">index</a></li>
28         <li class="right" >
29           <a href="py-modindex.html" title="Python Module Index"
30              >modules</a> |</li>
31         <li class="right" >
32           <a href="bison_lr1dfa.html" title="The bison_lr1dfa module"
33              accesskey="N">next</a> |</li>
34         <li class="right" >
35           <a href="index.html" title="Welcome to πyacc’s documentation"
36              accesskey="P">previous</a> |</li>
37         <li class="nav-item nav-item-0"><a href="index.html">πyacc  documentation</a> &#187;</li> 
38       </ul>
39     </div>  
40
41     <div class="document">
42       <div class="documentwrapper">
43         <div class="bodywrapper">
44           <div class="body" role="main">
45             
46   <div class="section" id="module-ndcode.piyacc.bisect_set">
47 <span id="the-bisect-set-module"></span><h1>The <code class="docutils literal notranslate"><span class="pre">bisect_set</span></code> module<a class="headerlink" href="#module-ndcode.piyacc.bisect_set" title="Permalink to this headline"></a></h1>
48 <p>Module for dealing with sets of integers, or in particular, sets of characters
49 from potentially large character sets such as Unicode. We can store and
50 operate on these efficiently under the assumption that sets will contain mostly
51 ranges of consecutive character codes.</p>
52 <p>We encode character classes such as <code class="docutils literal notranslate"><span class="pre">[0-9A-Z]</span></code> as lists of breakpoints e.g.
53 <code class="docutils literal notranslate"><span class="pre">[0x30,</span> <span class="pre">0x3a,</span> <span class="pre">0x41,</span> <span class="pre">0x5b]</span></code>, which says that “included” characters begin at
54 <code class="docutils literal notranslate"><span class="pre">0x30</span></code> and <code class="docutils literal notranslate"><span class="pre">0x41</span></code> (the even breakpoints) whereas “excluded” characters
55 begin at <code class="docutils literal notranslate"><span class="pre">0x3a</span></code> and <code class="docutils literal notranslate"><span class="pre">0x5b</span></code> (the odd breakpoints).</p>
56 <dl class="data">
57 <dt id="ndcode.piyacc.bisect_set.N_CHARACTERS">
58 <code class="sig-prename descclassname">ndcode.piyacc.bisect_set.</code><code class="sig-name descname">N_CHARACTERS</code><em class="property"> = 256</em><a class="headerlink" href="#ndcode.piyacc.bisect_set.N_CHARACTERS" title="Permalink to this definition"></a></dt>
59 <dd><p>Defines the alphabet size, set this to <code class="docutils literal notranslate"><span class="pre">0x11000</span></code> for Unicode.</p>
60 </dd></dl>
61
62 <dl class="function">
63 <dt id="ndcode.piyacc.bisect_set.bisect_set_and">
64 <code class="sig-prename descclassname">ndcode.piyacc.bisect_set.</code><code class="sig-name descname">bisect_set_and</code><span class="sig-paren">(</span><em class="sig-param">character_set0</em>, <em class="sig-param">character_set1</em><span class="sig-paren">)</span><a class="headerlink" href="#ndcode.piyacc.bisect_set.bisect_set_and" title="Permalink to this definition"></a></dt>
65 <dd><p>Calculate intersection of the operand sets.</p>
66 <p>We do this by calculating a series of breakpoints, at each breakpoint
67 evaluating the “and” (min) of the even/odd truth values of each operand,
68 then making the output truth value even/odd by outputting if necessary.</p>
69 </dd></dl>
70
71 <dl class="function">
72 <dt id="ndcode.piyacc.bisect_set.bisect_set_not">
73 <code class="sig-prename descclassname">ndcode.piyacc.bisect_set.</code><code class="sig-name descname">bisect_set_not</code><span class="sig-paren">(</span><em class="sig-param">character_set</em><span class="sig-paren">)</span><a class="headerlink" href="#ndcode.piyacc.bisect_set.bisect_set_not" title="Permalink to this definition"></a></dt>
74 <dd><p>Calculate complement of the operand set.</p>
75 <ul class="simple">
76 <li><p>If operand set begins with <code class="docutils literal notranslate"><span class="pre">[0]</span></code>, remove it, otherwise add <code class="docutils literal notranslate"><span class="pre">[0]</span></code> prefix.</p></li>
77 <li><p>If operand set ends with <code class="docutils literal notranslate"><span class="pre">[N_CHARACTERS]</span></code>, remove it, otherwise add
78 <code class="docutils literal notranslate"><span class="pre">[N_CHARACTERS]</span></code> suffix.</p></li>
79 </ul>
80 <p>The suffix part is not totally necessary, but makes sure length is even
81 (the evenness is so that single character sets can always be <code class="docutils literal notranslate"><span class="pre">[c,</span> <span class="pre">c</span> <span class="pre">+</span> <span class="pre">1]</span></code>).</p>
82 </dd></dl>
83
84 <dl class="function">
85 <dt id="ndcode.piyacc.bisect_set.bisect_set_or">
86 <code class="sig-prename descclassname">ndcode.piyacc.bisect_set.</code><code class="sig-name descname">bisect_set_or</code><span class="sig-paren">(</span><em class="sig-param">character_set0</em>, <em class="sig-param">character_set1</em><span class="sig-paren">)</span><a class="headerlink" href="#ndcode.piyacc.bisect_set.bisect_set_or" title="Permalink to this definition"></a></dt>
87 <dd><p>Calculate union of the operand sets.</p>
88 <p>We do this by calculating a series of breakpoints, at each breakpoint
89 evaluating the “or” (max) of the even/odd truth values of each operand,
90 then making the output truth value even/odd by outputting if necessary.</p>
91 </dd></dl>
92
93 </div>
94
95
96           </div>
97         </div>
98       </div>
99       <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
100         <div class="sphinxsidebarwrapper">
101   <h4>Previous topic</h4>
102   <p class="topless"><a href="index.html"
103                         title="previous chapter">Welcome to πyacc’s documentation</a></p>
104   <h4>Next topic</h4>
105   <p class="topless"><a href="bison_lr1dfa.html"
106                         title="next chapter">The <code class="docutils literal notranslate"><span class="pre">bison_lr1dfa</span></code> module</a></p>
107   <div role="note" aria-label="source link">
108     <h3>This Page</h3>
109     <ul class="this-page-menu">
110       <li><a href="_sources/bisect_set.rst.txt"
111             rel="nofollow">Show Source</a></li>
112     </ul>
113    </div>
114 <div id="searchbox" style="display: none" role="search">
115   <h3 id="searchlabel">Quick search</h3>
116     <div class="searchformwrapper">
117     <form class="search" action="search.html" method="get">
118       <input type="text" name="q" aria-labelledby="searchlabel" />
119       <input type="submit" value="Go" />
120     </form>
121     </div>
122 </div>
123 <script>$('#searchbox').show(0);</script>
124         </div>
125       </div>
126       <div class="clearer"></div>
127     </div>
128     <div class="related" role="navigation" aria-label="related navigation">
129       <h3>Navigation</h3>
130       <ul>
131         <li class="right" style="margin-right: 10px">
132           <a href="genindex.html" title="General Index"
133              >index</a></li>
134         <li class="right" >
135           <a href="py-modindex.html" title="Python Module Index"
136              >modules</a> |</li>
137         <li class="right" >
138           <a href="bison_lr1dfa.html" title="The bison_lr1dfa module"
139              >next</a> |</li>
140         <li class="right" >
141           <a href="index.html" title="Welcome to πyacc’s documentation"
142              >previous</a> |</li>
143         <li class="nav-item nav-item-0"><a href="index.html">πyacc  documentation</a> &#187;</li> 
144       </ul>
145     </div>
146     <div class="footer" role="contentinfo">
147         &#169; Copyright 2020, NDCODE project.
148       Created using <a href="http://sphinx-doc.org/">Sphinx</a> 2.4.1.
149     </div>
150   </body>
151 </html>