Initial import from FreeBSD RELENG_4:
[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 .\"
35 .Dd June 6, 1993
36 .Dt VGRINDEFS 5
37 .Os
38 .Sh NAME
39 .Nm vgrindefs
40 .Nd language definition data base for
41 .Xr vgrind 1
42 .Sh SYNOPSIS
43 .Nm
44 .Sh DESCRIPTION
45 The
46 .Nm
47 file
48 contains all language definitions for
49 .Xr vgrind 1 .
50 The data base is
51 very similar to
52 .Xr termcap 5 .
53 .Sh FIELDS
54 The following table names and describes each field.
55 .Pp
56 .Bl -column Namexxx Tpexxx
57 .It Sy "Name    Type    Description
58 .It "ab str     regular expression for the start of an alternate comment"
59 .It "ae str     regular expression for the end of an alternate comment"
60 .It "pb str     regular expression for start of a procedure"
61 .It "bb str     regular expression for start of a lexical block"
62 .It "be str     regular expression for the end of a lexical block"
63 .It "cb str     regular expression for the start of a comment"
64 .It "ce str     regular expression for the end of a comment"
65 .It "sb str     regular expression for the start of a string"
66 .It "se str     regular expression for the end of a string"
67 .It "lb str     regular expression for the start of a character constant"
68 .It "le str     regular expression for the end of a character constant"
69 .It "nc str     regular expression for a non-comment (see below)"
70 .It "tl bool    present means procedures are only defined at the top lexical level"
71 .It "oc bool    present means upper and lower case are equivalent"
72 .It "kw str     a list of keywords separated by spaces"
73 .El
74 .Pp
75 Non-comments are required to describe a certain context where a
76 sequence that would normally start a comment loses its special
77 meaning.  A typical example for this can be found in Perl, where
78 comments are normally starting with
79 .Ql # ,
80 while the string
81 .Ql $#
82 is an operator on an array.
83 .Sh EXAMPLES
84 The following entry, which describes the C language, is
85 typical of a language entry.
86 .Bd -literal
87 C|c:\
88 :pb=^\ed?*?\ed?\ep\ed?\e(\ea?\e):bb={:be=}:cb=/*:ce=*/:sb=":se=\ee":\e
89 :lb=':le=\ee':tl:\e
90 :kw=asm auto break case char continue default do double else enum\e
91 extern float for fortran goto if int long register return short\e
92 sizeof static struct switch typedef union unsigned while #define\e
93 #else #endif #if #ifdef #ifndef #include #undef # define else endif\e
94 if ifdef ifndef include undef:
95 .Ed
96 .Pp
97 Note that the first field is just the language name (and any variants
98 of it).  Thus the C language could be specified to
99 .Xr vgrind 1
100 as "c" or "C".
101 .Pp
102 Entries may continue onto multiple lines by giving a \e as the last
103 character of a line.
104 Capabilities in
105 .Nm
106 are of two types:
107 Boolean capabilities which indicate that the language has
108 some particular feature
109 and string
110 capabilities which give a regular expression or
111 keyword list.
112 .Sh REGULAR  EXPRESSIONS
113 .Nm Vgrindefs
114 uses regular expression which are very similar to those of
115 .Xr ex 1
116 and
117 .Xr lex 1 .
118 The characters `^', `$', `:' and `\e'
119 are reserved characters and must be
120 "quoted" with a preceding
121 .Ql \e
122 if they
123 are to be included as normal characters.
124 The metasymbols and their meanings are:
125 .Bl -tag -width indent
126 .It $
127 the end of a line
128 .It \&^
129 the beginning of a line
130 .It \ed
131 a delimiter (space, tab, newline, start of line)
132 .It \ea
133 matches any string of symbols (like .* in lex)
134 .It \ep
135 matches any alphanumeric name.  In a procedure definition (pb) the string
136 that matches this symbol is used as the procedure name.
137 .It ()
138 grouping
139 .It \&|
140 alternation
141 .It ?
142 last item is optional
143 .It \ee
144 preceding any string means that the string will not match an
145 input string if the input string is preceded by an escape character (\e).
146 This is typically used for languages (like C) which can include the
147 string delimiter in a string by escaping it.
148 .El
149 .Pp
150 Unlike other regular expressions in the system,  these match words
151 and not characters.  Hence something like "(tramp|steamer)flies?"
152 would match "tramp", "steamer", "trampflies", or "steamerflies".
153 .Sh KEYWORD  LIST
154 The keyword list is just a list of keywords in the language separated
155 by spaces.  If the "oc" boolean is specified, indicating that upper
156 and lower case are equivalent, then all the keywords should be
157 specified in lower case.
158 .Sh FILES
159 .Bl -tag -width /usr/share/misc/vgrindefs -compact
160 .It Pa /usr/share/misc/vgrindefs
161 File containing terminal descriptions.
162 .El
163 .Sh SEE ALSO
164 .Xr troff 1 ,
165 .Xr vgrind 1
166 .Sh HISTORY
167 The
168 .Nm
169 file format appeared in
170 .Bx 4.2 .