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