<table><tr><td style="">nibags created this revision.<br />Restricted Application added a project: Frameworks.<br />Restricted Application added a subscriber: Frameworks.<br />nibags requested review of this revision.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D10783" rel="noreferrer">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>Hi<br />
The Yacc/Bison file highlights as 'dsError' the '$' symbol (it is used as pseudo-variable). The problem comes from the 'isocpp.xml' file of C++, which highlights it as 'Error' (probably, this was added to the C++ file later).<br />
data/syntax/yacc.xml (lines 131 & 132):</p>

<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);">131|      <IncludeRules context="##C++" />
132|      <DetectChar attribute="Directive" context="Dol" char="$" />
133|  </context></pre></div>

<p>autotests/reference/highlight.y.ref :</p>

<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);">35|  […] <Symbol>(</Symbol><Error>$</Error><Deimal>2</Decimal><Symbol>) [...]
40|  <Normal Text> </Normal Text><Error>$$</Error><Normal Text> </Normal Text> […]</pre></div>

<p>That is corrected. Also, this file is outdated for Bison. Therefore, it is updated according to the parser of the latest version of Bison (3.0.4).</p>

<p>Changes/fixes for Bison:</p>

<ul class="remarkup-list">
<li class="remarkup-list-item">Add declarations that contain blocks of code that are not currently highlighted. For example: %code { C++ code... } %destructor { C++ code, with symbols $… } %initial-action { C++ code, with symbols $… }</li>
<li class="remarkup-list-item">Add the Bison variable '@' (@$, <span class="phabricator-remarkup-mention-unknown">@n</span>, @[name], $<span class="phabricator-remarkup-mention-unknown">@n</span>).</li>
<li class="remarkup-list-item">Add directives in rules: %?{ expr…},  %empty, %prec, %dprec and %merge.</li>
<li class="remarkup-list-item">Allow a tag in %union declarations. Ex: %union tag { code … }</li>
<li class="remarkup-list-item">Allow grammar declarations in the grammar rules section, such as: %union, %code, %type, etc.</li>
<li class="remarkup-list-item">Allow declarations in multiple lines. Ex: %token PERCENT_DEBUG           "%debug" PERCENT_DEFAULT_PREC    "%default-prec" ;</li>
<li class="remarkup-list-item">The ';' char is not necessary to finish a rule. Allow ';' followed by ‘|’, within a rule (See line 603 in the “src/parse-gram.y” file, from the Bison 3.0.4 source [2]).</li>
<li class="remarkup-list-item">Add the mimetypes (text/x-yacc, text/x-bison) and the extensions '.ypp' & '.y++' [3].</li>
</ul>

<p>I hope these changes are useful. <br />
Any inconvenience (as if it is necessary to contact the original author of the file to approve the changes), do not hesitate to notify.</p>

<p>Source: <br />
[1] <a href="https://www.gnu.org/software/bison/manual/html_node/Table-of-Symbols.html" class="remarkup-link" target="_blank" rel="noreferrer">https://www.gnu.org/software/bison/manual/html_node/Table-of-Symbols.html</a><br />
[2] <a href="https://ftp.gnu.org/gnu/bison/bison-3.0.4.tar.xz" class="remarkup-link" target="_blank" rel="noreferrer">https://ftp.gnu.org/gnu/bison/bison-3.0.4.tar.xz</a> ( ./src/parse-gram.y )<br />
[3] <a href="https://www.gnu.org/software/bison/manual/html_node/Invocation.html" class="remarkup-link" target="_blank" rel="noreferrer">https://www.gnu.org/software/bison/manual/html_node/Invocation.html</a></p></div></div><br /><div><strong>TEST PLAN</strong><div><p>I've been testing these changes the last week and I think it's ready.</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R216 Syntax Highlighting</div></div></div><br /><div><strong>BRANCH</strong><div><div>update-yacc-bison (branched from master)</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D10783" rel="noreferrer">https://phabricator.kde.org/D10783</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>autotests/folding/highlight.y.fold<br />
autotests/html/highlight.y.html<br />
autotests/input/highlight.y<br />
autotests/reference/highlight.y.ref<br />
data/syntax/yacc.xml</div></div></div><br /><div><strong>To: </strong>nibags<br /><strong>Cc: </strong>Frameworks, michaelh<br /></div>