| 1 |
<?xml version="1.0" encoding="UTF-8"?> |
| 2 |
<!DOCTYPE language |
| 3 |
[ |
| 4 |
<!ENTITY atomstr "\b[a-z][_a-z@-Z0-9]*(?:(?=[^_a-z@-Z0-9])|$)" > |
| 5 |
<!ENTITY varstr "\b[_A-Z][_a-z@-Z0-9]*(?:(?=[^_a-z@-Z0-9])|$)" > |
| 6 |
<!-- pragmas defined here, because "keyword" can't handle the leading '-' --> |
| 7 |
<!ENTITY pragmas |
| 8 |
"^(?:-module|-export|-define|-undef|-ifdef|-ifndef|-else|-endif|-include|-include_lib)" > |
| 9 |
<!-- same with separators: (from s3.9 p 24 of erlang spec) --> |
| 10 |
<!ENTITY separators "(?:\(|\)|\{|\}|\[|\]|\.|\:|\||\|\||;|\,|\?|->|\#)" > |
| 11 |
<!-- and operators - although words are dealt with separately --> |
| 12 |
<!ENTITY opsymbols |
| 13 |
"(?:\+|-|\*|\/|==|\/=|=:=|=\/=|<|=<|>|>=|\+\+|--|=|!|<-)" > |
| 14 |
] |
| 15 |
> |
| 16 |
<!-- |
| 17 |
Copyright (C) 2007 Bill Ross <[email protected]> |
| 18 |
|
| 19 |
|
| 20 |
This library is free software; you can redistribute it and/or |
| 21 |
modify it under the terms of the GNU Library General Public |
| 22 |
License version 2 as published by the Free Software Foundation. |
| 23 |
|
| 24 |
This library is distributed in the hope that it will be useful, |
| 25 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 26 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 27 |
Library General Public License for more details. |
| 28 |
|
| 29 |
You should have received a copy of the GNU Library General Public License |
| 30 |
along with this library; see the file COPYING.LIB. If not, write to |
| 31 |
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 32 |
Boston, MA 02110-1301, USA. |
| 33 |
|
| 34 |
Changes |
| 35 |
v1-0-2 (2008-01-10) - fixed to '_" in atom and variable names (thanks to Vito De Tullio) |
| 36 |
- fixed highlighting problem when '@' at end of atom/variable |
| 37 |
--> |
| 38 |
|
| 39 |
<language name="Erlang" version="6" kateversion="5.0" section="Scripts" extensions="*.erl" mimetype="" author="Bill Ross ([email protected])" license="LGPLv2"> |
| 40 |
<highlighting> |
| 41 |
<list name="keywords"> |
| 42 |
<!-- ====== s3.8 p 24 of erlang spec ===== --> |
| 43 |
<item>after</item> |
| 44 |
<item>begin</item> |
| 45 |
<item>case</item> |
| 46 |
<item>catch</item> |
| 47 |
<item>cond</item> |
| 48 |
<item>end</item> |
| 49 |
<item>fun</item> |
| 50 |
<item>if</item> |
| 51 |
<item>let</item> |
| 52 |
<item>of</item> |
| 53 |
<item>query</item> |
| 54 |
<item>receive</item> |
| 55 |
<item>all_true</item> |
| 56 |
<item>some_true</item> |
| 57 |
</list> |
| 58 |
<list name="operators"> |
| 59 |
<!-- operators: s3.9 p 24 of erlang spec --> |
| 60 |
<!-- see also opsymbols for the symbols --> |
| 61 |
<item>div</item> |
| 62 |
<item>rem</item> |
| 63 |
<item>or</item> |
| 64 |
<item>xor</item> |
| 65 |
<item>bor</item> |
| 66 |
<item>bxor</item> |
| 67 |
<item>bsl</item> |
| 68 |
<item>bsr</item> |
| 69 |
<item>and</item> |
| 70 |
<item>band</item> |
| 71 |
<item>not</item> |
| 72 |
<item>bnot</item> |
| 73 |
</list> |
| 74 |
<list name="functions"> |
| 75 |
<!-- all standard (erlang) functions are here, --> |
| 76 |
<!-- except those defined as erlang:function (those will show as functions anyway --> |
| 77 |
<item>abs</item> |
| 78 |
<item>accept</item> |
| 79 |
<item>alarm</item> |
| 80 |
<item>apply</item> |
| 81 |
<item>atom_to_list</item> |
| 82 |
<item>binary_to_list</item> |
| 83 |
<item>binary_to_term</item> |
| 84 |
<item>check_process_code</item> |
| 85 |
<item>concat_binary</item> |
| 86 |
<item>date</item> |
| 87 |
<item>delete_module</item> |
| 88 |
<item>disconnect_node</item> |
| 89 |
<item>element</item> |
| 90 |
<item>erase</item> |
| 91 |
<item>exit</item> |
| 92 |
<item>float</item> |
| 93 |
<item>float_to_list</item> |
| 94 |
<item>garbage_collect</item> |
| 95 |
<item>get</item> |
| 96 |
<item>get_keys</item> |
| 97 |
<item>group_leader</item> |
| 98 |
<item>halt</item> |
| 99 |
<item>hd</item> |
| 100 |
<item>integer_to_list</item> |
| 101 |
<item>is_alive</item> |
| 102 |
<item>is_atom</item> |
| 103 |
<item>is_binary</item> |
| 104 |
<item>is_boolean</item> |
| 105 |
<item>is_float</item> |
| 106 |
<item>is_function</item> |
| 107 |
<item>is_integer</item> |
| 108 |
<item>is_list</item> |
| 109 |
<item>is_number</item> |
| 110 |
<item>is_pid</item> |
| 111 |
<item>is_port</item> |
| 112 |
<item>is_process_alive</item> |
| 113 |
<item>is_record</item> |
| 114 |
<item>is_reference</item> |
| 115 |
<item>is_tuple</item> |
| 116 |
<item>length</item> |
| 117 |
<item>link</item> |
| 118 |
<item>list_to_atom</item> |
| 119 |
<item>list_to_binary</item> |
| 120 |
<item>list_to_float</item> |
| 121 |
<item>list_to_integer</item> |
| 122 |
<item>list_to_pid</item> |
| 123 |
<item>list_to_tuple</item> |
| 124 |
<item>load_module</item> |
| 125 |
<item>loaded</item> |
| 126 |
<item>localtime</item> |
| 127 |
<item>make_ref</item> |
| 128 |
<item>module_loaded</item> |
| 129 |
<item>node</item> |
| 130 |
<item>nodes</item> |
| 131 |
<item>now</item> |
| 132 |
<item>open_port</item> |
| 133 |
<item>pid_to_list</item> |
| 134 |
<item>port_close</item> |
| 135 |
<item>port_command</item> |
| 136 |
<item>port_connect</item> |
| 137 |
<item>port_control</item> |
| 138 |
<item>ports</item> |
| 139 |
<item>pre_loaded</item> |
| 140 |
<item>process_flag</item> |
| 141 |
<item>process_info</item> |
| 142 |
<item>processes</item> |
| 143 |
<item>purge_module</item> |
| 144 |
<item>put</item> |
| 145 |
<item>register</item> |
| 146 |
<item>registered</item> |
| 147 |
<item>round</item> |
| 148 |
<item>self</item> |
| 149 |
<item>setelement</item> |
| 150 |
<item>size</item> |
| 151 |
<item>spawn</item> |
| 152 |
<item>spawn_link</item> |
| 153 |
<item>spawn_opt</item> |
| 154 |
<item>split_binary</item> |
| 155 |
<item>statistics</item> |
| 156 |
<item>term_to_binary</item> |
| 157 |
<item>throw</item> |
| 158 |
<item>time</item> |
| 159 |
<item>tl</item> |
| 160 |
<item>trunc</item> |
| 161 |
<item>tuple_to_list</item> |
| 162 |
<item>unlink</item> |
| 163 |
<item>unregister</item> |
| 164 |
<item>whereis</item> |
| 165 |
</list> |
| 166 |
<contexts> |
| 167 |
<context attribute="Normal Text" lineEndContext="#stay" name="Normal Text" > |
| 168 |
<RegExpr attribute="Pragma" context="#stay" column="0" String="&pragmas;" /> |
| 169 |
<keyword attribute="Keyword" context="#stay" String="keywords" /> |
| 170 |
<keyword attribute="Operator" context="#stay" String="operators" /> |
| 171 |
<RegExpr attribute="Operator" context="#stay" String="&opsymbols;" /> |
| 172 |
<keyword attribute="Function" context="#stay" String="functions" /> |
| 173 |
<RegExpr attribute="Separator" context="#stay" String="&separators;" /> |
| 174 |
<DetectSpaces /> |
| 175 |
<DetectChar attribute="Comment" context="comment" char="%" /> |
| 176 |
|
| 177 |
<!-- Functions (in addition to named functions dealt with above) --> |
| 178 |
<!-- simple version - got to be in form module:function --> |
| 179 |
<RegExpr attribute="Function" context="#stay" String="&atomstr;:&atomstr;" /> |
| 180 |
<RegExpr attribute="Function" context="isfunction" String="&atomstr;\(" lookAhead="true" /> |
| 181 |
|
| 182 |
<!-- Variables - begin with upper case, or between single quotes --> |
| 183 |
<RegExpr attribute="Variable" context="#stay" String="&varstr;" /> |
| 184 |
|
| 185 |
<!-- atoms - begin with lower case (letters, numbers, @), |
| 186 |
or anything between single quotes --> |
| 187 |
<DetectChar attribute="Atom" context="atomquote" char="'" /> |
| 188 |
<RegExpr attribute="Atom" context="#stay" String="&atomstr;" /> |
| 189 |
|
| 190 |
<DetectChar attribute="String" context="stringquote" char=""" /> |
| 191 |
|
| 192 |
<!-- numbers - these work --> |
| 193 |
<!-- integers have three forms 7, 3#22, $A --> |
| 194 |
<!-- float must have a number after the decimal point, or it doesn't count --> |
| 195 |
<RegExpr attribute="Float" context="#stay" String="[0-9]+\.[0-9]+(?:[eE][+-]?[0-9]+)?" /> |
| 196 |
<RegExpr attribute="Number" context="#stay" String="\d+#[a-zA-Z0-9]+" /> |
| 197 |
<RegExpr attribute="Integer" context="#stay" String="\$\S|[0-9]+" /> |
| 198 |
|
| 199 |
</context> |
| 200 |
|
| 201 |
<!-- isfunction --> |
| 202 |
<!-- confirm that this is a function and capture name for formatting --> |
| 203 |
<!-- lookahead for '(' already performed by the time we are here --> |
| 204 |
<context name="isfunction" attribute="Function" lineEndContext="#pop" > |
| 205 |
<RegExpr attribute="Function" context="#pop" String="&atomstr;" /> |
| 206 |
</context> |
| 207 |
|
| 208 |
<!-- finish off the atom in quoted string (allow for escaped single quotes --> |
| 209 |
<context name="atomquote" attribute="Atom" lineEndContext="#pop"> |
| 210 |
<RegExpr attribute="Atom" context="#pop" String="(?:(?:\\')?[^']*)*'" /> |
| 211 |
</context> |
| 212 |
|
| 213 |
<!-- finish off the atom in quoted string (allow for escaped single quotes --> |
| 214 |
<context name="stringquote" attribute="String" lineEndContext="#pop"> |
| 215 |
<RegExpr attribute="String" context="#pop" String="(?:(?:\\")?[^"]*)*"" /> |
| 216 |
</context> |
| 217 |
|
| 218 |
<!-- finish off the comment (allows for alerts) --> |
| 219 |
<context name="comment" attribute="Comment" lineEndContext="#pop"> |
| 220 |
<DetectSpaces /> |
| 221 |
<IncludeRules context="##Comments" /> |
| 222 |
<DetectIdentifier /> |
| 223 |
</context> |
| 224 |
|
| 225 |
</contexts> |
| 226 |
<itemDatas> |
| 227 |
<itemData name="Normal Text" defStyleNum="dsNormal" /> |
| 228 |
<itemData name="Keyword" defStyleNum="dsKeyword" /> |
| 229 |
<itemData name="Pragma" defStyleNum="dsKeyword" /> |
| 230 |
<itemData name="Function" defStyleNum="dsFunction" /> |
| 231 |
<itemData name="Separator" defStyleNum="dsFunction" /> |
| 232 |
<itemData name="Operator" defStyleNum="dsOperator" /> |
| 233 |
<itemData name="Variable" defStyleNum="dsVariable" /> |
| 234 |
<itemData name="Integer" defStyleNum="dsDecVal" /> |
| 235 |
<itemData name="Number" defStyleNum="dsBaseN" /> |
| 236 |
<itemData name="Float" defStyleNum="dsFloat" /> |
| 237 |
<itemData name="Atom" defStyleNum="dsChar" /> |
| 238 |
<itemData name="String" defStyleNum="dsString" /> |
| 239 |
<itemData name="Comment" defStyleNum="dsComment" /> |
| 240 |
</itemDatas> |
| 241 |
</highlighting> |
| 242 |
<general> |
| 243 |
<comments> |
| 244 |
<comment name="singleLine" start="%" /> |
| 245 |
</comments> |
| 246 |
<keywords casesensitive="1" /> |
| 247 |
</general> |
| 248 |
</language> |
| 249 |
<!-- kate: space-indent on; indent-width 2; replace-tabs on; --> |