Add the DragonFly cvs id and perform general cleanups on cvs/rcs/sccs ids. Most
[dragonfly.git] / usr.bin / vgrind / vgrindefs.5
1 .\" Copyright (c) 1989, 1991, 1993
2 .\"     The Regents of the University of California.  All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\"    notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\"    notice, this list of conditions and the following disclaimer in the
11 .\"    documentation and/or other materials provided with the distribution.
12 .\" 3. All advertising materials mentioning features or use of this software
13 .\"    must display the following acknowledgement:
14 .\"     This product includes software developed by the University of
15 .\"     California, Berkeley and its contributors.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\"    may be used to endorse or promote products derived from this software
18 .\"    without specific prior written permission.
19 .\"
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 .\" SUCH DAMAGE.
31 .\"
32 .\"     @(#)vgrindefs.5 8.1 (Berkeley) 6/6/93
33 .\" $FreeBSD: src/usr.bin/vgrind/vgrindefs.5,v 1.5.2.4 2001/08/16 13:17:13 ru Exp $
34 .\" $DragonFly: src/usr.bin/vgrind/vgrindefs.5,v 1.2 2003/06/17 04:29:33 dillon Exp $
35 .\"
36 .Dd June 6, 1993
37 .Dt VGRINDEFS 5
38 .Os
39 .Sh NAME
40 .Nm vgrindefs
41 .Nd language definition data base for
42 .Xr vgrind 1
43 .Sh SYNOPSIS
44 .Nm
45 .Sh DESCRIPTION
46 The
47 .Nm
48 file
49 contains all language definitions for
50 .Xr vgrind 1 .
51 The data base is
52 very similar to
53 .Xr termcap 5 .
54 .Sh FIELDS
55 The following table names and describes each field.
56 .Pp
57 .Bl -column Namexxx Tpexxx
58 .It Sy "Name    Type    Description
59 .It "ab str     regular expression for the start of an alternate comment"
60 .It "ae str     regular expression for the end of an alternate comment"
61 .It "pb str     regular expression for start of a procedure"
62 .It "bb str     regular expression for start of a lexical block"
63 .It "be str     regular expression for the end of a lexical block"
64 .It "cb str     regular expression for the start of a comment"
65 .It "ce str     regular expression for the end of a comment"
66 .It "sb str     regular expression for the start of a string"
67 .It "se str     regular expression for the end of a string"
68 .It "lb str     regular expression for the start of a character constant"
69 .It "le str     regular expression for the end of a character constant"
70 .It "nc str     regular expression for a non-comment (see below)"
71 .It "tl bool    present means procedures are only defined at the top lexical level"
72 .It "oc bool    present means upper and lower case are equivalent"
73 .It "kw str     a list of keywords separated by spaces"
74 .El
75 .Pp
76 Non-comments are required to describe a certain context where a
77 sequence that would normally start a comment loses its special
78 meaning.  A typical example for this can be found in Perl, where
79 comments are normally starting with
80 .Ql # ,
81 while the string
82 .Ql $#
83 is an operator on an array.
84 .Sh EXAMPLES
85 The following entry, which describes the C language, is
86 typical of a language entry.
87 .Bd -literal
88 C|c:\
89 :pb=^\ed?*?\ed?\ep\ed?\e(\ea?\e):bb={:be=}:cb=/*:ce=*/:sb=":se=\ee":\e
90 :lb=':le=\ee':tl:\e
91 :kw=asm auto break case char continue default do double else enum\e
92 extern float for fortran goto if int long register return short\e
93 sizeof static struct switch typedef union unsigned while #define\e
94 #else #endif #if #ifdef #ifndef #include #undef # define else endif\e
95 if ifdef ifndef include undef:
96 .Ed
97 .Pp
98 Note that the first field is just the language name (and any variants
99 of it).  Thus the C language could be specified to
100 .Xr vgrind 1
101 as "c" or "C".
102 .Pp
103 Entries may continue onto multiple lines by giving a \e as the last
104 character of a line.
105 Capabilities in
106 .Nm
107 are of two types:
108 Boolean capabilities which indicate that the language has
109 some particular feature
110 and string
111 capabilities which give a regular expression or
112 keyword list.
113 .Sh REGULAR  EXPRESSIONS
114 .Nm Vgrindefs
115 uses regular expression which are very similar to those of
116 .Xr ex 1
117 and
118 .Xr lex 1 .
119 The characters `^', `$', `:' and `\e'
120 are reserved characters and must be
121 "quoted" with a preceding
122 .Ql \e
123 if they
124 are to be included as normal characters.
125 The metasymbols and their meanings are:
126 .Bl -tag -width indent
127 .It $
128 the end of a line
129 .It \&^
130 the beginning of a line
131 .It \ed
132 a delimiter (space, tab, newline, start of line)
133 .It \ea
134 matches any string of symbols (like .* in lex)
135 .It \ep
136 matches any alphanumeric name.  In a procedure definition (pb) the string
137 that matches this symbol is used as the procedure name.
138 .It ()
139 grouping
140 .It \&|
141 alternation
142 .It ?
143 last item is optional
144 .It \ee
145 preceding any string means that the string will not match an
146 input string if the input string is preceded by an escape character (\e).
147 This is typically used for languages (like C) which can include the
148 string delimiter in a string by escaping it.
149 .El
150 .Pp
151 Unlike other regular expressions in the system,  these match words
152 and not characters.  Hence something like "(tramp|steamer)flies?"
153 would match "tramp", "steamer", "trampflies", or "steamerflies".
154 .Sh KEYWORD  LIST
155 The keyword list is just a list of keywords in the language separated
156 by spaces.  If the "oc" boolean is specified, indicating that upper
157 and lower case are equivalent, then all the keywords should be
158 specified in lower case.
159 .Sh FILES
160 .Bl -tag -width /usr/share/misc/vgrindefs -compact
161 .It Pa /usr/share/misc/vgrindefs
162 File containing terminal descriptions.
163 .El
164 .Sh SEE ALSO
165 .Xr troff 1 ,
166 .Xr vgrind 1
167 .Sh HISTORY
168 The
169 .Nm
170 file format appeared in
171 .Bx 4.2 .