[ < ] [ > ]   [ << ] [Plus haut] [ >> ]         [Top] [Table des matières] [Index] [ ? ]

35.8 Syntax Table Internals

Lisp programs don't usually work with the elements directly; the Lisp-level syntax table functions usually work with syntax descriptors (voir la section Syntax Descriptors). Nonetheless, here we document the internal format. This format is used mostly when manipulating syntax properties.

Each element of a syntax table is a cons cell of the form (syntax-code . matching-char). The CAR, syntax-code, is an integer that encodes the syntax class, and any flags. The CDR, matching-char, is non-nil if a character to match was specified.

This table gives the value of syntax-code which corresponds to each syntactic type.

Integer Class

Integer Class

Integer Class

0   whitespace

5   close parenthesis

10   character quote

1   punctuation

6   expression prefix

11   comment-start

2   word

7   string quote

12   comment-end

3   symbol

8   paired delimiter

13   inherit

4   open parenthesis

9   escape

14   generic comment

15  generic string

For example, the usual syntax value for ‘(’ is (4 . 41). (41 is the character code for ‘)’.)

The flags are encoded in higher order bits, starting 16 bits from the least significant bit. This table gives the power of two which corresponds to each syntax flag.

Prefix Flag

Prefix Flag

Prefix Flag

1’   (lsh 1 16)

4’   (lsh 1 19)

b’   (lsh 1 21)

2’   (lsh 1 17)

p’   (lsh 1 20)

n’   (lsh 1 22)

3’   (lsh 1 18)

Function: string-to-syntax desc

This function returns the internal form corresponding to the syntax descriptor desc, a cons cell (syntax-code . matching-char).

Function: syntax-after pos

This function returns the syntax code of the character in the buffer after position pos, taking account of syntax properties as well as the syntax table. If pos is outside the buffer's accessible portion (voir la section accessible portion), this function returns nil.

Function: syntax-class syntax

This function returns the syntax class of the syntax code syntax. (It masks off the high 16 bits that hold the flags encoded in the syntax descriptor.) If syntax is nil, it returns nil; this is so evaluating the expression

 
(syntax-class (syntax-after pos))

where pos is outside the buffer's accessible portion, will yield nil without throwing errors or producing wrong syntax class codes.


[ < ] [ > ]   [ << ] [Plus haut] [ >> ]         [Top] [Table des matières] [Index] [ ? ]

Ce document a été généré par Eric Reinbold le 13 Octobre 2007 en utilisant texi2html 1.78.