1
1
Этот коммит содержится в:
Paul Sheer 1998-12-10 22:14:10 +00:00
родитель c00a8845fd
Коммит d09470310a
2 изменённых файлов: 68 добавлений и 39 удалений

Просмотреть файл

@ -2323,7 +2323,8 @@ menusel, menuhot, menuhotsel, gauge; the dialog colors
are: dnormal, dfocus, dhotnormal, dhotfocus; Help colors are: dnormal, dfocus, dhotnormal, dhotfocus; Help colors
are: helpnormal, helpitalic, helpbold, helplink, are: helpnormal, helpitalic, helpbold, helplink,
helpslink; Viewer color is: viewunderline; Special highlighting mode: helpslink; Viewer color is: viewunderline; Special highlighting mode:
executable, directory, link, device, special. executable, directory, link, device, special; Editor colors
are: editnormal, editbold, editmarked.
The dialog boxes use the following colors: <em/dnormal/ is The dialog boxes use the following colors: <em/dnormal/ is
used for the normal text, <em/dfocus/ is the color used for the used for the normal text, <em/dfocus/ is the color used for the

Просмотреть файл

@ -165,14 +165,17 @@ that keywords and contexts (like C comments, string constants, etc) are
highlighted in different colours. The following section explains the highlighted in different colours. The following section explains the
format of the file \fB~/.cedit/syntax\fP. format of the file \fB~/.cedit/syntax\fP.
The file \fB~/.cedit/syntax\fP (\fB~/.cedit/mcsyntax\fP for mcedit) is The file \fB~/.cedit/syntax\fP is rescanned on opening of a any new
rescanned on opening of a any new editor file. The file contains editor file. The file contains rules for highlighting, each of which is
rules for highlighting, each of which is given on a seperate line, given on a seperate line, and define which keywords will be highlighted
and define which keywords will be highlighted to what colour. The to what colour. The file is also divided into sections, each beginning
file is also divided into sections, each beginning with a line with with a line with the \fBfile\fP command, followed by a regular
the \fBfile\fP command, followed by a regular expression. The expression. The regular expression dictates the file name that that set
regular expression dictates the file name that that set of rules of rules applies to. Following this is a description to be printed on the
applies to. left of the editor window explaining the file type to the user. A third
optional argument is a regular expression to match the first line of
text of the file. If either the file name matches, or the first line of text,
then those rules will be loaded.
A section ends with the start of a new section. Each section is divided A section ends with the start of a new section. Each section is divided
into contexts, and each context contains rules. A context is a scope into contexts, and each context contains rules. A context is a scope
@ -185,38 +188,38 @@ highlighted within a C comment.
A trivial C programming section might look like this: A trivial C programming section might look like this:
.PP .PP
.nf .nf
file .\\*\\\\.c file .\\*\\\\.c C\\sProgram\\sFile (#include|/\\\\\\*)
wholechars abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_ wholechars abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_
# default colors # default colors
context default context default
keyword whole if yellow keyword whole if 24
keyword whole else yellow keyword whole else 24
keyword whole for yellow keyword whole for 24
keyword whole while yellow keyword whole while 24
keyword whole do yellow keyword whole do 24
keyword whole switch yellow keyword whole switch 24
keyword whole case yellow keyword whole case 24
keyword whole static yellow keyword whole static 24
keyword whole extern yellow keyword whole extern 24
keyword { yellow keyword { 14
keyword } yellow keyword } 14
keyword '*' green keyword '*' 6
# C comments # C comments
context /\\* \\*/ brown context /\\* \\*/ 22
# C preprocessor directives # C preprocessor directives
context linestart # \\n red context linestart # \\n 18
keyword \\\\\\n yellow keyword \\\\\\n 24
# C string constants # C string constants
context " " green context " " 6
keyword %d brightgreen keyword %d 24
keyword %s brightgreen keyword %s 24
keyword %c brightgreen keyword %c 24
keyword \\\\" brightgreen keyword \\\\" 24
.fi .fi
.PP .PP
Each context starts with a line of the form: Each context starts with a line of the form:
@ -261,20 +264,20 @@ seperator, it may not be used explicitedly. Also, \\* must be used to
specify a *. The * itself is a wildcard that matches any length of specify a *. The * itself is a wildcard that matches any length of
characters. For example, characters. For example,
.nf .nf
keyword '*' green keyword '*' 6
.fi .fi
colours all C single character constants green. You could also have colours all C single character constants green. You could also have
used used
.nf .nf
keyword "*" green keyword "*" 6
.fi .fi
to colour string constants, except that the matched string may not cross to colour string constants, except that the matched string may not cross
newlines. \fIThe wildcard may be used within context delimiters as newlines. \fIThe wildcard may be used within context delimiters as
well\fP, but you cannot have a wildcard as the last or first character. well\fP, but you \fBcannot have a wildcard as the last or first character\fP.
Important to note is the line Important to note is the line
.nf .nf
keyword \\\\\\n yellow keyword \\\\\\n 24
.fi .fi
This line defines a keyword containing the \\ and newline characters. This line defines a keyword containing the \\ and newline characters.
Because keywords have a higher precedence than context delimiters, this Because keywords have a higher precedence than context delimiters, this
@ -282,17 +285,42 @@ keyword prevents the context from ending at the end of a line if the
line ends in a \\ thus allowing C preprocessor directive to continue line ends in a \\ thus allowing C preprocessor directive to continue
across multiple lines. across multiple lines.
Comment may be included on a line of there own and begin with The colours themselves are numbered 0 to 26 and are explained below in
\fBFURTHER BEHAVIOURAL OPTIONS\fP. You can also use \fBany\fP of the named
colors specified in \fB/usr/lib/X11/rgb.txt\fP, though only one word
versions of them. It is better to stick to the numerical colors
to limit use of the color palette.
Comments may be included on a line of there own and begin with
a #. a #.
Because of the simplicity of the implementation, there are a few Because of the simplicity of the implementation, there are a few
intricacies that will not be coped with correctly, but these are a minor intricacies that will not be coped with correctly but these are a minor
irritation. On the whole, a broad spectrum of quite complicated irritation. On the whole, a broad spectrum of quite complicated
situations are handled with these simple rules. It is a good idea to situations are handled with these simple rules. It is a good idea to
take a look at the syntax file to see some of the nifty tricks you can take a look at the syntax file to see some of the nifty tricks you can
do with a little imagination. If you can't get by with the rules I have do with a little imagination. If you can't get by with the rules I have
coded, and you think you have rule that would be useful, please email coded, and you think you have a rule that would be useful, please email
me with your request. me with your request. However, do not ask for regular expression
support, because this is flatly impossible.
A useful hint is to work with as much as possible with the things
you \fIcan\fP do rather than try to do things that this
implimentation can't cope with. Also remember that the aim of
syntax highlighting is to make programming less prone to error,
\fInot\fP to make code look pretty.
.PP
.SH COLORS
The default colors may be changed by appending to the
\fBMC_COLOR_TABLE\fP environment variable. Foreground and
background colors pairs may be specified for example with:
.PP
.nf
MC_COLOR_TABLE="$MC_COLOR_TABLE:\
editnormal=lightgray,black:\
editbold=yellow,black:\
editmarked=black,cyan"
.fi
.PP .PP
.SH OPTIONS .SH OPTIONS
Most options can now be set from the editors options dialog Most options can now be set from the editors options dialog
@ -454,7 +482,7 @@ in /pub/Linux/apps/editors/X or at argeas.argos.hol.gr in
cooledit(1), mc(1), gpm(1), terminfo(1), scanf(3). cooledit(1), mc(1), gpm(1), terminfo(1), scanf(3).
.PP .PP
.SH AUTHORS .SH AUTHORS
Paul Sheer (psheer@icon.co.za) is the developer of Paul Sheer (psheer@obsidian.co.za) is the developer of
the Midnight Commander's internal editor. the Midnight Commander's internal editor.
.PP .PP
.SH BUGS .SH BUGS