chkdelim is a tool for detecting common delimiter errors in electronic documents and computer programs. It filters a list of files, or its standard input if no filenames are provided, matching group delimiters: angle brackets, curly braces, parentheses, square brackets, forward quotes (apostrophes or acutes), backward quotes (graves), quotation marks, and dollar signs (used in the TeX typesetting system).
Warning messages are printed to stdout whenever unbalanced delimiters are found, giving the delimiter and its line, column, and file positions. The output format is recognizable by the GNU emacs M-x compile command, making it easy to parse the warning messages and jump to their locations with the keystrokes C-x `(next-error).
Except in -Scribe mode, a backslash preceding a delimiter prevents it from being recognized as a delimiter. This is a suitable choice for TeX documents, as well as for C-like programming languages and UNIX shells. Use the -ignore option to override the special handling of backslash.
If unbalanced delimiters are needed, it is often possible to insert a matching delimiter in a nearby comment so that the delimiter appears to chkdelim to be properly balanced. This will reduce the number of messages issued, so that the real problems will be more evident.
chkdelim exits with a success code (0 on UNIX) if no warning messages are printed on stdout; otherwise, it exits with a failure code (1 on UNIX).
chkdelim recognizes, and handles transparently on all systems, the three popular flavors of text file line terminators: CR (Macintosh), CR LF (IBM PC DOS and Microsoft Windows), and LF (UNIX).
Language-specific options (-BibTeX, -Lisp, -Nroff, -Scribe, -TeX, and -TeXinfo), and their negations, should be given before other options, because they reset many internal flags that affect the handling of specific characters.
The leading hyphen that distinguishes an option from a filename may be doubled, for compatibility with GNU and POSIX conventions. Thus, -author and --author are equivalent.
To avoid confusion with options, if a filename begins with a hyphen, it must be disguised by a leading absolute or relative directory path, e.g., /tmp/-foo or ./-foo.
Processing is similar to that for -TeX, with the addition of these features:
- `@' characters at the start of a line begin a new paragraph, and restart the delimiter checks.
- Quotation marks are not significant when they are embedded inside two or more brace levels.
Since most delimiter characters have special significance to command shells, it will usually be necessary to protect them suitably from shell interpretation, such as with backslashes, or inside quoted strings.
Angle brackets are more commonly used for less-than and greater-than symbols, rather than <paired>, so -ignore \<\> will be a likely chkdelim option on UNIX systems.
When < and > are required in the -ignore argument, they may be represented by L and G (for less-than and greater-than). This avoids the danger of confusion with UNIX and IBM PC DOS input- and output-file redirection, and gets around the lack of support for protecting special characters on IBM PC DOS command lines.
With this option, single quotes following whitespace or an open parenthesis are ignored, since they are presumably Lisp shorthand for the quote function: (a is equivalent to (a
Backslash quotes the next character, preventing it from being considered as a possible delimiter.
A single quote between letters is ignored.
Angle brackets are ignored, since they are function names in most Lisp dialects.
Files in those Lisp dialects that use a single closing bracket to represent multiple closing parenthesis will generate warnings in such cases.
Backslash quotes the next character, preventing it from being considered as a possible delimiter. \*( is recognized so that it does not cause warnings about unbalanced parentheses.
Quote handling is the same as for the -TeX option.
`@' quotes the next character, preventing it from being considered as a possible delimiter.
Backslash is an ordinary character.
Quote handling is the same as for the -TeX option. In particular, this means that use of legal Scribe commands of the form @NAME'arg' and @NAME`arg` will produce warning messages.
Backslash quotes the next character, preventing it from being considered as a possible delimiter.
Unbackslashed dollar signs must be paired, either $ or $$ for inline and displayed mathematics, and the contents may not include an empty line. Without this option, dollar characters are always ignored.
Forward and backward quotes are checked to verify that they appear in open/close pairs: `...' and ``...'', instead of in the forms `...` and '...' used in computer programming languages.
For -TeX mode only, the special ligatures ?` and !` for Spanish inverted query and exclamation mark are recognized: they do not cause unbalanced-open-quote warnings.
The following special handling of quotes is in effect unless it has been suppressed by a -quote-check command-line option.
Forward quotes between letters or digits are ignored, so that possessives (Alice's) and elisions (O'Neill) do not raise bogus warnings.
A forward quote between a close brace and an s is assumed to be a possessive, as in {Cook}'s Voyage.
Forward quotes between a space and a digit, or beginning-of-line and a digit, are also ignored, so that text like ``Supercomputing '95'' does not raise warnings.
A forward quote preceding a lone s or t is assumed to reflect Dutch use, as in the personal name in 't Hout or the street name A. v. 's Gravesandestraat" .
`@' quotes the next character, preventing it from being considered as a possible delimiter.
Quote handling is the same as for the -TeX option.
Nelson H. F. Beebe, Ph.D. Center for Scientific Computing University of Utah Department of Mathematics, 322 INSCC 155 S 1400 E RM 233 Salt Lake City, UT 84112-0090 USA Tel: +1 801 581 5254 FAX: +1 801 585 1640, +1 801 581 4148 Email: beebe@math.utah.edu, beebe@acm.org, beebe@ieee.org (Internet) WWW URL: http://www.math.utah.edu/~beebe
http://www.math.utah.edu/pub/misc/index.html#chkdelimor equivalently, via anonymous ftp at
ftp://ftp.math.utah.edu/pub/misc/chkdelim-x.y.tar.gz ftp://ftp.math.utah.edu/pub/misc/chkdelim-x.y.zip ftp://ftp.math.utah.edu/pub/misc/chkdelim-x.y.zoowhere x.y is a version number.