Changeset View
Changeset View
Standalone View
Standalone View
data/syntax/selinux-fc.xml
1 | <?xml version="1.0" encoding="UTF-8"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
---|---|---|---|---|---|
2 | <!DOCTYPE language SYSTEM "language.dtd" | 2 | <!DOCTYPE language SYSTEM "language.dtd" | ||
3 | [ | 3 | [ | ||
4 | <!ENTITY symbol "\w\[\]\.@\=\*\-$%\+!\|&\^~\{\}<>\?\\"> <!-- [].@=*-$%+!|&^~#{}<>?\ --> | 4 | <!-- Identifier with M4 Arg. or variables --> | ||
5 | <!ENTITY charIden "(\$[@#]|[\w\-\$\*\{\}%])"> | ||||
6 | <!ENTITY simpleIdentifier "(\$[@#]|[a-zA-Z\$%])&charIden;*"> | ||||
7 | <!ENTITY identifier "&simpleIdentifier;(\.?&charIden;)*"> | ||||
8 | <!ENTITY startIdentifier "(\b[a-zA-Z]|\$[@#]|[\$%])&charIden;*(\.?&charIden;)*"> | ||||
9 | <!ENTITY mlsLevel "&identifier;(\s*:\s*&identifier;(\s*,\s*&identifier;)*)?"> | ||||
5 | ]> | 10 | ]> | ||
6 | 11 | | |||
7 | <!-- | 12 | <!-- | ||
8 | SELinux File Contexts (File Labeling Policy) Syntax Highlighting Definition | 13 | SELinux File Contexts Syntax Highlighting Definition for Kate | ||
9 | for the KDE's KSyntaxHighlighting Framework. | | |||
10 | ========================================================================================== | 14 | ========================================================================================== | ||
15 | This file is part of the KDE's KSyntaxHighlighting framework. | ||||
16 | | ||||
11 | Copyright (c) 2018 Nibaldo González S. (nibgonz@gmail.com) | 17 | Copyright (c) 2018 Nibaldo González S. (nibgonz@gmail.com) | ||
12 | 18 | | |||
13 | Permission is hereby granted, free of charge, to any person obtaining a copy of this | 19 | Permission is hereby granted, free of charge, to any person obtaining a copy of this | ||
14 | software and associated documentation files (the "Software"), to deal in the Software | 20 | software and associated documentation files (the "Software"), to deal in the Software | ||
15 | without restriction, including without limitation the rights to use, copy, modify, merge, | 21 | without restriction, including without limitation the rights to use, copy, modify, merge, | ||
16 | publish, distribute, sublicense, and/or sell copies of the Software, and to permit | 22 | publish, distribute, sublicense, and/or sell copies of the Software, and to permit | ||
17 | persons to whom the Software is furnished to do so, subject to the following conditions: | 23 | persons to whom the Software is furnished to do so, subject to the following conditions: | ||
18 | 24 | | |||
19 | The above copyright notice and this permission notice shall be included | 25 | The above copyright notice and this permission notice shall be included | ||
20 | in all copies or substantial portions of the Software. | 26 | in all copies or substantial portions of the Software. | ||
21 | 27 | | |||
22 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, | 28 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, | ||
23 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A | 29 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A | ||
24 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | 30 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
25 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN | 31 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN | ||
26 | AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 32 | AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
27 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 33 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
28 | ========================================================================================== | 34 | ========================================================================================== | ||
29 | 35 | | |||
36 | SELinux policy files with definitions of file contexts: | ||||
37 | - Labeling Policy Files: *.fc | ||||
38 | - Policy Config. Files: file_contexts, file_contexts_*, file_contexts.local, | ||||
39 | file_contexts.homedirs, file_contexts.template, homedir_template | ||||
40 | - SE for Android Policy Config. Files: service_contexts, property_contexts, | ||||
41 | hwservice_contexts | ||||
42 | - Policy Build Files: initial_sid_contexts, genfs_contexts, fs_use | ||||
43 | | ||||
30 | Change log: | 44 | Change log: | ||
45 | * Version 2 [28-Aug-2018]: | ||||
46 | - Some improvements. RegExp and some rules are moved to "selinux.xml". | ||||
47 | - Add statements keywords that use file contexts. | ||||
31 | * Version 1 [26-Jan-2018, by Nibaldo González]: | 48 | * Version 1 [26-Jan-2018, by Nibaldo González]: | ||
32 | - Initial version. | 49 | - Initial version. | ||
33 | --> | 50 | --> | ||
34 | 51 | | |||
35 | <language name="SELinux File Contexts" | 52 | <language name="SELinux File Contexts" | ||
36 | version="1" | 53 | version="2" | ||
37 | kateversion="5.0" | 54 | kateversion="5.0" | ||
38 | section="Other" | 55 | section="Other" | ||
39 | extensions="*.fc;file_contexts;file_contexts.local;file_contexts.homedirs;file_contexts.template;homedir_template" | 56 | extensions="*.fc;file_contexts;file_contexts_*;file_contexts.local;file_contexts.homedirs;file_contexts.template;homedir_template;property_contexts;service_contexts;hwservice_contexts;initial_sid_contexts;genfs_contexts;fs_use" | ||
40 | priority="6" | 57 | priority="3" | ||
41 | mimetype="" | 58 | mimetype="" | ||
42 | author="Nibaldo González (nibgonz@gmail.com)" | 59 | author="Nibaldo González (nibgonz@gmail.com)" | ||
43 | license="MIT"> | 60 | license="MIT"> | ||
44 | 61 | | |||
45 | <highlighting> | 62 | <highlighting> | ||
46 | 63 | | |||
47 | <list name="keywords"> | | |||
48 | <item>gen_context</item> | | |||
49 | <item>ifdef</item> | | |||
50 | <item>define</item> | | |||
51 | </list> | | |||
52 | | ||||
53 | <contexts> | 64 | <contexts> | ||
54 | 65 | | |||
55 | <context name="_normal" attribute="Normal Text" lineEndContext="#stay"> | 66 | <context name="_normal" attribute="Normal Text" lineEndContext="#stay"> | ||
56 | <DetectChar context="_comment" attribute="Comment" char="#"/> | 67 | <IncludeRules context="_m4_preprocessor##SELinux Policy"/> | ||
57 | <RegExpr context="#stay" attribute="File Type" String="(\s|^)\-[bcdpls\-](?=(\s|$))"/> | 68 | <IncludeRules context="_find_comments##SELinux Policy"/> | ||
69 | <RegExpr context="#stay" attribute="File Type" String="(\s|^)\-[bcdpls\-](?=\s|$)"/> | ||||
58 | 70 | | |||
59 | <RegExpr context="_path_content" attribute="Path" String="/(?![\s/'])" insensitive="true"/> | 71 | <DetectChar context="_path_content" attribute="Path" char="/"/> | ||
60 | <RegExpr context="#stay" attribute="Path" String="/(?=(\s|$))"/> | | |||
61 | <DetectChar context="_quoted" attribute="Text Quoted" char="""/> | 72 | <DetectChar context="_quoted" attribute="Text Quoted" char="""/> | ||
62 | <DetectChar context="_content_quoted" attribute="Text Quoted" char="`"/> | | |||
63 | 73 | | |||
64 | <!-- File Contexts: user:role:type:s0 --> | 74 | <!-- Content Quoted (M4). | ||
65 | <RegExpr context="_fc_user" attribute="User" String="\b[&symbol;,]+(?=(:[&symbol;,]+){2}(:[&symbol;,]+)*\b)"/> | 75 | NOTE: The default quotes (`text') are highlighted, | ||
76 | but another type of quotation mark can be used. --> | ||||
77 | <IncludeRules context="_m4_string_simple##SELinux Policy"/> <!-- `simple text' --> | ||||
78 | <IncludeRules context="_m4_quotes##SELinux Policy"/> | ||||
66 | 79 | | |||
67 | <DetectChar context="_parentheses_content" attribute="Normal Text" char="(" beginRegion="Parentheses Block"/> | 80 | <!-- File Contexts: user:role:type:s0:c0 --> | ||
81 | <RegExpr context="_fc_user" attribute="User" String="&startIdentifier;(?=(\s*:\s*&identifier;){2}(\s*:\s*&mlsLevel;(\s*\-\s*&mlsLevel;)?)?\b)"/> | ||||
68 | <WordDetect context="#stay" attribute="Other Keywords" String="<<none>>"/> | 82 | <WordDetect context="#stay" attribute="Other Keywords" String="<<none>>"/> | ||
69 | <HlCStringChar context="#stay" attribute="Escape Expression"/> | 83 | | ||
70 | <DetectChar context="#stay" attribute="Special Char" char="*"/> | 84 | <!-- Java-Language-Style Package Name & other Names, for SE Android (this avoid highlighting keywords) --> | ||
71 | <keyword context="#stay" attribute="Keywords" String="keywords"/> | 85 | <RegExpr context="#stay" attribute="Path" String="\.?[a-zA-Z]\w*((\.|::)\w+)+(?=[^\(]|$)" firstNonSpace="true"/> | ||
72 | <RegExpr context="#stay" attribute="Keywords" String="\b[&symbol;]+(?=\()"/> | 86 | | ||
73 | 87 | <!-- Functions --> | |||
74 | <RegExpr context="_path_content" attribute="Variable" String="\bHOME_(DIR|ROOT)"/> <!-- Default Variables --> | 88 | <DetectChar context="_parentheses_content" attribute="Normal Text" char="(" beginRegion="ParenthesesBlock"/> | ||
75 | <RegExpr context="_path_content" attribute="Path" String="\b[&symbol;,]+[/\\\*\?\[\{]" insensitive="true" lookAhead="true" firstNonSpace="true"/> | 89 | <IncludeRules context="_refpolicy_keywords_fc##SELinux Policy"/> | ||
76 | <Detect2Chars context="_path_content" attribute="Variable" char="%" char1="{" lookAhead="true"/> | 90 | <IncludeRules context="_m4_builtin_keywords##SELinux Policy"/> | ||
91 | <RegExpr context="#stay" attribute="Function" String="\b[a-zA-Z][\w\-]*(?=\()"/> | ||||
92 | | ||||
93 | <IncludeRules context="_m4_special_arguments##SELinux Policy"/> | ||||
94 | <IncludeRules context="_common_special_char##SELinux Policy"/> | ||||
95 | <IncludeRules context="_line_continue_escape##SELinux Policy"/> | ||||
96 | | ||||
97 | <!-- Default Variables --> | ||||
98 | <StringDetect context="_path_content" attribute="Variable" String="HOME_DIR"/> | ||||
99 | <StringDetect context="_path_content" attribute="Variable" String="HOME_ROOT"/> | ||||
100 | | ||||
101 | <DetectChar context="_path_content" attribute="Path" char="[" lookAhead="true"/> | ||||
102 | <Detect2Chars context="_path_content" char="%" char1="{" lookAhead="true"/> | ||||
103 | <RegExpr context="_path_content" attribute="Path" String="\b[\w\[\]\.@\=\*\-\$%\+!\|&\^~\{\}<>\?\\,]+[/\\\*\?\[\{]" lookAhead="true" firstNonSpace="true"/> | ||||
104 | | ||||
105 | <DetectChar context="#stay" attribute="Symbol" char="{" beginRegion="Bracket"/> | ||||
106 | <DetectChar context="#stay" attribute="Symbol" char="}" endRegion="Bracket"/> | ||||
107 | <AnyChar context="#stay" attribute="Symbol" String=",;~[]"/> | ||||
108 | | ||||
109 | <!-- Highlight only the statements that contain definition of file contexts --> | ||||
110 | <IncludeRules context="_statements_file_contexts##SELinux Policy"/> | ||||
111 | <RegExpr context="#stay" String="[a-zA-Z](\.?[\w\-]+)*"/> | ||||
112 | <HlCHex context="#pop" attribute="Number"/> | ||||
113 | <Int context="#pop" attribute="Number"/> | ||||
77 | </context> | 114 | </context> | ||
78 | 115 | | |||
79 | <context name="_parentheses_content" attribute="Normal Text" lineEndContext="#stay"> | 116 | <context name="_parentheses_content" attribute="Normal Text" lineEndContext="#stay"> | ||
80 | <DetectChar context="#pop" attribute="Normal Text" char=")" endRegion="Parentheses Block"/> | 117 | <DetectChar context="#pop" attribute="Normal Text" char=")" endRegion="ParenthesesBlock"/> | ||
81 | 118 | <!-- File Contexts: (user:role:type,s0) --> | |||
82 | <!-- File Contexts: (user:role:type,s0,c0) --> | 119 | <RegExpr context="_gen_context_fc_user" attribute="User" String="&startIdentifier;(\s*:\s*&identifier;){2}(\s*,\s*&identifier;)*\b" lookAhead="true"/> | ||
83 | <RegExpr context="_fc_user" attribute="User" String="\b[&symbol;]+(?=(:[&symbol;]+){2}(\s*,\s*[&symbol;]+)*\b)"/> | | |||
84 | | ||||
85 | <IncludeRules context="_normal"/> | 120 | <IncludeRules context="_normal"/> | ||
86 | <RegExpr context="#stay" attribute="Level" String="\b([sc]\d+[\-\.])?m[lc]s_[\w\-\.]+\b"/> | | |||
87 | <RegExpr context="#stay" attribute="Level" String="\bs\d+([\-\.]s\d+)*\b"/> | | |||
88 | <RegExpr context="#stay" attribute="Level" String="\bc\d+([\-\.]c\d+)*\b"/> | | |||
89 | </context> | 121 | </context> | ||
90 | 122 | | |||
91 | <context name="_comment" attribute="Comment" lineEndContext="#pop"> | | |||
92 | <LineContinue context="#pop" attribute="Comment"/> | | |||
93 | <DetectSpaces /> | | |||
94 | <IncludeRules context="##Alerts"/> | | |||
95 | <IncludeRules context="##Modelines"/> | | |||
96 | </context> | | |||
97 | <context name="_path_content" attribute="Path" lineEndContext="#pop"> | 123 | <context name="_path_content" attribute="Path" lineEndContext="#pop"> | ||
98 | <DetectSpaces context="#pop" attribute="Normal Text" lookAhead="true"/> | 124 | <DetectSpaces context="#pop" lookAhead="true"/> | ||
99 | <DetectChar context="#pop" attribute="Normal Text" char="'" lookAhead="true"/> | 125 | <IncludeRules context="_regex##SELinux Policy"/> | ||
100 | <IncludeRules context="_patterns"/> | | |||
101 | <IncludeRules context="_variable"/> | 126 | <IncludeRules context="_variable"/> | ||
102 | </context> | 127 | </context> | ||
103 | <context name="_content_quoted" attribute="Text Quoted" lineEndContext="#stay"> | 128 | <context name="_quoted" attribute="Text Quoted" lineEndContext="#pop"> | ||
104 | <DetectChar context="#pop" attribute="Text Quoted" char="'"/> | | |||
105 | <IncludeRules context="_normal"/> | | |||
106 | </context> | | |||
107 | <context name="_quoted" attribute="Text Quoted" lineEndContext="#stay"> | | |||
108 | <DetectChar context="#pop" attribute="Text Quoted" char="""/> | 129 | <DetectChar context="#pop" attribute="Text Quoted" char="""/> | ||
109 | <IncludeRules context="_patterns"/> | 130 | <IncludeRules context="_m4_special_arguments##SELinux Policy"/> | ||
110 | <IncludeRules context="_variable"/> | 131 | <IncludeRules context="_other_variable"/> | ||
132 | <IncludeRules context="_regex_quoted##SELinux Policy"/> | ||||
133 | <RegExpr context="#stay" attribute="Text Quoted Open" String="[^\s"\[\(\\](?=\s*$)"/> | ||||
111 | </context> | 134 | </context> | ||
135 | | ||||
136 | <!-- Variables of "file_contexts", M4 & Refpolicy --> | ||||
112 | <context name="_variable" attribute="Normal Text" lineEndContext="#stay"> | 137 | <context name="_variable" attribute="Normal Text" lineEndContext="#stay"> | ||
113 | <RegExpr context="#stay" attribute="Variable" String="%\{[a-zA-Z]\w*\}"/> | 138 | <WordDetect context="#stay" attribute="Variable" String="HOME_DIR"/> | ||
139 | <WordDetect context="#stay" attribute="Variable" String="HOME_ROOT"/> | ||||
140 | <StringDetect context="#stay" attribute="Variable" String="USER"/> | ||||
141 | <StringDetect context="#stay" attribute="Variable" String="ROLE"/> | ||||
142 | <IncludeRules context="_other_variable"/> | ||||
143 | </context> | ||||
144 | <context name="_other_variable" attribute="Normal Text" lineEndContext="#stay"> | ||||
145 | <RegExpr context="#stay" attribute="Variable" String="\%\{[a-zA-Z]\w*\}"/> | ||||
146 | </context> | ||||
147 | <context name="_fc_variable" attribute="Path" lineEndContext="#pop"> | ||||
148 | <IncludeRules context="_m4_special_arguments##SELinux Policy"/> | ||||
149 | <IncludeRules context="_other_variable"/> | ||||
114 | </context> | 150 | </context> | ||
115 | 151 | | |||
116 | <!-- SELinux Security Contexts --> | 152 | <!-- SELinux Security Contexts --> | ||
153 | | ||||
154 | <!-- User --> | ||||
117 | <context name="_fc_user" attribute="User" lineEndContext="#pop"> | 155 | <context name="_fc_user" attribute="User" lineEndContext="#pop"> | ||
118 | <DetectChar context="#pop!_fc_role" attribute="Normal Text" char=":"/> | 156 | <DetectChar context="#pop!_fc_role" attribute="Normal Text" char=":"/> | ||
119 | <DetectSpaces context="#pop" attribute="Normal Text" lookAhead="true"/> | | |||
120 | </context> | 157 | </context> | ||
158 | <!-- Role --> | ||||
121 | <context name="_fc_role" attribute="Role" lineEndContext="#pop"> | 159 | <context name="_fc_role" attribute="Role" lineEndContext="#pop"> | ||
122 | <DetectChar context="#pop!_fc_type" attribute="Normal Text" char=":"/> | 160 | <DetectChar context="#pop!_fc_type" attribute="Normal Text" char=":"/> | ||
123 | <DetectSpaces context="#pop" attribute="Normal Text" lookAhead="true"/> | | |||
124 | </context> | 161 | </context> | ||
125 | <context name="_fc_type" attribute="Type" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop"> | 162 | <!-- Type Enforcement --> | ||
126 | <RegExpr context="#pop!_fc_level" attribute="Type" String="[&symbol;,]+(?=:[&symbol;,])"/> | 163 | <context name="_fc_type" attribute="Type Enforcement" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop!_after_fc"> | ||
127 | <RegExpr context="#pop!_fc_level_parentheses" attribute="Type" String="[&symbol;]+(?=\s*,\s*[&symbol;])"/> | 164 | <RegExpr context="#pop!_fc_mls" attribute="Type Enforcement" String="\s*&identifier;(?=\s*:\s*&mlsLevel;)"/> <!-- Find MLS/MCS --> | ||
128 | <RegExpr context="#pop" attribute="Type" String="[&symbol;]+"/> | 165 | <RegExpr context="#pop" attribute="Type Enforcement" String="\s*&identifier;"/> | ||
129 | </context> | 166 | </context> | ||
130 | <context name="_fc_level" attribute="Level" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop"> | 167 | | ||
131 | <RegExpr context="#stay" attribute="Level" String="[&symbol;,]+"/> | 168 | <!-- Start MLS/MCS --> | ||
132 | <RegExpr context="#stay" attribute="Normal Text" String=":(?=[&symbol;,])"/> | 169 | <context name="_fc_mls" attribute="MLS/MCS Level" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop!_after_fc"> | ||
133 | </context> | 170 | <DetectChar context="#pop!_fc_find_level_range" attribute="Normal Text" char=":"/> | ||
134 | <context name="_fc_level_parentheses" attribute="Level" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop"> | 171 | <DetectSpaces context="#stay" attribute="Normal Text"/> | ||
135 | <RegExpr context="#stay" attribute="Level" String="[&symbol;]+"/> | 172 | </context> | ||
136 | <RegExpr context="#stay" attribute="Normal Text" String="\s*,\s*(?=[&symbol;])"/> | 173 | <context name="_fc_find_level_range" attribute="MLS/MCS Level" | ||
137 | </context> | 174 | lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop!_fc_level_range"> | ||
138 | 175 | <DetectSpaces context="#stay" attribute="Normal Text"/> | |||
139 | <!-- Regex (FCGlob?) --> | 176 | </context> | ||
140 | <context name="_patterns" attribute="Normal Text" lineEndContext="#stay"> | 177 | <!-- MLS/MCS Range (Sensitivity:Category - Sensitivity:Category) --> | ||
141 | <IncludeRules context="_escape"/> | 178 | <!-- Sensitivity --> | ||
142 | <DetectChar context="_square_brackets" attribute="Pattern Brackets" char="["/> | 179 | <context name="_fc_level_range" attribute="MLS/MCS Level" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop!_after_fc"> | ||
143 | <DetectChar context="_round_brackets" attribute="Pattern Brackets" char="("/> | 180 | <RegExpr context="#pop!_fc_level_range_cat" attribute="Normal Text" String="\s*:\s*(?=&identifier;)"/> <!-- Find Category --> | ||
144 | <IncludeRules context="_quantification_brackets"/> | 181 | <RegExpr context="#pop!_fc_level" attribute="Normal Text" String="\s*\-\s*(?=&mlsLevel;)"/> <!-- Find Range --> | ||
145 | <IncludeRules context="_special_chars"/> | 182 | <IncludeRules context="_default_level"/> | ||
146 | </context> | 183 | </context> | ||
147 | <context name="_special_chars" attribute="Normal Text" lineEndContext="#stay"> | 184 | <!-- Category --> | ||
148 | <AnyChar context="#stay" attribute="Special Char" String="*?.+"/> | 185 | <context name="_fc_level_range_cat" attribute="MLS/MCS Level" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop!_after_fc"> | ||
149 | </context> | 186 | <RegExpr context="#pop!_fc_level" attribute="Normal Text" String="\s*\-\s*(?=&mlsLevel;)"/> <!-- Find Range --> | ||
150 | <context name="_escape" attribute="Normal Text" lineEndContext="#stay"> | 187 | <RegExpr context="#stay" attribute="Normal Text" String="\s*,\s*(?=&simpleIdentifier;)"/> | ||
151 | <HlCStringChar context="#stay" attribute="Escape Expression"/> | 188 | <IncludeRules context="_default_level"/> | ||
152 | <RegExpr context="#stay" attribute="Escape Expression" String="\\[\ssSdDwWbBAZiIcC\|\.\-\^\?\*\+\(\)\[\]\{\},]"/> | 189 | </context> | ||
153 | </context> | 190 | <!-- MLS/MCS Level (Sensitivity:Category) --> | ||
154 | <context name="_quantification_brackets" attribute="Normal Text" lineEndContext="#stay"> | 191 | <!-- Sensitivity --> | ||
155 | <!-- {n} {min,} {,max} {min,max} --> | 192 | <context name="_fc_level" attribute="MLS/MCS Level" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop!_after_fc"> | ||
156 | <RegExpr context="#stay" attribute="Pattern Brackets" String="\{(\d+(,\d*)?|,\d+)\}"/> | 193 | <RegExpr context="#pop!_fc_level_cat" attribute="Normal Text" String="\s*:\s*(?=&identifier;)"/> <!-- Find Category --> | ||
157 | </context> | 194 | <IncludeRules context="_default_level"/> | ||
158 | <!-- Groups: [ ] and ( ) --> | 195 | </context> | ||
159 | <context name="_square_brackets" attribute="Pattern Brackets" lineEndContext="#pop"> | 196 | <!-- Category --> | ||
160 | <DetectChar context="#pop" attribute="Pattern Brackets" char="]"/> | 197 | <context name="_fc_level_cat" attribute="MLS/MCS Level" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop!_after_fc"> | ||
161 | <IncludeRules context="_escape"/> | 198 | <RegExpr context="#stay" attribute="Normal Text" String="\s*,\s*(?=&simpleIdentifier;)"/> | ||
162 | 199 | <IncludeRules context="_default_level"/> | |||
163 | <DetectSpaces context="#pop" lookAhead="true"/> | 200 | </context> | ||
164 | <DetectChar context="#pop" attribute="Path" char=""" lookAhead="true"/> | 201 | | ||
165 | <IncludeRules context="_variable"/> | 202 | <context name="_default_level" attribute="Normal Text" lineEndContext="#pop"> | ||
166 | <DetectChar context="#stay" attribute="Error" char="["/> | 203 | <RegExpr context="#stay" attribute="Normal Text" String="\s*\.\s*(?=&charIden;)"/> | ||
167 | <RegExpr context="#stay" attribute="Open Pattern Brackets" String="[^\s\]](?=([\s"]|$))"/> | 204 | <DetectChar context="_default_level_arg" attribute="MLS/MCS Level" char="$"/> | ||
168 | 205 | <DetectChar context="_default_level_var" attribute="MLS/MCS Level" char="%"/> | |||
169 | <AnyChar context="#stay" attribute="Special Char 2" String="^-"/> | 206 | <RegExpr context="#stay" attribute="MLS/MCS Level" String="\w+"/> | ||
170 | <IncludeRules context="_special_chars"/> | 207 | <DetectChar context="#stay" attribute="MLS/MCS Level" char="-"/> | ||
208 | </context> | ||||
209 | <context name="_default_level_arg" attribute="MLS/MCS Level" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop"> | ||||
210 | <!-- M4 Args. It is not exact --> | ||||
211 | <Int context="#pop" attribute="MLS/MCS Level"/> | ||||
212 | <AnyChar context="#pop" attribute="MLS/MCS Level" String="#*@"/> | ||||
213 | <RegExpr context="#pop" attribute="MLS/MCS Level" String="\{\d+\}"/> | ||||
214 | </context> | ||||
215 | <context name="_default_level_var" attribute="MLS/MCS Level" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop"> | ||||
216 | <RegExpr context="#pop" attribute="MLS/MCS Level" String="{[A-Za-z]\w*\}"/> | ||||
217 | </context> | ||||
218 | | ||||
219 | <context name="_after_fc" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop"> | ||||
220 | <RegExpr context="#stay" attribute="Normal Text" String="\s*:\s*\w*"/> | ||||
221 | <RegExpr context="#stay" attribute="Normal Text" String="[:\.\w]+"/> | ||||
222 | </context> | ||||
223 | | ||||
224 | <!-- Within function "gen_context" (highlight variables and M4 args.) --> | ||||
225 | <!-- User --> | ||||
226 | <context name="_gen_context_fc_user" attribute="User" lineEndContext="#pop"> | ||||
227 | <DetectChar context="#pop!_gen_context_role" attribute="Normal Text" char=":"/> | ||||
228 | <IncludeRules context="_fc_variable"/> | ||||
229 | </context> | ||||
230 | <!-- Role --> | ||||
231 | <context name="_gen_context_role" attribute="Role" lineEndContext="#pop"> | ||||
232 | <DetectChar context="#pop!_before_gen_context_type" attribute="Normal Text" char=":"/> | ||||
233 | <IncludeRules context="_fc_variable"/> | ||||
234 | </context> | ||||
235 | <!-- Type Enforcement --> | ||||
236 | <context name="_before_gen_context_type" attribute="Type Enforcement" | ||||
237 | lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop!_gen_context_type"> | ||||
238 | <DetectSpaces context="#stay" attribute="Normal Text"/> | ||||
239 | </context> | ||||
240 | <context name="_gen_context_type" attribute="Type Enforcement" | ||||
241 | lineEndContext="#pop!_fc_find_comma" fallthrough="true" fallthroughContext="#pop!_fc_find_comma"> | ||||
242 | <RegExpr context="#pop!_fc_level_range" attribute="Normal Text" String="\s*:\s*(?=&identifier;)"/> <!-- Find MLS/MCS --> | ||||
243 | <IncludeRules context="_fc_variable"/> | ||||
244 | <RegExpr context="#stay" attribute="Type Enforcement" String="[\w\-]+"/> | ||||
245 | </context> | ||||
246 | <!-- Comma after file contexts --> | ||||
247 | <context name="_fc_find_comma" attribute="Normal Text" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop"> | ||||
248 | <DetectChar context="#pop!_fc_after_comma" attribute="Normal Text" char=","/> | ||||
249 | <RegExpr context="#pop" String="\s*[^,\s]" lookAhead="true"/> | ||||
250 | <DetectSpaces /> | ||||
171 | </context> | 251 | </context> | ||
172 | <context name="_round_brackets" attribute="Pattern Brackets" lineEndContext="#pop"> | 252 | <context name="_fc_after_comma" attribute="Normal Text" | ||
173 | <DetectChar context="#pop" attribute="Pattern Brackets" char=")"/> | 253 | lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop!_gen_context_level"> | ||
174 | <IncludeRules context="_escape"/> | 254 | <DetectSpaces context="#stay"/> | ||
175 | 255 | </context> | |||
176 | <DetectSpaces context="#pop" lookAhead="true"/> | 256 | <!-- MLS/MCS --> | ||
177 | <DetectChar context="#pop" attribute="Path" char=""" lookAhead="true"/> | 257 | <context name="_gen_context_level" attribute="MLS/MCS Level" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop"> | ||
178 | <IncludeRules context="_variable"/> | 258 | <RegExpr context="#stay" attribute="Normal Text" String="\-\s*(?=&simpleIdentifier;)"/> | ||
179 | <DetectChar context="_square_brackets" attribute="Pattern Brackets" char="["/> | 259 | <IncludeRules context="_fc_variable"/> | ||
180 | <DetectChar context="_round_brackets" attribute="Pattern Brackets" char="("/> | 260 | <RegExpr context="#stay" attribute="MLS/MCS Level" String="\w+"/> | ||
181 | <IncludeRules context="_quantification_brackets"/> | 261 | <DetectChar context="#stay" attribute="MLS/MCS Level" char="-"/> | ||
182 | <RegExpr context="#stay" attribute="Open Pattern Brackets" String="[^\s\[\]\(\)](?=([\s"]|$))"/> | 262 | <AnyChar context="#stay" attribute="Normal Text" String=":.,"/> | ||
183 | 263 | <DetectSpaces /> | |||
184 | <DetectChar context="#stay" attribute="Special Char 2" char="|"/> | | |||
185 | <IncludeRules context="_special_chars"/> | | |||
186 | </context> | 264 | </context> | ||
187 | 265 | | |||
188 | </contexts> | 266 | </contexts> | ||
189 | 267 | | |||
190 | <itemDatas> | 268 | <itemDatas> | ||
191 | <itemData name="Normal Text" defStyleNum="dsNormal" spellChecking="false"/> | 269 | <itemData name="Normal Text" defStyleNum="dsNormal" spellChecking="false"/> | ||
192 | <itemData name="Comment" defStyleNum="dsComment"/> | | |||
193 | <itemData name="Text Quoted" defStyleNum="dsString" spellChecking="false"/> | 270 | <itemData name="Text Quoted" defStyleNum="dsString" spellChecking="false"/> | ||
194 | <itemData name="Path" defStyleNum="dsNormal" spellChecking="false"/> | 271 | <itemData name="Path" defStyleNum="dsNormal" spellChecking="false"/> | ||
195 | <itemData name="Variable" defStyleNum="dsVariable" spellChecking="false"/> | 272 | <itemData name="Variable" defStyleNum="dsVariable" spellChecking="false"/> | ||
196 | | ||||
197 | <itemData name="File Type" defStyleNum="dsKeyword" spellChecking="false"/> | 273 | <itemData name="File Type" defStyleNum="dsKeyword" spellChecking="false"/> | ||
198 | <itemData name="Keywords" defStyleNum="dsKeyword" spellChecking="false"/> | | |||
199 | <itemData name="Other Keywords" defStyleNum="dsNormal" italic="1" spellChecking="false"/> | | |||
200 | 274 | | |||
201 | <itemData name="User" defStyleNum="dsOthers" spellChecking="false"/> | 275 | <itemData name="User" defStyleNum="dsOthers" spellChecking="false"/> | ||
202 | <itemData name="Role" defStyleNum="dsDecVal" spellChecking="false"/> | 276 | <itemData name="Role" defStyleNum="dsDecVal" spellChecking="false"/> | ||
203 | <itemData name="Type" defStyleNum="dsDataType" spellChecking="false"/> | 277 | <itemData name="Type Enforcement" defStyleNum="dsDataType" spellChecking="false"/> | ||
204 | <itemData name="Level" defStyleNum="dsVerbatimString" spellChecking="false"/> | 278 | <itemData name="MLS/MCS Level" defStyleNum="dsVerbatimString" spellChecking="false"/> | ||
205 | 279 | | |||
206 | <itemData name="Special Char" defStyleNum="dsSpecialChar" spellChecking="false"/> | 280 | <itemData name="Other Keywords" defStyleNum="dsNormal" italic="1" spellChecking="false"/> | ||
207 | <itemData name="Special Char 2" defStyleNum="dsAnnotation" spellChecking="false"/> | 281 | <itemData name="Function" defStyleNum="dsNormal" bold="1" spellChecking="false"/> | ||
208 | <itemData name="Pattern Brackets" defStyleNum="dsSpecialString" spellChecking="false"/> | 282 | <itemData name="Symbol" defStyleNum="dsOperator" spellChecking="false"/> | ||
209 | <itemData name="Open Pattern Brackets" defStyleNum="dsSpecialString" underline="1" spellChecking="false"/> | 283 | <itemData name="Number" defStyleNum="dsComment" spellChecking="false"/> | ||
210 | <itemData name="Escape Expression" defStyleNum="dsSpecialChar" spellChecking="false"/> | 284 | <itemData name="Text Quoted Open" defStyleNum="dsString" underline="1" spellChecking="false"/> | ||
211 | <itemData name="Error" defStyleNum="dsError" spellChecking="false"/> | | |||
212 | </itemDatas> | 285 | </itemDatas> | ||
213 | 286 | | |||
214 | </highlighting> | 287 | </highlighting> | ||
215 | 288 | | |||
216 | <general> | 289 | <general> | ||
217 | <keywords casesensitive="true" additionalDeliminator=""`'" weakDeliminator="*?+.-"/> | 290 | <keywords casesensitive="true" additionalDeliminator=""'`" weakDeliminator="*?+.-"/> | ||
218 | <comments> | 291 | <comments> | ||
219 | <comment name="singleLine" start="#"/> | 292 | <comment name="singleLine" start="#"/> | ||
220 | </comments> | 293 | </comments> | ||
221 | </general> | 294 | </general> | ||
222 | 295 | | |||
223 | </language> | 296 | </language> | ||
297 | <!-- kate: replace-tabs off; tab-width 3; indent-width 3; remove-trailing-spaces mod; dynamic-word-wrap off; --> |