Skip to content

Commit

Permalink
Provide an encoding for categories such that the 2 least significant …
Browse files Browse the repository at this point in the history
…bits is the form.
  • Loading branch information
fred-wang committed May 11, 2020
1 parent de92d2a commit aaeeaef
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 12 deletions.
7 changes: 3 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5377,10 +5377,9 @@ <h3>Operator Dictionary (Compact)</h3>
</p>
<p>
Alternatively, discarding the smallest tables as explained above,
one can consider only those for categories 0-7.
Then each of the three 'Form' corresponds to at most three
categories and so ('Form', 'Category') can be encoded
on 4 bits. Using the 12-bit encoding of the 'Content' described
one can consider only those having a 4bits encoding in
<a href="#operator-dictionary-categories-values"></a>.
Using the 12-bit encoding of the 'Content' described
above this means that these tables can be encoded with
16bits/entry but binary search would now be performed on a single
table.
Expand Down
2 changes: 1 addition & 1 deletion tables/operator-dictionary-compact.html
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<!-- This file was automatically generated from generate-math-variant-tables.py. Do not edit. -->
<figure id="operator-dictionary-compact-special-tables"><table><tr><th>Special Table</th><th>Entries</th></tr><tr><td><code>Operators_multichar</code></td><td>41 entries (null-terminated UTF-16 strings): <code>{U+0021,U+0021,U+0000}, {U+0021,U+003D,U+0000}, {U+0026,U+0026,U+0000}, {U+002A,U+003D,U+0000}, {U+002B,U+002B,U+0000}, {U+002B,U+003D,U+0000}, {U+002D,U+002D,U+0000}, {U+002D,U+003D,U+0000}, {U+002D,U+003E,U+0000}, {U+002E,U+002E,U+0000}, {U+002E,U+002E,U+002E,U+0000}, {U+002F,U+003D,U+0000}, {U+003A,U+003D,U+0000}, {U+003C,U+003D,U+0000}, {U+003D,U+003D,U+0000}, {U+003E,U+003D,U+0000}, {U+007C,U+007C,U+0000}, {U+007C,U+007C,U+007C,U+0000}, {U+223D,U+0331,U+0000}, {U+2242,U+0338,U+0000}, {U+224E,U+0338,U+0000}, {U+224F,U+0338,U+0000}, {U+2266,U+0338,U+0000}, {U+226A,U+0338,U+0000}, {U+226B,U+0338,U+0000}, {U+227F,U+0338,U+0000}, {U+2282,U+20D2,U+0000}, {U+2283,U+20D2,U+0000}, {U+228F,U+0338,U+0000}, {U+2290,U+0338,U+0000}, {U+29CF,U+0338,U+0000}, {U+29D0,U+0338,U+0000}, {U+2A7D,U+0338,U+0000}, {U+2A7E,U+0338,U+0000}, {U+2AA1,U+0338,U+0000}, {U+2AA2,U+0338,U+0000}, {U+2AAF,U+0338,U+0000}, {U+2AB0,U+0338,U+0000}, {U+2ADD,U+0338,U+0000}, {U+D83B,U+DEF0,U+0000}, {U+D83B,U+DEF1,U+0000}, </code></td></tr><tr><td><code>Operators_fence</code></td><td>57 entries (15 Unicode ranges): <code>[U+0028–U+0029], {U+005B}, {U+005D}, [U+007B–U+007D], {U+2016}, [U+2018–U+2019], [U+201C–U+201D], [U+2308–U+230B], [U+2329–U+232A], [U+2772–U+2773], [U+27E6–U+27EF], {U+2980}, [U+2983–U+2998], [U+29FC–U+29FD], [U+E010–U+E011], </code></td></tr><tr><td><code>Operators_separator</code></td><td>3 entries: <code>U+002C, U+003B, U+2063, </code></td></tr></table><figcaption>Special tables for the operator dictionary.<br/>Total size: 101 entries, 301 bytes.<br/>(assuming characters are UTF-16 and 1-byte range lengths)</figcaption></figure><figure id="operator-dictionary-category-table"><table><tr><th>(Content, Form) keys</th><th>Category</th></tr><tr><td>138 entries (18 Unicode ranges) in <strong>infix</strong> form: <code>[U+2190–U+2199], [U+219C–U+21AD], [U+21AF–U+21B5], {U+21B9}, [U+21BC–U+21CC], [U+21D0–U+21DD], [U+21E0–U+21F0], {U+21F3}, [U+21F5–U+21F6], [U+21FD–U+21FF], [U+27F0–U+27F1], [U+27F5–U+27FF], [U+290A–U+2910], [U+2912–U+2913], [U+2921–U+2922], [U+294E–U+2961], [U+296E–U+296F], [U+2B45–U+2B46], </code></td><td>0</td></tr><tr><td>103 entries (36 Unicode ranges) in <strong>infix</strong> form: <code>{U+002B}, {U+002D}, {U+002F}, {U+00B1}, {U+00F7}, [U+2212–U+2214], {U+2216}, {U+2218}, {U+2224}, [U+2227–U+222A], {U+2236}, {U+2238}, [U+228C–U+228F], [U+2293–U+2296], {U+2298}, [U+229D–U+229F], [U+22BB–U+22BD], {U+22C4}, {U+22C6}, [U+22CE–U+22CF], [U+22D2–U+22D3], [U+2795–U+2797], {U+27F4}, {U+29BC}, {U+29F6}, [U+2A22–U+2A2E], [U+2A38–U+2A3A], [U+2A40–U+2A4F], [U+2A51–U+2A63], [U+2ADA–U+2ADB], {U+2AFB}, {U+2AFD}, {U+2B32}, {U+E002}, {U+E005}, {U+E007}, </code></td><td>1</td></tr><tr><td>89 entries (42 Unicode ranges) in <strong>infix</strong> form: <code>{U+0025}, {U+002A}, {U+002E}, {U+0040}, {U+00B7}, {U+00D7}, {U+2022}, {U+2043}, {U+2206}, {U+220E}, {U+2217}, [U+223F–U+2240], {U+2297}, {U+2299}, [U+22A0–U+22A1], {U+22C5}, {U+22C7}, [U+22C9–U+22CC], [U+2305–U+2306], [U+25A0–U+25A1], [U+25AA–U+25AB], [U+25AD–U+25B1], [U+2981–U+2982], [U+2999–U+299A], {U+29B5}, [U+29C2–U+29C3], [U+29C9–U+29CD], [U+29D8–U+29D9], {U+29DB}, [U+29DF–U+29E0], {U+29E2}, [U+29E7–U+29ED], [U+29F8–U+29FB], [U+2A1D–U+2A21], [U+2A2F–U+2A37], [U+2A3B–U+2A3D], {U+2A3F}, {U+2A50}, [U+2ADC–U+2ADD], {U+2AFE}, [U+E010–U+E012], {U+E026}, </code></td><td>2</td></tr><tr><td>53 entries (22 Unicode ranges) in <strong>prefix</strong> form: <code>{U+0021}, {U+002B}, {U+002D}, {U+00AC}, {U+00B1}, {U+2018}, {U+201C}, [U+2200–U+2201], [U+2203–U+2204], {U+2207}, [U+2212–U+2213], [U+221B–U+221C], [U+221F–U+2222], {U+223C}, [U+22BE–U+22BF], {U+2310}, {U+2319}, [U+2795–U+2796], {U+27C0}, [U+299B–U+29AF], [U+2AEC–U+2AED], [U+E010–U+E011], </code></td><td>3</td></tr><tr><td>42 entries (22 Unicode ranges) in <strong>postfix</strong> form: <code>[U+0021–U+0022], [U+0026–U+0027], {U+0060}, {U+00A8}, {U+00B0}, [U+00B2–U+00B4], [U+00B8–U+00B9], [U+02CA–U+02CB], [U+02D8–U+02DA], {U+02DD}, {U+0311}, [U+2019–U+201B], [U+201D–U+201F], [U+2032–U+2037], {U+2057}, [U+20DB–U+20DC], {U+23CD}, {U+E000}, {U+E004}, {U+E006}, [U+E009–U+E00A], [U+E010–U+E011], </code></td><td>4</td></tr><tr><td>26 entries (16 Unicode ranges) in <strong>postfix</strong> form: <code>[U+005E–U+005F], {U+007E}, {U+00AF}, [U+02C6–U+02C7], {U+02C9}, {U+02CD}, {U+02DC}, {U+02F7}, {U+0302}, {U+2016}, {U+203E}, [U+2322–U+2323], [U+23B4–U+23B5], [U+23DC–U+23E1], {U+2980}, [U+E027–U+E028], </code></td><td>5</td></tr><tr><td>25 entries in <strong>prefix</strong> form: <code>U+0028, U+005B, U+007B, U+007C, U+2308, U+230A, U+2329, U+2772, U+27E6, U+27E8, U+27EA, U+27EC, U+27EE, U+2983, U+2985, U+2987, U+2989, U+298B, U+298D, U+298F, U+2991, U+2993, U+2995, U+2997, U+29FC, </code></td><td>6</td></tr><tr><td>25 entries in <strong>postfix</strong> form: <code>U+0029, U+005D, U+007C, U+007D, U+2309, U+230B, U+232A, U+2773, U+27E7, U+27E9, U+27EB, U+27ED, U+27EF, U+2984, U+2986, U+2988, U+298A, U+298C, U+298E, U+2990, U+2992, U+2994, U+2996, U+2998, U+29FD, </code></td><td>7</td></tr><tr><td>22 entries (3 Unicode ranges) in <strong>prefix</strong> form: <code>[U+222B–U+2233], [U+2A0B–U+2A0F], [U+2A15–U+2A1C], </code></td><td>8</td></tr><tr><td>18 entries (5 Unicode ranges) in <strong>prefix</strong> form: <code>[U+220F–U+2210], [U+22C0–U+22C3], [U+2A00–U+2A09], {U+2AFC}, {U+2AFF}, </code></td><td>9</td></tr><tr><td>7 entries (3 Unicode ranges) in <strong>prefix</strong> form: <code>{U+2211}, {U+2A0A}, [U+2A10–U+2A14], </code></td><td>10</td></tr><tr><td>6 entries (3 Unicode ranges) in <strong>infix</strong> form: <code>{U+005C}, [U+2061–U+2064], {U+2396}, </code></td><td>11</td></tr><tr><td>3 entries in <strong>infix</strong> form: <code>U+002C, U+003A, U+003B, </code></td><td>12</td></tr><tr><td>3 entries in <strong>prefix</strong> form: <code>U+2145, U+2146, U+2202, </code></td><td>13</td></tr></table><figcaption>Mapping from operator (Content, Form) to a category.<br/>Total size: 560 entries, 622 bytes.<br/>(assuming characters are UTF-16 and 1-byte range lengths)</figcaption></figure><figure id="operator-dictionary-categories-values"><table><tr><th>Category</th><th>rspace</th><th>lspace</th><th>properties</th></tr><tr><td>0</td><td><code>0.2777777777777778em</code></td><td><code>0.2777777777777778em</code></td><td>stretchy </td></tr><tr><td>1</td><td><code>0.2222222222222222em</code></td><td><code>0.2222222222222222em</code></td><td>N/A</td></tr><tr><td>2</td><td><code>0.16666666666666666em</code></td><td><code>0.16666666666666666em</code></td><td>N/A</td></tr><tr><td>3</td><td><code>0</code></td><td><code>0</code></td><td>N/A</td></tr><tr><td>4</td><td><code>0</code></td><td><code>0</code></td><td>N/A</td></tr><tr><td>5</td><td><code>0</code></td><td><code>0</code></td><td>stretchy </td></tr><tr><td>6</td><td><code>0</code></td><td><code>0</code></td><td>stretchy symmetric </td></tr><tr><td>7</td><td><code>0</code></td><td><code>0</code></td><td>stretchy symmetric </td></tr><tr><td>8</td><td><code>0.16666666666666666em</code></td><td><code>0.16666666666666666em</code></td><td>symmetric largeop </td></tr><tr><td>9</td><td><code>0.05555555555555555em</code></td><td><code>0.1111111111111111em</code></td><td>symmetric largeop movablelimits </td></tr><tr><td>10</td><td><code>0.16666666666666666em</code></td><td><code>0.16666666666666666em</code></td><td>symmetric largeop movablelimits </td></tr><tr><td>11</td><td><code>0</code></td><td><code>0</code></td><td>N/A</td></tr><tr><td>12</td><td><code>0</code></td><td><code>0.16666666666666666em</code></td><td>N/A</td></tr><tr><td>13</td><td><code>0.16666666666666666em</code></td><td><code>0</code></td><td>N/A</td></tr></table><figcaption>Operators values for each category.</figcaption></figure>
<figure id="operator-dictionary-compact-special-tables"><table><tr><th>Special Table</th><th>Entries</th></tr><tr><td><code>Operators_multichar</code></td><td>41 entries (null-terminated UTF-16 strings): <code>{U+0021,U+0021,U+0000}, {U+0021,U+003D,U+0000}, {U+0026,U+0026,U+0000}, {U+002A,U+003D,U+0000}, {U+002B,U+002B,U+0000}, {U+002B,U+003D,U+0000}, {U+002D,U+002D,U+0000}, {U+002D,U+003D,U+0000}, {U+002D,U+003E,U+0000}, {U+002E,U+002E,U+0000}, {U+002E,U+002E,U+002E,U+0000}, {U+002F,U+003D,U+0000}, {U+003A,U+003D,U+0000}, {U+003C,U+003D,U+0000}, {U+003D,U+003D,U+0000}, {U+003E,U+003D,U+0000}, {U+007C,U+007C,U+0000}, {U+007C,U+007C,U+007C,U+0000}, {U+223D,U+0331,U+0000}, {U+2242,U+0338,U+0000}, {U+224E,U+0338,U+0000}, {U+224F,U+0338,U+0000}, {U+2266,U+0338,U+0000}, {U+226A,U+0338,U+0000}, {U+226B,U+0338,U+0000}, {U+227F,U+0338,U+0000}, {U+2282,U+20D2,U+0000}, {U+2283,U+20D2,U+0000}, {U+228F,U+0338,U+0000}, {U+2290,U+0338,U+0000}, {U+29CF,U+0338,U+0000}, {U+29D0,U+0338,U+0000}, {U+2A7D,U+0338,U+0000}, {U+2A7E,U+0338,U+0000}, {U+2AA1,U+0338,U+0000}, {U+2AA2,U+0338,U+0000}, {U+2AAF,U+0338,U+0000}, {U+2AB0,U+0338,U+0000}, {U+2ADD,U+0338,U+0000}, {U+D83B,U+DEF0,U+0000}, {U+D83B,U+DEF1,U+0000}, </code></td></tr><tr><td><code>Operators_fence</code></td><td>57 entries (15 Unicode ranges): <code>[U+0028–U+0029], {U+005B}, {U+005D}, [U+007B–U+007D], {U+2016}, [U+2018–U+2019], [U+201C–U+201D], [U+2308–U+230B], [U+2329–U+232A], [U+2772–U+2773], [U+27E6–U+27EF], {U+2980}, [U+2983–U+2998], [U+29FC–U+29FD], [U+E010–U+E011], </code></td></tr><tr><td><code>Operators_separator</code></td><td>3 entries: <code>U+002C, U+003B, U+2063, </code></td></tr></table><figcaption>Special tables for the operator dictionary.<br/>Total size: 101 entries, 301 bytes.<br/>(assuming characters are UTF-16 and 1-byte range lengths)</figcaption></figure><figure id="operator-dictionary-category-table"><table><tr><th>(Content, Form) keys</th><th>Category</th></tr><tr><td>138 entries (18 Unicode ranges) in <strong>infix</strong> form: <code>[U+2190–U+2199], [U+219C–U+21AD], [U+21AF–U+21B5], {U+21B9}, [U+21BC–U+21CC], [U+21D0–U+21DD], [U+21E0–U+21F0], {U+21F3}, [U+21F5–U+21F6], [U+21FD–U+21FF], [U+27F0–U+27F1], [U+27F5–U+27FF], [U+290A–U+2910], [U+2912–U+2913], [U+2921–U+2922], [U+294E–U+2961], [U+296E–U+296F], [U+2B45–U+2B46], </code></td><td>A</td></tr><tr><td>103 entries (36 Unicode ranges) in <strong>infix</strong> form: <code>{U+002B}, {U+002D}, {U+002F}, {U+00B1}, {U+00F7}, [U+2212–U+2214], {U+2216}, {U+2218}, {U+2224}, [U+2227–U+222A], {U+2236}, {U+2238}, [U+228C–U+228F], [U+2293–U+2296], {U+2298}, [U+229D–U+229F], [U+22BB–U+22BD], {U+22C4}, {U+22C6}, [U+22CE–U+22CF], [U+22D2–U+22D3], [U+2795–U+2797], {U+27F4}, {U+29BC}, {U+29F6}, [U+2A22–U+2A2E], [U+2A38–U+2A3A], [U+2A40–U+2A4F], [U+2A51–U+2A63], [U+2ADA–U+2ADB], {U+2AFB}, {U+2AFD}, {U+2B32}, {U+E002}, {U+E005}, {U+E007}, </code></td><td>B</td></tr><tr><td>89 entries (42 Unicode ranges) in <strong>infix</strong> form: <code>{U+0025}, {U+002A}, {U+002E}, {U+0040}, {U+00B7}, {U+00D7}, {U+2022}, {U+2043}, {U+2206}, {U+220E}, {U+2217}, [U+223F–U+2240], {U+2297}, {U+2299}, [U+22A0–U+22A1], {U+22C5}, {U+22C7}, [U+22C9–U+22CC], [U+2305–U+2306], [U+25A0–U+25A1], [U+25AA–U+25AB], [U+25AD–U+25B1], [U+2981–U+2982], [U+2999–U+299A], {U+29B5}, [U+29C2–U+29C3], [U+29C9–U+29CD], [U+29D8–U+29D9], {U+29DB}, [U+29DF–U+29E0], {U+29E2}, [U+29E7–U+29ED], [U+29F8–U+29FB], [U+2A1D–U+2A21], [U+2A2F–U+2A37], [U+2A3B–U+2A3D], {U+2A3F}, {U+2A50}, [U+2ADC–U+2ADD], {U+2AFE}, [U+E010–U+E012], {U+E026}, </code></td><td>C</td></tr><tr><td>53 entries (22 Unicode ranges) in <strong>prefix</strong> form: <code>{U+0021}, {U+002B}, {U+002D}, {U+00AC}, {U+00B1}, {U+2018}, {U+201C}, [U+2200–U+2201], [U+2203–U+2204], {U+2207}, [U+2212–U+2213], [U+221B–U+221C], [U+221F–U+2222], {U+223C}, [U+22BE–U+22BF], {U+2310}, {U+2319}, [U+2795–U+2796], {U+27C0}, [U+299B–U+29AF], [U+2AEC–U+2AED], [U+E010–U+E011], </code></td><td>D</td></tr><tr><td>42 entries (22 Unicode ranges) in <strong>postfix</strong> form: <code>[U+0021–U+0022], [U+0026–U+0027], {U+0060}, {U+00A8}, {U+00B0}, [U+00B2–U+00B4], [U+00B8–U+00B9], [U+02CA–U+02CB], [U+02D8–U+02DA], {U+02DD}, {U+0311}, [U+2019–U+201B], [U+201D–U+201F], [U+2032–U+2037], {U+2057}, [U+20DB–U+20DC], {U+23CD}, {U+E000}, {U+E004}, {U+E006}, [U+E009–U+E00A], [U+E010–U+E011], </code></td><td>E</td></tr><tr><td>26 entries (16 Unicode ranges) in <strong>postfix</strong> form: <code>[U+005E–U+005F], {U+007E}, {U+00AF}, [U+02C6–U+02C7], {U+02C9}, {U+02CD}, {U+02DC}, {U+02F7}, {U+0302}, {U+2016}, {U+203E}, [U+2322–U+2323], [U+23B4–U+23B5], [U+23DC–U+23E1], {U+2980}, [U+E027–U+E028], </code></td><td>F</td></tr><tr><td>25 entries in <strong>prefix</strong> form: <code>U+0028, U+005B, U+007B, U+007C, U+2308, U+230A, U+2329, U+2772, U+27E6, U+27E8, U+27EA, U+27EC, U+27EE, U+2983, U+2985, U+2987, U+2989, U+298B, U+298D, U+298F, U+2991, U+2993, U+2995, U+2997, U+29FC, </code></td><td>G</td></tr><tr><td>25 entries in <strong>postfix</strong> form: <code>U+0029, U+005D, U+007C, U+007D, U+2309, U+230B, U+232A, U+2773, U+27E7, U+27E9, U+27EB, U+27ED, U+27EF, U+2984, U+2986, U+2988, U+298A, U+298C, U+298E, U+2990, U+2992, U+2994, U+2996, U+2998, U+29FD, </code></td><td>H</td></tr><tr><td>22 entries (3 Unicode ranges) in <strong>prefix</strong> form: <code>[U+222B–U+2233], [U+2A0B–U+2A0F], [U+2A15–U+2A1C], </code></td><td>I</td></tr><tr><td>18 entries (5 Unicode ranges) in <strong>prefix</strong> form: <code>[U+220F–U+2210], [U+22C0–U+22C3], [U+2A00–U+2A09], {U+2AFC}, {U+2AFF}, </code></td><td>J</td></tr><tr><td>7 entries (3 Unicode ranges) in <strong>prefix</strong> form: <code>{U+2211}, {U+2A0A}, [U+2A10–U+2A14], </code></td><td>K</td></tr><tr><td>6 entries (3 Unicode ranges) in <strong>infix</strong> form: <code>{U+005C}, [U+2061–U+2064], {U+2396}, </code></td><td>L</td></tr><tr><td>3 entries in <strong>infix</strong> form: <code>U+002C, U+003A, U+003B, </code></td><td>M</td></tr><tr><td>3 entries in <strong>prefix</strong> form: <code>U+2145, U+2146, U+2202, </code></td><td>N</td></tr></table><figcaption>Mapping from operator (Content, Form) to a category.<br/>Total size: 560 entries, 622 bytes.<br/>(assuming characters are UTF-16 and 1-byte range lengths)</figcaption></figure><figure id="operator-dictionary-categories-values"><table><tr><th>Category</th><th>encoding</th><th>rspace</th><th>lspace</th><th>properties</th></tr><tr><td>A</td><td>0x0</td><td><code>0.2777777777777778em</code></td><td><code>0.2777777777777778em</code></td><td>stretchy </td></tr><tr><td>B</td><td>0x4</td><td><code>0.2222222222222222em</code></td><td><code>0.2222222222222222em</code></td><td>N/A</td></tr><tr><td>C</td><td>0x8</td><td><code>0.16666666666666666em</code></td><td><code>0.16666666666666666em</code></td><td>N/A</td></tr><tr><td>D</td><td>0x1</td><td><code>0</code></td><td><code>0</code></td><td>N/A</td></tr><tr><td>E</td><td>0x2</td><td><code>0</code></td><td><code>0</code></td><td>N/A</td></tr><tr><td>F</td><td>0x6</td><td><code>0</code></td><td><code>0</code></td><td>stretchy </td></tr><tr><td>G</td><td>0x5</td><td><code>0</code></td><td><code>0</code></td><td>stretchy symmetric </td></tr><tr><td>H</td><td>0xA</td><td><code>0</code></td><td><code>0</code></td><td>stretchy symmetric </td></tr><tr><td>I</td><td>0x9</td><td><code>0.16666666666666666em</code></td><td><code>0.16666666666666666em</code></td><td>symmetric largeop </td></tr><tr><td>J</td><td>0xD</td><td><code>0.05555555555555555em</code></td><td><code>0.1111111111111111em</code></td><td>symmetric largeop movablelimits </td></tr><tr><td>K</td><td>N/A</td><td><code>0.16666666666666666em</code></td><td><code>0.16666666666666666em</code></td><td>symmetric largeop movablelimits </td></tr><tr><td>L</td><td>0xC</td><td><code>0</code></td><td><code>0</code></td><td>N/A</td></tr><tr><td>M</td><td>N/A</td><td><code>0</code></td><td><code>0.16666666666666666em</code></td><td>N/A</td></tr><tr><td>N</td><td>N/A</td><td><code>0.16666666666666666em</code></td><td><code>0</code></td><td>N/A</td></tr></table><figcaption>Operators values for each category.<br/>The second column provides a 4bits encoding of the categories<br/>where the 2 least significant bits encodes the form infix (0), prefix (1) and postfix (2).</figcaption></figure>
27 changes: 20 additions & 7 deletions tables/operator-dictionary.py
Original file line number Diff line number Diff line change
Expand Up @@ -599,34 +599,47 @@ def serializeValue(value, fence, separator):
md.write("U+%04X, " % entry)
totalBytes += 2 * count
md.write("</code></td>")
md.write("<td>%d</td>" % value_index);
md.write("<td>%s</td>" % chr(ord('A') + value_index));
value_index += 1;
md.write("</tr>")
md.write("</table>");
md.write('<figcaption>Mapping from operator (Content, Form) to a category.<br/>Total size: %d entries, %d bytes.<br/>(assuming characters are UTF-16 and 1-byte range lengths)</figcaption>' % (totalEntryCount, totalBytes))
md.write('</figure>')


category_for_form = [0, 0, 0]
value_index = 0
md.write('<figure id="operator-dictionary-categories-values">')
md.write("<table>");
md.write("<tr><th>Category</th><th>rspace</th><th>lspace</th><th>properties</th></tr>")
md.write("<tr><th>Category</th><th>encoding</th><th>rspace</th><th>lspace</th><th>properties</th></tr>")
for name, item in sorted(knownTables.items(),
key=(lambda v: len(v[1]["singleChar"])),
reverse=True):
if ((name in ["fence", "separator"])):
continue
for entry in knownTables[name]["singleChar"]:
md.write("<tr>");
md.write("<td>%d</td>" % value_index)
md.write(serializeValue(knownTables[name]["value"],
False,
False))
md.write("<td>%s</td>" % chr(ord('A') + value_index))
form = knownTables[name]["value"]["form"]
if form == "infix":
form = 0
elif form == "prefix":
form = 1
elif form == "postfix":
form = 2
if category_for_form[form] >= 4:
md.write("<td>N/A</td>")
else:
hexa = form + (category_for_form[form] << 2)
category_for_form[form] += 1
md.write("<td>0x%01X</td>" % hexa)
md.write(serializeValue(knownTables[name]["value"], False, False))
md.write("</tr>");
break
value_index += 1

md.write("</table>");
md.write('<figcaption>Operators values for each category.</figcaption>')
md.write('<figcaption>Operators values for each category.<br/>The second column provides a 4bits encoding of the categories<br/>where the 2 least significant bits encodes the form infix (0), prefix (1) and postfix (2).</figcaption>')
md.write('</figure>')

print("done.");
Expand Down

0 comments on commit aaeeaef

Please sign in to comment.