xref: /original-bsd/usr.bin/vgrind/vgrindefs.5 (revision c3e32dec)
1.\" Copyright (c) 1989, 1991, 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" %sccs.include.redist.roff%
5.\"
6.\"     @(#)vgrindefs.5	8.1 (Berkeley) 06/06/93
7.\"
8.Dd
9.Dt VGRINDEFS 5
10.Os BSD 4.2
11.Sh NAME
12.Nm vgrindefs
13.Nd language definition data base for
14.Xr vgrind 1
15.Sh SYNOPSIS
16.Nm vgrindefs
17.Sh DESCRIPTION
18The
19.Nm vgrindefs
20file
21contains all language definitions for
22.Xr vgrind 1 .
23The data base is
24very similar to
25.Xr termcap 5 .
26.Sh FIELDS
27The following table names and describes each field.
28.Pp
29.Bl -column Namexxx Tpexxx
30.Sy Name	Type	Description
31.It "pb	str	regular expression for start of a procedure"
32.It "bb	str	regular expression for start of a lexical block"
33.It "be	str	regular expression for the end of a lexical block"
34.It "cb	str	regular expression for the start of a comment"
35.It "ce	str	regular expression for the end of a comment"
36.It "sb	str	regular expression for the start of a string"
37.It "se	str	regular expression for the end of a string"
38.It "lb	str	regular expression for the start of a character constant"
39.It "le	str	regular expression for the end of a character constant"
40.It "tl	bool	present means procedures are only defined at the top lexical level"
41.It "oc	bool	present means upper and lower case are equivalent"
42.It "kw	str	a list of keywords separated by spaces"
43.El
44.Pp
45.Sh EXAMPLES
46The following entry, which describes the C language, is
47typical of a language entry.
48.Bd -literal
49C|c:\
50:pb=^\ed?*?\ed?\ep\ed?\e(\ea?\e):bb={:be=}:cb=/*:ce=*/:sb=":se=\ee":\e
51:lb=':le=\ee':tl:\e
52:kw=asm auto break case char continue default do double else enum\e
53extern float for fortran goto if int long register return short\e
54sizeof static struct switch typedef union unsigned while #define\e
55#else #endif #if #ifdef #ifndef #include #undef # define else endif\e
56if ifdef ifndef include undef:
57.Ed
58.Pp
59Note that the first field is just the language name (and any variants
60of it).  Thus the C language could be specified to
61.Xr vgrind 1
62as "c" or "C".
63.Pp
64Entries may continue onto multiple lines by giving a \e as the last
65character of a line.
66Capabilities in
67.Nm vgrindefs
68are of two types:
69Boolean capabilities which indicate that the language has
70some particular feature
71and string
72capabilities which give a regular expression or
73keyword list.
74.Sh REGULAR  EXPRESSIONS
75.Nm Vgrindefs
76uses regular expression which are very similar to those of
77.Xr ex 1
78and
79.Xr lex 1 .
80The characters `^', `$', `:' and `\e'
81are reserved characters and must be
82"quoted" with a preceding
83.Ql \e
84if they
85are to be included as normal characters.
86The metasymbols and their meanings are:
87.Bl -tag -width indent
88.It $
89the end of a line
90.It \&^
91the beginning of a line
92.It \ed
93a delimiter (space, tab, newline, start of line)
94.It \ea
95matches any string of symbols (like .* in lex)
96.It \ep
97matches any alphanumeric name.  In a procedure definition (pb) the string
98that matches this symbol is used as the procedure name.
99.It ()
100grouping
101.It \&|
102alternation
103.It ?
104last item is optional
105.It \ee
106preceding any string means that the string will not match an
107input string if the input string is preceded by an escape character (\e).
108This is typically used for languages (like C) which can include the
109string delimiter in a string by escaping it.
110.El
111.Pp
112Unlike other regular expressions in the system,  these match words
113and not characters.  Hence something like "(tramp|steamer)flies?"
114would match "tramp", "steamer", "trampflies", or "steamerflies".
115.Sh KEYWORD  LIST
116The keyword list is just a list of keywords in the language separated
117by spaces.  If the "oc" boolean is specified, indicating that upper
118and lower case are equivalent, then all the keywords should be
119specified in lower case.
120.Sh FILES
121.Bl -tag -width /usr/share/misc/vgrindefs -compact
122.It Pa /usr/share/misc/vgrindefs
123File containing terminal descriptions.
124.El
125.Sh SEE ALSO
126.Xr vgrind 1 ,
127.Xr troff 1
128.Sh HISTORY
129The
130.Nm
131file format appeared in
132.Bx 4.2 .
133