Add syntax highlighting for SELinux kernel policy language

Authored by nibags on Aug 31 2018, 1:14 PM.


Add syntax highlighting for SELinux kernel policy language

This corresponds to the standard policy language of SELinux [1], used for example, by the SELinux Reference Policy [2] or the Android policies [3][4].

Extensions and files to highlight:

  • SELinux Type Enforcement (*.te)
  • SELinux Interface File (*.if)
  • M 4 Macros of Reference Policy (*.spt)
  • Some policy build files and policy config. files (access_vectors, mls, mcs, mls_macros, te_macros, policy_capabilities, seapp_contexts, port_contexts), and monolithic policy (policy.conf). NOTE: I added only relevant configuration files and policy building, since many have very generic names.

Also, this file contains common rules and keywords between selinux-fc.xml and selinux-cil.xml. For example, it contains the RegExp highlighting and the Permissions keywords. The idea is to avoid having repeated keywords and rules between the SELinux highlighting files.

[1] SELinux Wiki. PolicyLanguage:
[2] SELinux Reference Policy:
[3] Security-Enhanced Linux in Android:
[4] SELinux policy configuration for AOSP:

Reviewers: Framework: Syntax Highlighting, dhaumann, cullmann

Reviewed By: Framework: Syntax Highlighting, cullmann

Subscribers: kwrite-devel, kde-frameworks-devel

Tags: Kate, Frameworks

Differential Revision: