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