[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Files Reference

vgrindefs File Format

Purpose

Contains the language definition database for the vgrind command.

Description

The vgrindefs file format contains all the language definitions for the vgrind command. The database is very similar to the terminfo file format (file of terminal capabilities).

Fields

The following table contains the name and description of each field:

Name Type Description
ab str Alternate regular expression for the start of a comment.
ae str Alternate regular expression for the end of a comment.
pb str Regular expression for the start of a procedure.
bb str Regular expression for the start of a lexical block.
be str Regular expression for the end of a lexical block.
cb str Regular expression for the start of a comment.
ce str Regular expression for the end of a comment.
sb str Regular expression for the start of a string.
se str Regular expression for the end of a string.
lb str Regular expression for the start of a character constant.
le str Regular expression for the end of a character constant.
tl bool Presence means procedures are only defined at the top lexical level.
oc bool Presence means upper and lowercase are equivalent.
kw str List of keywords separated by spaces.

Examples

The following entry, which describes the C language, is typical of a language entry:

C|c:    :pb=^\d?*?\d?\p\d??):bb={:be=}:cb=/*:ce=*/:sb=":se=\e":\
        :lb=':le=\e':tl:\
        :kw=asm auto break case char continue default do
         double else enum\
        extern float for fortran goto if int long register
         return short\
        sizeof static struct switch typedef union unsigned
         while #define\
        #else #endif #if #ifdef #ifndef #include #undef # define
         else endif\
        if ifdef ifndef include undef: 

The first field is the language name or any variants of the name. Thus the C language can be specified to the vgrind command in either lowercase or uppercase c.

Entries can continue onto multiple lines by giving a \ (backslash) as the last character of a line. The vgrindefs file format has the following two capabilities:

In Java, where comments can be delimited either by a starting "/*" or an ending "*", or by a starting "//" and "end" at the end of the line, the Java vgrindefs definition might be:

cb=/*:ce=*/:ab=//:ae=$

Regular Expressions

The vgrindefs file format uses regular expressions similar to those of the ex command and the lex command. The characters ^ (caret), $ (dollar sign), : (colon), and \ (backslash) are reserved characters and must be quoted with a preceding \ (backslash) if they are to be included as normal characters. The metasymbols and their meanings follow:

$ End of a line.
^ Beginning of a line.
\d Delimiter (space, tab, newline, start of line).
\a Matches any string of symbols, such as .* in the lex command.
\p Matches any alphanumeric name. In a procedure definition (pb), the string that matches this symbol is used as the procedure name.
() Grouping.
| Alternation.
? Last item is optional.
\e Preceding any string, means that the string does not match an input string if the input string is preceded by an escape character (\). Typically used for languages (such as C) that can include the string delimiter in a string by escaping it.

Unlike other regular expressions in the system, these metasymbols match words and not characters. Hence the pattern "(tramp|steamer)flies?" matches "tramp," "steamer," "trampflies," or "steamerflies."

Keyword List

The keyword list lists keywords in the language, separated by spaces. If the oc field is specified, indicating that uppercase and lowercase are equivalent, then all the keywords should be specified in lowercase.

Files

/usr/share/lib/vgrindefs Contains terminal descriptions.

Related Information

The ex command, lex command, troff command, vgrind command.

The terminfo file format.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]