diff --git a/doc/man/mcedit.1.in b/doc/man/mcedit.1.in
index 2869af70e..ac1ba9e02 100644
a
|
b
|
is rescanned on opening of every new editor file. The file contains |
247 | 247 | rules for highlighting, each of which is given on a separate line, and |
248 | 248 | define which keywords will be highlighted with what color. |
249 | 249 | .PP |
250 | | The file is divided into sections, each beginning with a line with the |
| 250 | The file is divided into sections (rule sets), each beginning with a |
| 251 | line with the |
251 | 252 | .B file |
252 | 253 | command. The sections are normally put into separate files using the |
253 | 254 | .B include |
… |
… |
future versions of |
265 | 266 | may use it as well. The third optional argument is a regular expression |
266 | 267 | to match the first line of text of the file. The rules in the following |
267 | 268 | section apply if either the file name or the first line of text matches. |
| 269 | For example, |
| 270 | .PP |
| 271 | .nf |
| 272 | file .\(rs+\(rs\(rs.(?i:py)$ Python\\sProgram \(ha#!.\(rs*[\(rss/]python |
| 273 | .fi |
| 274 | .PP |
| 275 | will cause a file to be highlighted with corresponding rules if the file |
| 276 | contains, say, |
| 277 | .B #!/usr/bin/python |
| 278 | or |
| 279 | .B #!/usr/bin/env python3 |
| 280 | on the first line OR if the file name ends in, say, |
| 281 | .BR .py . |
| 282 | .PP |
| 283 | Note that |
| 284 | .BR * , |
| 285 | .B + |
| 286 | and |
| 287 | .B \(rs |
| 288 | have to be escaped with a |
| 289 | .BR \(rs , |
| 290 | and space must be presented with a |
| 291 | .BR \(rss . |
268 | 292 | .PP |
269 | 293 | A section ends with the start of another section. Each section is |
270 | | divided into contexts, and each context contains rules. A context is a |
271 | | scope within the text that a particular set of rules belongs to. For |
272 | | instance, the text within a C style comment (i.e. between |
| 294 | divided into contexts, and each context contains rules (keyword |
| 295 | definitions). A context is a scope within the text that a particular |
| 296 | set of rules belongs to. Contexts are usually for when you have something |
| 297 | that must be coloured across multiple lines. The |
| 298 | .B default |
| 299 | context contains the list of keywords to fall back on should there be no |
| 300 | other applicable context. |
| 301 | .PP |
| 302 | For instance, the region within a C-style string (i.e. between |
| 303 | .B \(dq |
| 304 | quotations) has its own separate colour and hence its own separate |
| 305 | context. Within it, the normal C tokens, like |
| 306 | .B if |
| 307 | and |
| 308 | .BR while , |
| 309 | will not apply, but |
| 310 | .B %d |
| 311 | should be highlighted in a different colour. |
| 312 | .PP |
| 313 | As another example, the text within a C-style comment (i.e. between |
273 | 314 | .B /* |
274 | 315 | and |
275 | 316 | .BR */ ) |
… |
… |
within a C comment. |
280 | 321 | A trivial C programming section might look like this: |
281 | 322 | .PP |
282 | 323 | .nf |
283 | | file .\\*\\\\.c C\\sProgram\\sFile (#include|/\\\\\\*) |
| 324 | file .\(rs+\(rs\(rs.c C\(rssProgram |
284 | 325 | |
285 | 326 | wholechars abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_ |
286 | 327 | |
… |
… |
The first context is an exception. It must start with the command |
337 | 378 | .PP |
338 | 379 | otherwise |
339 | 380 | .B mcedit |
340 | | will report an error. The |
| 381 | will report an error. |
| 382 | .PP |
| 383 | The |
341 | 384 | .B linestart |
342 | 385 | option specifies that |
343 | 386 | .I delim |
344 | | must start at the beginning of a line. The |
| 387 | must start at the beginning of a line. |
| 388 | .PP |
| 389 | The |
345 | 390 | .B whole |
346 | 391 | option tells that |
347 | 392 | .I delim |
… |
… |
option, and similarly a word that must end on the word boundary is specified by |
354 | 399 | The set of characters that constitute a whole word can be changed at any |
355 | 400 | point in the file with the |
356 | 401 | .B wholechars |
357 | | command. The left and right set of characters can be set separately |
358 | | with |
| 402 | command. The command in the sample above just sets the set exactly to its |
| 403 | default and could therefore have been omitted. The left and right set of |
| 404 | characters can be set separately with |
359 | 405 | .PP |
360 | 406 | .B wholechars |
361 | 407 | .RB [ left | right ] |
… |
… |
Each rule is a line of the form: |
376 | 422 | .RI [ attributes ] |
377 | 423 | .PP |
378 | 424 | Context or keyword strings are interpreted, so that you can include tabs |
379 | | and spaces with the sequences \\t and \\s. Newlines and backslashes are |
380 | | specified with \\n and \\\\ respectively. Since whitespace is used as a |
381 | | separator, it may not be used as is. Also, \\* must be used to specify |
382 | | an asterisk. The * itself is a wildcard that matches any length of |
383 | | characters. For example, |
| 425 | and spaces with the sequences |
| 426 | .B \(rst |
| 427 | and |
| 428 | .BR \(rss . |
| 429 | Newlines and backslashes are specified with |
| 430 | .B \(rsn |
| 431 | and |
| 432 | .B \(rs\(rs |
| 433 | respectively. Since whitespace is used as a separator, it may not be used |
| 434 | as is. |
| 435 | .PP |
| 436 | Also, |
| 437 | .B \(rs* |
| 438 | must be used to specify an asterisk, and |
| 439 | .B \(rs+ |
| 440 | to specify the plus sign. The |
| 441 | .B * |
| 442 | itself is a wildcard that matches any length of characters. The |
| 443 | .B + |
| 444 | is like the |
| 445 | .BR * , |
| 446 | but matches a length of non-whitespace characters only. For example, |
384 | 447 | .PP |
385 | 448 | .nf |
386 | 449 | keyword '*' green |
… |
… |
colors all C single character constants green. You also could use |
393 | 456 | .fi |
394 | 457 | .PP |
395 | 458 | to color string constants, but the matched string would not be allowed |
396 | | to span across multiple newlines. The wildcard may be used within |
397 | | context delimiters as well, but you cannot have a wildcard as the last |
398 | | or first character. |
| 459 | to span across multiple newlines. |
| 460 | .PP |
| 461 | The |
| 462 | .B \(rs{ |
| 463 | wildcard matches any single character that exists between it and its corresponding |
| 464 | .BR \(rs} . |
| 465 | For example, the following matches C-style character constants with octals: |
| 466 | .PP |
| 467 | .nf |
| 468 | keyword '\(rs\(rs\(rs{0123\(rs}\(rs{01234567\(rs}\(rs{01234567\(rs}' brightgreen |
| 469 | .fi |
| 470 | .PP |
| 471 | The |
| 472 | .BR \(rs[ ...\c |
| 473 | .B \(rs] |
| 474 | wildcard is similar and matches any number of characters. |
| 475 | .PP |
| 476 | All wildcards may be used within context delimiters as well, but you cannot |
| 477 | have a wildcard as the last or the first character of a context delimiter. |
399 | 478 | .PP |
400 | 479 | Important to note is the line |
401 | 480 | .PP |