[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [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 (see section 35.2 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 comment-fence
15 string-fence

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 (syntax-code . matching-char) corresponding to the syntax descriptor desc.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on May 2, 2002 using texi2html