Ticket #4543: merge_cooledit_syntax_highlighting.patch

File merge_cooledit_syntax_highlighting.patch, 5.4 KB (added by Andrei_Korshikov, 4 months ago)
  • doc/man/mcedit.1.in

    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 
    247247rules for highlighting, each of which is given on a separate line, and 
    248248define which keywords will be highlighted with what color. 
    249249.PP 
    250 The file is divided into sections, each beginning with a line with the 
     250The file is divided into sections (rule sets), each beginning with a 
     251line with the 
    251252.B file 
    252253command.  The sections are normally put into separate files using the 
    253254.B include 
    future versions of 
    265266may use it as well.  The third optional argument is a regular expression 
    266267to match the first line of text of the file.  The rules in the following 
    267268section apply if either the file name or the first line of text matches. 
     269For example, 
     270.PP 
     271.nf 
     272  file .\(rs+\(rs\(rs.(?i:py)$  Python\\sProgram  \(ha#!.\(rs*[\(rss/]python 
     273.fi 
     274.PP 
     275will cause a file to be highlighted with corresponding rules if the file 
     276contains, say, 
     277.B #!/usr/bin/python 
     278or 
     279.B #!/usr/bin/env python3 
     280on the first line OR if the file name ends in, say, 
     281.BR .py . 
     282.PP 
     283Note that 
     284.BR * , 
     285.B + 
     286and 
     287.B \(rs 
     288have to be escaped with a 
     289.BR \(rs , 
     290and space must be presented with a 
     291.BR \(rss . 
    268292.PP 
    269293A 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 
     294divided into contexts, and each context contains rules (keyword 
     295definitions).  A context is a scope within the text that a particular 
     296set of rules belongs to. Contexts are usually for when you have something 
     297that must be coloured across multiple lines. The 
     298.B default 
     299context contains the list of keywords to fall back on should there be no 
     300other applicable context. 
     301.PP 
     302For instance, the region within a C-style string (i.e. between 
     303.B \(dq 
     304quotations) has its own separate colour and hence its own separate 
     305context. Within it, the normal C tokens, like 
     306.B if 
     307and 
     308.BR while , 
     309will not apply, but 
     310.B %d 
     311should be highlighted in a different colour. 
     312.PP 
     313As another example, the text within a C-style comment (i.e. between 
    273314.B /* 
    274315and 
    275316.BR */ ) 
    within a C comment. 
    280321A trivial C programming section might look like this: 
    281322.PP 
    282323.nf 
    283 file .\\*\\\\.c C\\sProgram\\sFile (#include|/\\\\\\*) 
     324file .\(rs+\(rs\(rs.c  C\(rssProgram 
    284325 
    285326wholechars abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_ 
    286327 
    The first context is an exception. It must start with the command 
    337378.PP 
    338379otherwise 
    339380.B mcedit 
    340 will report an error.  The 
     381will report an error. 
     382.PP 
     383The 
    341384.B linestart 
    342385option specifies that 
    343386.I delim 
    344 must start at the beginning of a line.  The 
     387must start at the beginning of a line. 
     388.PP 
     389The 
    345390.B whole 
    346391option tells that 
    347392.I delim 
    option, and similarly a word that must end on the word boundary is specified by 
    354399The set of characters that constitute a whole word can be changed at any 
    355400point in the file with the 
    356401.B wholechars 
    357 command.  The left and right set of characters can be set separately 
    358 with 
     402command. The command in the sample above just sets the set exactly to its 
     403default and could therefore have been omitted. The left and right set of 
     404characters can be set separately with 
    359405.PP 
    360406.B wholechars 
    361407.RB [ left | right ] 
    Each rule is a line of the form: 
    376422.RI [ attributes ] 
    377423.PP 
    378424Context 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, 
     425and spaces with the sequences 
     426.B \(rst 
     427and 
     428.BR \(rss . 
     429Newlines and backslashes are specified with 
     430.B \(rsn 
     431and 
     432.B \(rs\(rs 
     433respectively. Since whitespace is used as a separator, it may not be used 
     434as is. 
     435.PP 
     436Also, 
     437.B \(rs* 
     438must be used to specify an asterisk, and 
     439.B \(rs+ 
     440to specify the plus sign. The 
     441.B * 
     442itself is a wildcard that matches any length of characters. The 
     443.B + 
     444is like the 
     445.BR * , 
     446but matches a length of non-whitespace characters only. For example, 
    384447.PP 
    385448.nf 
    386449  keyword         '*'      green 
    colors all C single character constants green. You also could use 
    393456.fi 
    394457.PP 
    395458to 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. 
     459to span across multiple newlines. 
     460.PP 
     461The 
     462.B \(rs{ 
     463wildcard matches any single character that exists between it and its corresponding 
     464.BR \(rs} . 
     465For 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 
     471The 
     472.BR \(rs[ ...\c 
     473.B \(rs] 
     474wildcard is similar and matches any number of characters. 
     475.PP 
     476All wildcards may be used within context delimiters as well, but you cannot 
     477have a wildcard as the last or the first character of a context delimiter. 
    399478.PP 
    400479Important to note is the line 
    401480.PP