<table><tr><td style="">nibags created this revision.<br />Restricted Application added projects: Kate, Frameworks.<br />Restricted Application added subscribers: kde-frameworks-devel, kwrite-devel.<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/D14526">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>I have updated and checked the syntax highlighting of AppArmor with various improvements.</p>

<p>Changes in AppArmor:</p>

<ul class="remarkup-list">
<li class="remarkup-list-item"><strong>AppArmor 2.13</strong>: adds "if exists" in Include rules. Ex: <tt style="background: #ebebeb; font-size: 13px;">#include if exists <path></tt>. Previously, the text after "include" was highlighted as "Error", that is corrected.</li>
<li class="remarkup-list-item">Fix: allow spaces in relative paths, in Include rules.</li>
<li class="remarkup-list-item">Fix escape characters: add decimals (<tt style="background: #ebebeb; font-size: 13px;">\dNNN</tt>) and only valid octales are highlighted (the maximum value is <tt style="background: #ebebeb; font-size: 13px;">\400</tt>). Any character is also highlighted as escape (literal characters). Before, only special characters are highlighted.</li>
<li class="remarkup-list-item">Improves the detection of paths that start with a variable. For example, when writing a variable and then a non-ASCII character, it is highlighted as path (Ex: <tt style="background: #ebebeb; font-size: 13px;">@{VAR}ñpath*</tt>).</li>
<li class="remarkup-list-item">Improve variable assignment lines:<ul class="remarkup-list">
<li class="remarkup-list-item">Add line continuation escape.</li>
<li class="remarkup-list-item">Allow assignment (<tt style="background: #ebebeb; font-size: 13px;">=</tt> or <tt style="background: #ebebeb; font-size: 13px;">+=</tt>) in a new line.</li>
<li class="remarkup-list-item">Removes unnecessary rules in <tt style="background: #ebebeb; font-size: 13px;">_variable_assignment_line_content</tt> context. Now the entire line is highlighted as path.</li>
</ul></li>
<li class="remarkup-list-item">Improve the highlighting of Hats/Sub-profiles (<tt style="background: #ebebeb; font-size: 13px;">name//HAT</tt>). Add hats in quoted paths and transition profile names (before it was only highlighted in paths). The itemData "SubProfile" changes to "SubProfile/Hat".</li>
<li class="remarkup-list-item">Improve comments: underlines URLs and e-mails.</li>
<li class="remarkup-list-item">Add extensions <tt style="background: #ebebeb; font-size: 13px;">snap.*</tt>, <tt style="background: #ebebeb; font-size: 13px;">snap-update-ns.*</tt> & <tt style="background: #ebebeb; font-size: 13px;">snap-confine.*</tt> (these are the prefixes of the AppArmor profiles for the Snap packages. Some are located in "/var/lib/snapd/apparmor").</li>
<li class="remarkup-list-item">Add some filesystems, new abstractions and "xattrs" flag (keywords).</li>
<li class="remarkup-list-item">Add paths that start with namespaces: <tt style="background: #ebebeb; font-size: 13px;">:namespace:/path</tt>.</li>
<li class="remarkup-list-item">Fixes globbing brackets in quoted text. Now the bracket content allows spaces and line breaks.</li>
<li class="remarkup-list-item">Fix the escape of "/" in profile name and transition profile name (before, it is highlighted as path).</li>
<li class="remarkup-list-item">Simplifies the closing of rules (comma of end of rules).</li>
<li class="remarkup-list-item">The code to detect variables & booleans is simplified.</li>
<li class="remarkup-list-item">Fix booleans: true & false keywords are insensitive; booleans will not be highlighted within rules.</li>
<li class="remarkup-list-item">The operators "in" & "to" are put in a different context (<tt style="background: #ebebeb; font-size: 13px;">_operators_keywords</tt>). Now these are only highlighted within the AppArmor-rules.</li>
<li class="remarkup-list-item">Removes unnecessary RegExpr rules in the path detection. Now only the "/" character marks the beginning of a path.</li>
<li class="remarkup-list-item">The special character "^" is only highlighted at the beginning of the square bracket. Ex: <tt style="background: #ebebeb; font-size: 13px;">[^ ...]</tt></li>
<li class="remarkup-list-item">Improves the highlighting of numerical units in rlimit rules (a word boundary is added at the beginning if there is no number before).</li>
<li class="remarkup-list-item">Unnecessary attributes are deleted in <tt style="background: #ebebeb; font-size: 13px;">ItemData</tt>'s (Ex: underline=0, italic=0)</li>
<li class="remarkup-list-item">Some itemData have bad names ("Globbing Char 1", "Globbing Char 2", "Globbing Char 3"), so these change their name.</li>
<li class="remarkup-list-item">Globbing brackets change in style, from "dsSpecialString" to "dsVerbatimString", since in the "Normal" scheme the red color is more discreet than the orange color.</li>
<li class="remarkup-list-item">Removes unnecessary <tt style="background: #ebebeb; font-size: 13px;">insensitive</tt> attributes in some rules.</li>
</ul>

<p>In the file I also made some minor modifications to order the code and it is less chaotic, since the file is very large. <br />
I have tested the file enough and I can say that it works well.</p>

<p>Any inconvenience (such as adding extensions) do not hesitate to notify!</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R216 Syntax Highlighting</div></div></div><br /><div><strong>BRANCH</strong><div><div>update-apparmor</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D14526">https://phabricator.kde.org/D14526</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>autotests/folding/usr.bin.apparmor-profile-test.fold<br />
autotests/html/usr.bin.apparmor-profile-test.html<br />
autotests/input/usr.bin.apparmor-profile-test<br />
autotests/reference/usr.bin.apparmor-profile-test.ref<br />
data/syntax/apparmor.xml</div></div></div><br /><div><strong>To: </strong>nibags<br /><strong>Cc: </strong>kwrite-devel, kde-frameworks-devel, michaelh, kevinapavew, ngraham, bruns, demsking, cullmann, sars, dhaumann<br /></div>