<table><tr><td style="">nibags retitled this revision from "Optimize AppArmor & SELinux highlighting and improve regex" to "AppArmor: update syntax and various improvements/fixes".<br />nibags edited the summary of this revision. <a href="https://phabricator.kde.org/transactions/detail/PHID-XACT-DREV-3ll3sxsgjrqq6ey/">(Show Details)</a><br />nibags added a reviewer: Framework: Syntax Highlighting.<br />nibags changed the visibility from "No One" to "All Users".<br />nibags changed the edit policy from "No One" to "All Users".<br />Restricted Application added subscribers: kde-frameworks-devel, kwrite-devel.
</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/D11945">View Revision</a></tr></table><br /><div><strong>CHANGES TO REVISION SUMMARY</strong><div><div style="white-space: pre-wrap; color: #74777D;"><span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">Some optimizations are made (some suggested from D10621) and other improvements, such as:</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">I have updated and checked the syntax highlighting of AppArmor with various improvements. I decided to do it in this old diff (changes to SELinux are no longer included, I prefer to do it in the future).<br />
<br />
Changes in AppArmor:<br />
* **AppArmor 2.13**: adds "if exists" in Include rules. Ex: `#include if exists <path>`. Previously, the text after "include" was highlighted as "Error", that is corrected.<br />
* Fix: allow spaces in relative paths, in Include rules.<br />
* Fix escape characters: add decimals (`\dNNN`) and only valid octales are highlighted (the maximum value is `\400`). Any character is also highlighted as escape (literal characters). Before, only special characters are highlighted.<br />
* 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: `@{VAR}ñpath*`).<br />
* Improve variable assignment lines:<br />
* Add line continuation escape.<br />
* Allow assignment (`=` or `+=`) in a new line.<br />
* Removes unnecessary rules in `_variable_assignment_line_content` context. Now the entire line is highlighted as path.<br />
* Improve the highlighting of Hats/Sub-profiles (`name//HAT`). Add hats in quoted paths and transition profile names (before it was only highlighted in paths). The itemData "SubProfile" changes to "SubProfile/Hat".<br />
* Improve comments: underlines URLs and e-mails.<br />
* Add extensions `snap.*`, `snap-update-ns.*` & `snap-confine.*` (these are the prefixes of the AppArmor profiles for the Snap packages. Some are located in "/var/lib/snapd/apparmor").<br />
* Add some filesystems, new abstractions and "xattrs" flag (keywords).<br />
* Add paths that start with namespaces: `:namespace:/path`.<br />
* Fixes globbing brackets in quoted text. Now the bracket content allows spaces and line breaks.<br />
* Fix the escape of "/" in profile name and transition profile name (before, it is highlighted as path).<br />
* Simplifies the closing of rules (comma of end of rules).<br />
* The code to detect variables & booleans is simplified.<br />
* Fix booleans: true & false keywords are insensitive; booleans will not be highlighted within rules.<br />
* The operators "in" & "to" are put in a different context (`_operators_keywords`). Now these are only highlighted within the AppArmor-rules.<br />
* Removes unnecessary RegExpr rules in the path detection. Now only the "/" character marks the beginning of a path.<br />
* The special character "^" is only highlighted at the beginning of the square bracket. Ex: `[^ ...]`<br />
* Improves the highlighting of numerical units in rlimit rules (a word boundary is added at the beginning if there is no number before).<br />
* Unnecessary attributes are deleted in `ItemData`'s (Ex: underline=0, italic=0)<br />
* Some itemData have bad names ("Globbing Char 1", "Globbing Char 2", "Globbing Char 3"), so these change their name.<br />
* Globbing brackets change in style, from "dsSpecialString" to "dsVerbatimString", since in the "Normal" scheme the red color is more discreet than the orange color.<br />
* Removes unnecessary `insensitive` attributes in some rules.<br />
<br />
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.<br />
<br />
Any inconvenience (such as adding extensions) do not hesitate to notify!</span><br />
<br />
<span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">---<br />
**Old diff:**<br />
</span>AppArmor:<div style="padding: 8px 0;">...</div>* Improvements in the Boolean assignment (for future versions of AppArmor).<br />
<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);"><br />
</span>SELinux:<div style="padding: 8px 0;">...</div></div></div></div><br /><div><strong>REPOSITORY</strong><div><div>R216 Syntax Highlighting</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D11945">https://phabricator.kde.org/D11945</a></div></div><br /><div><strong>To: </strong>nibags, dhaumann, Framework: Syntax Highlighting<br /><strong>Cc: </strong>kwrite-devel, kde-frameworks-devel, michaelh, genethomas, kevinapavew, ngraham, bruns, demsking, cullmann, vkrause, sars, dhaumann<br /></div>