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