Next: , Previous: , Up: Syntax Descriptors   [Contents][Index]


45.2.1 Table of Syntax Classes

Here is a table of syntax classes, the characters that stand for them, their meanings, and examples of their use.

Syntax class: whitespace character

Whitespace characters (designated with ‘-’) separate symbols and words from each other. Typically, whitespace characters have no other syntactic significance, and multiple whitespace characters are syntactically equivalent to a single one. Space, tab, newline and formfeed are almost always classified as whitespace. (The designator ‘  is accepted for backwards compatibility with older versions of XEmacs, but is deprecated. It is invalid in GNU Emacs.)

Syntax class: word constituent

Word constituents (designated with ‘w’) are parts of normal English words and are typically used in variable and command names in programs. All upper- and lower-case letters, and the digits, are typically word constituents.

Syntax class: symbol constituent

Symbol constituents (designated with ‘_’) are the extra characters that are used in variable and command names along with word constituents. For example, the symbol constituents class is used in Lisp mode to indicate that certain characters may be part of symbol names even though they are not part of English words. These characters are ‘$&*+-_<>’. In standard C, the only non-word-constituent character that is valid in symbols is underscore (‘_’).

Syntax class: punctuation character

Punctuation characters (‘.’) are those characters that are used as punctuation in English, or are used in some way in a programming language to separate symbols from one another. Most programming language modes, including Emacs Lisp mode, have no characters in this class since the few characters that are not symbol or word constituents all have other uses.

Syntax class: open parenthesis character
Syntax class: close parenthesis character

Open and close parenthesis characters are characters used in dissimilar pairs to surround sentences or expressions. Such a grouping is begun with an open parenthesis character and terminated with a close. Each open parenthesis character matches a particular close parenthesis character, and vice versa. Normally, SXEmacs indicates momentarily the matching open parenthesis when you insert a close parenthesis. See Blinking.

The class of open parentheses is designated with ‘(’, and that of close parentheses with ‘)’.

In English text, and in C code, the parenthesis pairs are ‘()’, ‘[]’, and ‘{}’. In SXEmacs Lisp, the delimiters for lists and vectors (‘()’ and ‘[]’) are classified as parenthesis characters.

Syntax class: string quote

String quote characters (designated with ‘"’) are used in many languages, including Lisp and C, to delimit string constants. The same string quote character appears at the beginning and the end of a string. Such quoted strings do not nest.

The parsing facilities of SXEmacs consider a string as a single token. The usual syntactic meanings of the characters in the string are suppressed.

The Lisp modes have two string quote characters: double-quote (‘"’) and vertical bar (‘|’). ‘|’ is not used in SXEmacs Lisp, but it is used in Common Lisp. C also has two string quote characters: double-quote for strings, and single-quote (‘'’) for character constants.

English text has no string quote characters because English is not a programming language. Although quotation marks are used in English, we do not want them to turn off the usual syntactic properties of other characters in the quotation.

Syntax class: escape

An escape character (designated with ‘\’) starts an escape sequence such as is used in C string and character constants. The character ‘\’ belongs to this class in both C and Lisp. (In C, it is used thus only inside strings, but it turns out to cause no trouble to treat it this way throughout C code.)

Characters in this class count as part of words if words-include-escapes is non-nil. See Word Motion.

Syntax class: character quote

A character quote character (designated with ‘/’) quotes the following character so that it loses its normal syntactic meaning. This differs from an escape character in that only the character immediately following is ever affected.

Characters in this class count as part of words if words-include-escapes is non-nil. See Word Motion.

This class is used for backslash in TeX mode.

Syntax class: paired delimiter

Paired delimiter characters (designated with ‘$’) are like string quote characters except that the syntactic properties of the characters between the delimiters are not suppressed. Only TeX mode uses a paired delimiter presently—the ‘$’ that both enters and leaves math mode.

Syntax class: expression prefix

An expression prefix operator (designated with ‘'’) is used for syntactic operators that are part of an expression if they appear next to one. These characters in Lisp include the apostrophe, ‘'’ (used for quoting), the comma, ‘,’ (used in macros), and ‘#’ (used in the read syntax for certain data types).

Syntax class: comment starter
Syntax class: comment ender

The comment starter and comment ender characters are used in various languages to delimit comments. These classes are designated with ‘<’ and ‘>’, respectively.

English text has no comment characters. In Lisp, the semicolon (‘;’) starts a comment and a newline or formfeed ends one.

Syntax class: inherit

This syntax class does not specify a syntax. It says to look in the standard syntax table to find the syntax of this character. The designator for this syntax code is ‘@’.


Next: , Previous: , Up: Syntax Descriptors   [Contents][Index]