authorgravatar for squeek502@hotmail.comRyan Liptak <squeek502@hotmail.com> 2026-10-20 14:43:03-07:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-10-22 12:21:43+02:00
loga071b0e6d2b1f09d2292d719c33b0b1ee91f0918
tree00d44269681fc8996dce7a8e8129297ff3fb2882
parentf98866c02c8e93eb5b3597b56a5dae475b21740d

langref: simplify precedence tables

The details about which operators are ambiguous with which other operators are superfluous and get in the way of what these tables are meant to convey.

1 files changed, 7 insertions(+), 28 deletions(-)

doc/langref.html.in+7-28
......@@ -1923,49 +1923,28 @@ x{}
19231923 as have the operators with higher precedence (those shown above).
19241924 </p>
19251925
1926 <details style="display:none;" id="ambig-details">
1927 <summary style="cursor:pointer;">Toggle operator precedence ambiguity details</summary>
1928 <p>
1929 The operators that look <span class="ambig-chain">like this</span> have ambiguous precedence with the other operators
1930 on the same line. Those that look <span class="ambig-nonchain">like this</span> also have ambiguous
1931 precedence with themselves (they cannot be chained).
1932 </p>
1933 </details>
1934
1935 <script>
1936 let ambig_details = document.getElementById("ambig-details");
1937 ambig_details.style.display = 'block';
1938 ambig_details.addEventListener("toggle", (event) => {
1939 document.querySelectorAll('.ambig-chain').forEach(e => { e.classList.toggle('tok-number'); });
1940 document.querySelectorAll('.ambig-nonchain').forEach(e => {
1941 e.classList.toggle('tok-number');
1942 e.style.borderBottom = ambig_details.open ? '1px dotted' : '';
1943 });
1944 });
1945 </script>
1946
19471926 <p>
19481927 For arithmetic operators:
19491928 </p>
19501929
1951 <pre><code>* / *% *| <span class="ambig-nonchain">%</span>
1930 <pre>{#syntax#}* / *% *| %
19521931+ - +% -% +| -|
1953<span class="ambig-nonchain">==</span> <span class="ambig-nonchain">!=</span> <span class="ambig-nonchain">&lt;</span> <span class="ambig-nonchain">></span> <span class="ambig-nonchain">&lt;=</span> <span class="ambig-nonchain">>=</span>
1954<span class="ambig-chain">and or</span></code></pre>
1932== != < > <= >=
1933and or{#endsyntax#}</pre>
19551934
19561935 <p>
19571936 For bitwise operators:
19581937 </p>
19591938
1960 <pre><code><span class="ambig-nonchain">&lt;&lt;</span> <span class="ambig-nonchain">&lt;&lt;|</span> <span class="ambig-nonchain">>></span> <span class="ambig-chain">& ^ |</span>
1961<span class="ambig-nonchain">==</span> <span class="ambig-nonchain">!=</span> <span class="ambig-nonchain">&lt;</span> <span class="ambig-nonchain">></span> <span class="ambig-nonchain">&lt;=</span> <span class="ambig-nonchain">>=</span>
1962<span class="ambig-chain">and or</span></code></pre>
1939 <pre>{#syntax#}<< <<| >> & ^ |
1940== != < > <= >=
1941and or{#endsyntax#}</pre>
19631942
19641943 <p>
19651944 For null and error recovery operators:
19661945 </p>
19671946
1968 <pre><code><span class="ambig-chain">catch orelse</span></code></pre>
1947 <pre>{#syntax#}catch orelse{#endsyntax#}</pre>
19691948
19701949 <p>
19711950 For error set operators: