2 @c This is part of the SXEmacs Lisp Reference Manual.
3 @c Copyright (C) 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
4 @c Copyright (C) 2005 Sebastian Freundt <hroptatyr@sxemacs.org>
5 @c See the file lispref.texi for copying conditions.
6 @setfilename ../../info/syntax.info
8 @node Syntax Tables, Abbrevs, Searching and Matching, Top
14 A @dfn{syntax table} specifies the syntactic textual function of each
15 character. This information is used by the parsing commands, the
16 complex movement commands, and others to determine where words, symbols,
17 and other syntactic constructs begin and end. The current syntax table
18 controls the meaning of the word motion functions (@pxref{Word Motion})
19 and the list motion functions (@pxref{List Motion}) as well as the
20 functions in this chapter.
23 * Basics: Syntax Basics. Basic concepts of syntax tables.
24 * Desc: Syntax Descriptors. How characters are classified.
25 * Syntax Table Functions:: How to create, examine and alter syntax tables.
26 * Motion and Syntax:: Moving over characters with certain syntaxes.
27 * Parsing Expressions:: Parsing balanced expressions
28 using the syntax table.
29 * Standard Syntax Tables:: Syntax tables used by various major modes.
30 * Syntax Table Internals:: How syntax table information is stored.
35 @section Syntax Table Concepts
38 A @dfn{syntax table} provides SXEmacs with the information that
39 determines the syntactic use of each character in a buffer. This
40 information is used by the parsing commands, the complex movement
41 commands, and others to determine where words, symbols, and other
42 syntactic constructs begin and end. The current syntax table controls
43 the meaning of the word motion functions (@pxref{Word Motion}) and the
44 list motion functions (@pxref{List Motion}) as well as the functions in
48 Under all SXEmacs versions a syntax table is a particular subtype of the
49 primitive char table type (@pxref{Char Tables}), and each element of the
50 char table is an integer that encodes the syntax of the character in
51 question, or a cons of such an integer and a matching character (for
52 characters with parenthesis syntax).
53 XEmacs version 20 and later handles it this way, too.
55 Under XEmacs 19, a syntax table is a vector of 256 elements; it
56 contains one entry for each of the 256 possible characters in an 8-bit
57 byte. Each element is an integer that encodes the syntax of the
58 character in question. (The matching character, if any, is embedded
59 in the bits of this integer.)
61 Syntax tables are used only for moving across text, not for the Emacs
62 Lisp reader. SXEmacs Lisp uses built-in syntactic rules when reading Lisp
63 expressions, and these rules cannot be changed.
65 Each buffer has its own major mode, and each major mode has its own
66 idea of the syntactic class of various characters. For example, in Lisp
67 mode, the character @samp{;} begins a comment, but in C mode, it
68 terminates a statement. To support these variations, SXEmacs makes the
69 choice of syntax table local to each buffer. Typically, each major
70 mode has its own syntax table and installs that table in each buffer
71 that uses that mode. Changing this table alters the syntax in all
72 those buffers as well as in any buffers subsequently put in that mode.
73 Occasionally several similar modes share one syntax table.
74 @xref{Example Major Modes}, for an example of how to set up a syntax
77 A syntax table can inherit the data for some characters from the
78 standard syntax table, while specifying other characters itself. The
79 ``inherit'' syntax class means ``inherit this character's syntax from
80 the standard syntax table.'' Most major modes' syntax tables inherit
81 the syntax of character codes 0 through 31 and 128 through 255. This is
82 useful with character sets such as ISO Latin-1 that have additional
83 alphabetic characters in the range 128 to 255. Just changing the
84 standard syntax for these characters affects all major modes.
86 @defun syntax-table-p object
87 This function returns @code{t} if @var{object} is a vector of length 256
88 elements. This means that the vector may be a syntax table. However,
89 according to this test, any vector of length 256 is considered to be a
90 syntax table, no matter what its contents.
94 @node Syntax Descriptors
95 @section Syntax Descriptors
96 @cindex syntax classes
98 This section describes the syntax classes and flags that denote the
99 syntax of a character, and how they are represented as a @dfn{syntax
100 descriptor}, which is a Lisp string that you pass to
101 @code{modify-syntax-entry} to specify the desired syntax.
103 SXEmacs defines a number of @dfn{syntax classes}. Each syntax table
104 puts each character into one class. There is no necessary relationship
105 between the class of a character in one syntax table and its class in
108 Each class is designated by a mnemonic character, which serves as the
109 name of the class when you need to specify a class. Usually the
110 designator character is one that is frequently in that class; however,
111 its meaning as a designator is unvarying and independent of what syntax
112 that character currently has.
114 @cindex syntax descriptor
115 A syntax descriptor is a Lisp string that specifies a syntax class, a
116 matching character (used only for the parenthesis classes) and flags.
117 The first character is the designator for a syntax class. The second
118 character is the character to match; if it is unused, put a space there.
119 Then come the characters for any desired flags. If no matching
120 character or flags are needed, one character is sufficient.
122 For example, the descriptor for the character @samp{*} in C mode is
123 @samp{@w{. 23}} (i.e., punctuation, matching character slot unused,
124 second character of a comment-starter, first character of an
125 comment-ender), and the entry for @samp{/} is @samp{@w{. 14}} (i.e.,
126 punctuation, matching character slot unused, first character of a
127 comment-starter, second character of a comment-ender).
130 * Syntax Class Table:: Table of syntax classes.
131 * Syntax Flags:: Additional flags each character can have.
135 @node Syntax Class Table
136 @subsection Table of Syntax Classes
138 Here is a table of syntax classes, the characters that stand for them,
139 their meanings, and examples of their use.
141 @deffn {Syntax class} @w{whitespace character}
142 @dfn{Whitespace characters} (designated with @samp{-})
143 separate symbols and words from each other. Typically, whitespace
144 characters have no other syntactic significance, and multiple whitespace
145 characters are syntactically equivalent to a single one. Space, tab,
146 newline and formfeed are almost always classified as whitespace. (The
147 designator @w{@samp{@ }} is accepted for backwards compatibility with
148 older versions of XEmacs, but is deprecated. It is invalid in GNU Emacs.)
151 @deffn {Syntax class} @w{word constituent}
152 @dfn{Word constituents} (designated with @samp{w}) are parts of normal
153 English words and are typically used in variable and command names in
154 programs. All upper- and lower-case letters, and the digits, are typically
158 @deffn {Syntax class} @w{symbol constituent}
159 @dfn{Symbol constituents} (designated with @samp{_}) are the extra
160 characters that are used in variable and command names along with word
161 constituents. For example, the symbol constituents class is used in
162 Lisp mode to indicate that certain characters may be part of symbol
163 names even though they are not part of English words. These characters
164 are @samp{$&*+-_<>}. In standard C, the only non-word-constituent
165 character that is valid in symbols is underscore (@samp{_}).
168 @deffn {Syntax class} @w{punctuation character}
169 @dfn{Punctuation characters} (@samp{.}) are those characters that are
170 used as punctuation in English, or are used in some way in a programming
171 language to separate symbols from one another. Most programming
172 language modes, including Emacs Lisp mode, have no characters in this
173 class since the few characters that are not symbol or word constituents
177 @deffn {Syntax class} @w{open parenthesis character}
178 @deffnx {Syntax class} @w{close parenthesis character}
179 @cindex parenthesis syntax
180 Open and close @dfn{parenthesis characters} are characters used in
181 dissimilar pairs to surround sentences or expressions. Such a grouping
182 is begun with an open parenthesis character and terminated with a close.
183 Each open parenthesis character matches a particular close parenthesis
184 character, and vice versa. Normally, SXEmacs indicates momentarily the
185 matching open parenthesis when you insert a close parenthesis.
188 The class of open parentheses is designated with @samp{(}, and that of
189 close parentheses with @samp{)}.
191 In English text, and in C code, the parenthesis pairs are @samp{()},
192 @samp{[]}, and @samp{@{@}}. In SXEmacs Lisp, the delimiters for lists and
193 vectors (@samp{()} and @samp{[]}) are classified as parenthesis
197 @deffn {Syntax class} @w{string quote}
198 @dfn{String quote characters} (designated with @samp{"}) are used in
199 many languages, including Lisp and C, to delimit string constants. The
200 same string quote character appears at the beginning and the end of a
201 string. Such quoted strings do not nest.
203 The parsing facilities of SXEmacs consider a string as a single token.
204 The usual syntactic meanings of the characters in the string are
207 The Lisp modes have two string quote characters: double-quote (@samp{"})
208 and vertical bar (@samp{|}). @samp{|} is not used in SXEmacs Lisp, but it
209 is used in Common Lisp. C also has two string quote characters:
210 double-quote for strings, and single-quote (@samp{'}) for character
213 English text has no string quote characters because English is not a
214 programming language. Although quotation marks are used in English,
215 we do not want them to turn off the usual syntactic properties of
216 other characters in the quotation.
219 @deffn {Syntax class} @w{escape}
220 An @dfn{escape character} (designated with @samp{\}) starts an escape
221 sequence such as is used in C string and character constants. The
222 character @samp{\} belongs to this class in both C and Lisp. (In C, it
223 is used thus only inside strings, but it turns out to cause no trouble
224 to treat it this way throughout C code.)
226 Characters in this class count as part of words if
227 @code{words-include-escapes} is non-@code{nil}. @xref{Word Motion}.
230 @deffn {Syntax class} @w{character quote}
231 A @dfn{character quote character} (designated with @samp{/}) quotes the
232 following character so that it loses its normal syntactic meaning. This
233 differs from an escape character in that only the character immediately
234 following is ever affected.
236 Characters in this class count as part of words if
237 @code{words-include-escapes} is non-@code{nil}. @xref{Word Motion}.
239 This class is used for backslash in @TeX{} mode.
242 @deffn {Syntax class} @w{paired delimiter}
243 @dfn{Paired delimiter characters} (designated with @samp{$}) are like
244 string quote characters except that the syntactic properties of the
245 characters between the delimiters are not suppressed. Only @TeX{} mode
246 uses a paired delimiter presently---the @samp{$} that both enters and
250 @deffn {Syntax class} @w{expression prefix}
251 An @dfn{expression prefix operator} (designated with @samp{'}) is used
252 for syntactic operators that are part of an expression if they appear
253 next to one. These characters in Lisp include the apostrophe, @samp{'}
254 (used for quoting), the comma, @samp{,} (used in macros), and @samp{#}
255 (used in the read syntax for certain data types).
258 @deffn {Syntax class} @w{comment starter}
259 @deffnx {Syntax class} @w{comment ender}
260 @cindex comment syntax
261 The @dfn{comment starter} and @dfn{comment ender} characters are used in
262 various languages to delimit comments. These classes are designated
263 with @samp{<} and @samp{>}, respectively.
265 English text has no comment characters. In Lisp, the semicolon
266 (@samp{;}) starts a comment and a newline or formfeed ends one.
269 @deffn {Syntax class} @w{inherit}
270 This syntax class does not specify a syntax. It says to look in the
271 standard syntax table to find the syntax of this character. The
272 designator for this syntax code is @samp{@@}.
277 @subsection Syntax Flags
280 @c This is a bit inaccurate, the ``a'' and ``b'' flags actually don't
281 @c exist in the internal implementation. AFAICT it doesn't affect the
282 @c semantics as perceived by the LISP programmer.
283 In addition to the classes, entries for characters in a syntax table
284 can include flags. There are eleven possible flags, represented by the
285 digits @samp{1}--@samp{8}, and the lowercase letters @samp{a}, @samp{b},
288 All the flags except @samp{p} are used to describe comment delimiters.
289 The digit flags indicate that a character can @emph{also} be part of a
290 multi-character comment sequence, in addition to the syntactic
291 properties associated with its character class. The flags must be
292 independent of the class and each other for the sake of characters such
293 as @samp{*} in C mode, which is a punctuation character, @emph{and} the
294 second character of a start-of-comment sequence (@samp{/*}), @emph{and}
295 the first character of an end-of-comment sequence (@samp{*/}).
297 SXEmacs supports two comment styles simultaneously in any one syntax
298 table. This is for the sake of C++. Each style of comment syntax has
299 its own comment-start sequence and its own comment-end sequence. Each
300 comment must stick to one style or the other; thus, if it starts with
301 the comment-start sequence of style ``b'', it must also end with the
302 comment-end sequence of style ``b''.
304 @c #### Compatibility note; index here.
305 As an extension to GNU Emacs 19 and 20, SXEmacs supports two arbitrary
306 comment-start sequences and two arbitrary comment-end sequences. (Thus
307 the need for 8 flags.) GNU Emacs restricts the comment-start sequences
308 to start with the same character, SXEmacs does not. This means that for
309 two-character sequences, where GNU Emacs uses the @samp{b} flag, SXEmacs
310 uses the digit flags @samp{5}--@samp{8}.
312 A one character comment-end sequence applies to the ``b'' style if its
313 first character has the @samp{b} flag set; otherwise, it applies to the
314 ``a'' style. The @samp{a} flag is optional. These flags have no effect
315 on non-comment characters; two-character styles are determined by the
318 The flags for a character @var{c} are:
322 @samp{1} means @var{c} is the start of a two-character comment-start
323 sequence of style ``a''.
326 @samp{2} means @var{c} is the second character of such a sequence.
329 @samp{3} means @var{c} is the start of a two-character comment-end
330 sequence of style ``a''.
333 @samp{4} means @var{c} is the second character of such a sequence.
336 @samp{5} means @var{c} is the start of a two-character comment-start
337 sequence of style ``b''.
340 @samp{6} means @var{c} is the second character of such a sequence.
343 @samp{7} means @var{c} is the start of a two-character comment-end
344 sequence of style ``b''.
347 @samp{8} means @var{c} is the second character of such a sequence.
350 @samp{a} means that @var{c} as a comment delimiter belongs to the
351 default ``a'' comment style. (This flag is optional.)
355 @samp{b} means that @var{c} as a comment delimiter belongs to the
356 alternate ``b'' comment style.
360 @samp{p} identifies an additional ``prefix character'' for Lisp syntax.
361 These characters are treated as whitespace when they appear between
362 expressions. When they appear within an expression, they are handled
363 according to their usual syntax codes.
365 The function @code{backward-prefix-chars} moves back over these
366 characters, as well as over characters whose primary syntax class is
367 prefix (@samp{'}). @xref{Motion and Syntax}.
370 Lisp (as you would expect) has a simple comment syntax.
379 Note that no flags are used.
380 This defines two comment-delimiting sequences:
384 This is a single-character comment-start sequence because the syntax
388 This is a single character comment-end sequence because the syntax class
389 is @samp{>} and the @samp{b} flag is not set.
392 C++ (again, as you would expect) has a baroque, overrich, and
393 excessively complex comment syntax.
404 Note that the ``b'' style mixes one-character and two-character
405 sequences. The table above defines four comment-delimiting sequences:
409 This is a comment-start sequence for ``a'' style because the @samp{1}
410 flag is set on @samp{/} and the @samp{2} flag is set on @samp{*}.
413 This is a comment-start sequence for ``b'' style because both the @samp{5}
414 and the @samp{6} flags are set on @samp{/}.
417 This is a comment-end sequence for ``a'' style because the @samp{3}
418 flag is set on @samp{*} and the @samp{4} flag is set on @samp{/}.
421 This is a comment-end sequence for ``b'' style, because the newline
422 character has the @samp{b} flag.
426 @node Syntax Table Functions
427 @section Syntax Table Functions
429 In this section we describe functions for creating, accessing and
430 altering syntax tables.
432 @defun make-syntax-table &optional oldtable
433 This function creates a new syntax table. Character codes 0 through
434 31 and 128 through 255 are set up to inherit from the standard syntax
435 table. The other character codes are set up by copying what the
436 standard syntax table says about them.
438 Most major mode syntax tables are created in this way.
441 @defun copy-syntax-table &optional syntax-table
442 This function constructs a copy of @var{syntax-table} and returns it.
443 If @var{syntax-table} is not supplied (or is @code{nil}), it returns a
444 copy of the current syntax table. Otherwise, an error is signaled if
445 @var{syntax-table} is not a syntax table.
448 @deffn Command modify-syntax-entry char-range syntax-descriptor &optional syntax-table
449 This function sets the syntax entry for @var{char-range} according to
450 @var{syntax-descriptor}. @var{char-range} is either a single character
451 or a range of characters, as used with @code{put-char-table}. The syntax
452 is changed only for @var{syntax-table}, which defaults to the current
453 buffer's syntax table, and not in any other syntax table. The argument
454 @var{syntax-descriptor} specifies the desired syntax; this is a string
455 beginning with a class designator character, and optionally containing a
456 matching character and flags as well. @xref{Syntax Descriptors}.
458 This function always returns @code{nil}. The old syntax information in
459 the table for @var{char-range} is discarded.
461 An error is signaled if the first character of the syntax descriptor is not
462 one of the twelve syntax class designator characters.
466 @exdent @r{Examples:}
468 ;; @r{Put the space character in class whitespace.}
469 (modify-syntax-entry ?\ " ")
474 ;; @r{Make @samp{$} an open parenthesis character,}
475 ;; @r{with @samp{^} as its matching close.}
476 (modify-syntax-entry ?$ "(^")
481 ;; @r{Make @samp{^} a close parenthesis character,}
482 ;; @r{with @samp{$} as its matching open.}
483 (modify-syntax-entry ?^ ")$")
488 ;; @r{Make @samp{/} a punctuation character,}
489 ;; @r{the first character of a start-comment sequence,}
490 ;; @r{and the second character of an end-comment sequence.}
491 ;; @r{This is used in C mode.}
492 (modify-syntax-entry ?/ ". 14")
498 @defun char-syntax character &optional syntax-table
499 This function returns the syntax class of @var{character}, represented
500 by its mnemonic designator character. This @emph{only} returns the
501 class, not any matching parenthesis or flags.
503 An error is signaled if @var{character} is not a character.
505 The characters that correspond to various syntax codes
506 are listed in the documentation of @code{modify-syntax-entry}.
508 Optional second argument @var{syntax-table} is the syntax table to be
509 used, and defaults to the current buffer's syntax table.
511 The following examples apply to C mode. The first example shows that
512 the syntax class of space is whitespace (represented by a space). The
513 second example shows that the syntax of @samp{/} is punctuation. This
514 does not show the fact that it is also part of comment-start and -end
515 sequences. The third example shows that open parenthesis is in the class
516 of open parentheses. This does not show the fact that it has a matching
521 (char-to-string (char-syntax ?\ ))
526 (char-to-string (char-syntax ?/))
531 (char-to-string (char-syntax ?\())
537 @defun set-syntax-table syntax-table &optional buffer
538 This function makes @var{syntax-table} the syntax table for @var{buffer}, which
539 defaults to the current buffer if omitted. It returns @var{syntax-table}.
542 @defun syntax-table &optional buffer
543 This function returns the syntax table for @var{buffer}, which defaults
544 to the current buffer if omitted.
548 @node Motion and Syntax
549 @section Motion and Syntax
551 This section describes functions for moving across characters in
552 certain syntax classes. None of these functions exists in Emacs
553 version 18 or earlier.
555 @defun skip-syntax-forward syntaxes &optional limit buffer
556 This function moves point forward across characters having syntax classes
557 mentioned in @var{syntaxes}. It stops when it encounters the end of
558 the buffer, or position @var{limit} (if specified), or a character it is
559 not supposed to skip. Optional argument @var{buffer} defaults to the
560 current buffer if omitted.
561 @ignore @c may want to change this.
562 The return value is the distance traveled, which is a nonnegative
567 @defun skip-syntax-backward syntaxes &optional limit buffer
568 This function moves point backward across characters whose syntax
569 classes are mentioned in @var{syntaxes}. It stops when it encounters
570 the beginning of the buffer, or position @var{limit} (if specified), or a
571 character it is not supposed to skip. Optional argument @var{buffer}
572 defaults to the current buffer if omitted.
574 @ignore @c may want to change this.
575 The return value indicates the distance traveled. It is an integer that
580 @defun backward-prefix-chars &optional buffer
581 This function moves point backward over any number of characters with
582 expression prefix syntax. This includes both characters in the
583 expression prefix syntax class, and characters with the @samp{p} flag.
584 Optional argument @var{buffer} defaults to the current buffer if
589 @node Parsing Expressions
590 @section Parsing Balanced Expressions
592 Here are several functions for parsing and scanning balanced
593 expressions, also known as @dfn{sexps}, in which parentheses match in
594 pairs. The syntax table controls the interpretation of characters, so
595 these functions can be used for Lisp expressions when in Lisp mode and
596 for C expressions when in C mode. @xref{List Motion}, for convenient
597 higher-level functions for moving over balanced expressions.
599 @defun parse-partial-sexp start limit &optional target-depth stop-before state stop-comment buffer
600 This function parses a sexp in the current buffer starting at
601 @var{start}, not scanning past @var{limit}. It stops at position
602 @var{limit} or when certain criteria described below are met, and sets
603 point to the location where parsing stops. It returns a value
604 describing the status of the parse at the point where it stops.
606 If @var{state} is @code{nil}, @var{start} is assumed to be at the top
607 level of parenthesis structure, such as the beginning of a function
608 definition. Alternatively, you might wish to resume parsing in the
609 middle of the structure. To do this, you must provide a @var{state}
610 argument that describes the initial status of parsing.
612 @cindex parenthesis depth
613 If the third argument @var{target-depth} is non-@code{nil}, parsing
614 stops if the depth in parentheses becomes equal to @var{target-depth}.
615 The depth starts at 0, or at whatever is given in @var{state}.
617 If the fourth argument @var{stop-before} is non-@code{nil}, parsing
618 stops when it comes to any character that starts a sexp. If
619 @var{stop-comment} is non-@code{nil}, parsing stops when it comes to the
623 The fifth argument @var{state} is an eight-element list of the same
624 form as the value of this function, described below. The return value
625 of one call may be used to initialize the state of the parse on another
626 call to @code{parse-partial-sexp}.
628 The result is a list of eight elements describing the final state of
633 The depth in parentheses, counting from 0.
636 @cindex innermost containing parentheses
637 The character position of the start of the innermost parenthetical
638 grouping containing the stopping point; @code{nil} if none.
641 @cindex previous complete subexpression
642 The character position of the start of the last complete subexpression
643 terminated; @code{nil} if none.
646 @cindex inside string
647 Non-@code{nil} if inside a string. More precisely, this is the
648 character that will terminate the string.
651 @cindex inside comment
652 @code{t} if inside a comment (of either style).
655 @cindex quote character
656 @code{t} if point is just after a quote character.
659 The minimum parenthesis depth encountered during this scan.
662 @code{t} if inside a comment of style ``b''.
665 Elements 0, 3, 4, 5 and 7 are significant in the argument @var{state}.
667 @cindex indenting with parentheses
668 This function is most often used to compute indentation for languages
669 that have nested parentheses.
672 @defun scan-lists from count depth &optional buffer noerror
673 This function scans forward @var{count} balanced parenthetical groupings
674 from character number @var{from}. It returns the character position
675 where the scan stops.
677 If @var{depth} is nonzero, parenthesis depth counting begins from that
678 value. The only candidates for stopping are places where the depth in
679 parentheses becomes zero; @code{scan-lists} counts @var{count} such
680 places and then stops. Thus, a positive value for @var{depth} means go
681 out @var{depth} levels of parenthesis.
683 Scanning ignores comments if @code{parse-sexp-ignore-comments} is
686 If the scan reaches the beginning or end of the buffer (or its
687 accessible portion), and the depth is not zero, an error is signaled.
688 If the depth is zero but the count is not used up, @code{nil} is
691 If optional arg @var{buffer} is non-@code{nil}, scanning occurs in that
692 buffer instead of in the current buffer.
694 If optional arg @var{noerror} is non-@code{nil}, @code{scan-lists}
695 will return @code{nil} instead of signalling an error.
698 @defun scan-sexps from count &optional buffer noerror
699 This function scans forward @var{count} sexps from character position
700 @var{from}. It returns the character position where the scan stops.
702 Scanning ignores comments if @code{parse-sexp-ignore-comments} is
705 If the scan reaches the beginning or end of (the accessible part of) the
706 buffer in the middle of a parenthetical grouping, an error is signaled.
707 If it reaches the beginning or end between groupings but before count is
708 used up, @code{nil} is returned.
710 If optional arg @var{buffer} is non-@code{nil}, scanning occurs in
711 that buffer instead of in the current buffer.
713 If optional arg @var{noerror} is non-@code{nil}, @code{scan-sexps}
714 will return nil instead of signalling an error.
717 @defvar parse-sexp-ignore-comments
718 @cindex skipping comments
719 If the value is non-@code{nil}, then comments are treated as
720 whitespace by the functions in this section and by @code{forward-sexp}.
722 In older Emacs versions, this feature worked only when the comment
723 terminator is something like @samp{*/}, and appears only to end a
724 comment. In languages where newlines terminate comments, it was
725 necessary make this variable @code{nil}, since not every newline is the
726 end of a comment. This limitation no longer exists.
729 You can use @code{forward-comment} to move forward or backward over
730 one comment or several comments.
732 @defun forward-comment &optional count buffer
733 This function moves point forward across @var{count} comments (backward,
734 if @var{count} is negative). If it finds anything other than a comment
735 or whitespace, it stops, leaving point at the place where it stopped.
736 It also stops after satisfying @var{count}. @var{count} defaults to @code{1}.
738 Optional argument @var{buffer} defaults to the current buffer.
741 To move forward over all comments and whitespace following point, use
742 @code{(forward-comment (buffer-size))}. @code{(buffer-size)} is a good
743 argument to use, because the number of comments in the buffer cannot
747 @node Standard Syntax Tables
748 @section Some Standard Syntax Tables
750 Most of the major modes in SXEmacs have their own syntax tables. Here
753 @defun standard-syntax-table
754 This function returns the standard syntax table, which is the syntax
755 table used in Fundamental mode.
758 @defvar text-mode-syntax-table
759 The value of this variable is the syntax table used in Text mode.
762 @defvar c-mode-syntax-table
763 The value of this variable is the syntax table for C-mode buffers.
766 @defvar emacs-lisp-mode-syntax-table
767 The value of this variable is the syntax table used in Emacs Lisp mode
768 by editing commands. (It has no effect on the Lisp @code{read}
773 @node Syntax Table Internals
774 @section Syntax Table Internals
775 @cindex syntax table internals
777 Each element of a syntax table is an integer that encodes the syntax
778 of one character: the syntax class, possible matching character, and
779 flags. Lisp programs don't usually work with the elements directly; the
780 Lisp-level syntax table functions usually work with syntax descriptors
781 (@pxref{Syntax Descriptors}).
783 The low 8 bits of each element of a syntax table indicate the
819 The next 8 bits are the matching opposite parenthesis (if the
820 character has parenthesis syntax); otherwise, they are not meaningful.
821 The next 6 bits are the flags.