comparison src/syntax.c @ 40103:6b389fb978bc

Change doc-string comments to `new style' [w/`doc:' keyword].
author Pavel Jan?k <Pavel@Janik.cz>
date Sat, 20 Oct 2001 20:54:39 +0000
parents dcc6aae53ac8
children d13b14b50715
comparison
equal deleted inserted replaced
40102:d001bdd0593d 40103:6b389fb978bc
712 712
713 return (from == comment_end) ? -1 : from; 713 return (from == comment_end) ? -1 : from;
714 } 714 }
715 715
716 DEFUN ("syntax-table-p", Fsyntax_table_p, Ssyntax_table_p, 1, 1, 0, 716 DEFUN ("syntax-table-p", Fsyntax_table_p, Ssyntax_table_p, 1, 1, 0,
717 "Return t if OBJECT is a syntax table.\n\ 717 doc: /* Return t if OBJECT is a syntax table.
718 Currently, any char-table counts as a syntax table.") 718 Currently, any char-table counts as a syntax table. */)
719 (object) 719 (object)
720 Lisp_Object object; 720 Lisp_Object object;
721 { 721 {
722 if (CHAR_TABLE_P (object) 722 if (CHAR_TABLE_P (object)
723 && EQ (XCHAR_TABLE (object)->purpose, Qsyntax_table)) 723 && EQ (XCHAR_TABLE (object)->purpose, Qsyntax_table))
724 return Qt; 724 return Qt;
733 && EQ (XCHAR_TABLE (obj)->purpose, Qsyntax_table))) 733 && EQ (XCHAR_TABLE (obj)->purpose, Qsyntax_table)))
734 wrong_type_argument (Qsyntax_table_p, obj); 734 wrong_type_argument (Qsyntax_table_p, obj);
735 } 735 }
736 736
737 DEFUN ("syntax-table", Fsyntax_table, Ssyntax_table, 0, 0, 0, 737 DEFUN ("syntax-table", Fsyntax_table, Ssyntax_table, 0, 0, 0,
738 "Return the current syntax table.\n\ 738 doc: /* Return the current syntax table.
739 This is the one specified by the current buffer.") 739 This is the one specified by the current buffer. */)
740 () 740 ()
741 { 741 {
742 return current_buffer->syntax_table; 742 return current_buffer->syntax_table;
743 } 743 }
744 744
745 DEFUN ("standard-syntax-table", Fstandard_syntax_table, 745 DEFUN ("standard-syntax-table", Fstandard_syntax_table,
746 Sstandard_syntax_table, 0, 0, 0, 746 Sstandard_syntax_table, 0, 0, 0,
747 "Return the standard syntax table.\n\ 747 doc: /* Return the standard syntax table.
748 This is the one used for new buffers.") 748 This is the one used for new buffers. */)
749 () 749 ()
750 { 750 {
751 return Vstandard_syntax_table; 751 return Vstandard_syntax_table;
752 } 752 }
753 753
754 DEFUN ("copy-syntax-table", Fcopy_syntax_table, Scopy_syntax_table, 0, 1, 0, 754 DEFUN ("copy-syntax-table", Fcopy_syntax_table, Scopy_syntax_table, 0, 1, 0,
755 "Construct a new syntax table and return it.\n\ 755 doc: /* Construct a new syntax table and return it.
756 It is a copy of the TABLE, which defaults to the standard syntax table.") 756 It is a copy of the TABLE, which defaults to the standard syntax table. */)
757 (table) 757 (table)
758 Lisp_Object table; 758 Lisp_Object table;
759 { 759 {
760 Lisp_Object copy; 760 Lisp_Object copy;
761 761
762 if (!NILP (table)) 762 if (!NILP (table))
777 Fset_char_table_parent (copy, Vstandard_syntax_table); 777 Fset_char_table_parent (copy, Vstandard_syntax_table);
778 return copy; 778 return copy;
779 } 779 }
780 780
781 DEFUN ("set-syntax-table", Fset_syntax_table, Sset_syntax_table, 1, 1, 0, 781 DEFUN ("set-syntax-table", Fset_syntax_table, Sset_syntax_table, 1, 1, 0,
782 "Select a new syntax table for the current buffer.\n\ 782 doc: /* Select a new syntax table for the current buffer.
783 One argument, a syntax table.") 783 One argument, a syntax table. */)
784 (table) 784 (table)
785 Lisp_Object table; 785 Lisp_Object table;
786 { 786 {
787 int idx; 787 int idx;
788 check_syntax_table (table); 788 check_syntax_table (table);
789 current_buffer->syntax_table = table; 789 current_buffer->syntax_table = table;
857 return value; 857 return value;
858 } 858 }
859 } 859 }
860 860
861 DEFUN ("char-syntax", Fchar_syntax, Schar_syntax, 1, 1, 0, 861 DEFUN ("char-syntax", Fchar_syntax, Schar_syntax, 1, 1, 0,
862 "Return the syntax code of CHARACTER, described by a character.\n\ 862 doc: /* Return the syntax code of CHARACTER, described by a character.
863 For example, if CHARACTER is a word constituent,\n\ 863 For example, if CHARACTER is a word constituent,
864 the character `w' is returned.\n\ 864 the character `w' is returned.
865 The characters that correspond to various syntax codes\n\ 865 The characters that correspond to various syntax codes
866 are listed in the documentation of `modify-syntax-entry'.") 866 are listed in the documentation of `modify-syntax-entry'. */)
867 (character) 867 (character)
868 Lisp_Object character; 868 Lisp_Object character;
869 { 869 {
870 int char_int; 870 int char_int;
871 gl_state.current_syntax_table = current_buffer->syntax_table; 871 gl_state.current_syntax_table = current_buffer->syntax_table;
872 872
875 char_int = XINT (character); 875 char_int = XINT (character);
876 return make_number (syntax_code_spec[(int) SYNTAX (char_int)]); 876 return make_number (syntax_code_spec[(int) SYNTAX (char_int)]);
877 } 877 }
878 878
879 DEFUN ("matching-paren", Fmatching_paren, Smatching_paren, 1, 1, 0, 879 DEFUN ("matching-paren", Fmatching_paren, Smatching_paren, 1, 1, 0,
880 "Return the matching parenthesis of CHARACTER, or nil if none.") 880 doc: /* Return the matching parenthesis of CHARACTER, or nil if none. */)
881 (character) 881 (character)
882 Lisp_Object character; 882 Lisp_Object character;
883 { 883 {
884 int char_int, code; 884 int char_int, code;
885 gl_state.current_syntax_table = current_buffer->syntax_table; 885 gl_state.current_syntax_table = current_buffer->syntax_table;
886 gl_state.use_global = 0; 886 gl_state.use_global = 0;
891 return SYNTAX_MATCH (char_int); 891 return SYNTAX_MATCH (char_int);
892 return Qnil; 892 return Qnil;
893 } 893 }
894 894
895 DEFUN ("string-to-syntax", Fstring_to_syntax, Sstring_to_syntax, 1, 1, 0, 895 DEFUN ("string-to-syntax", Fstring_to_syntax, Sstring_to_syntax, 1, 1, 0,
896 "Convert a syntax specification STRING into syntax cell form.\n\ 896 doc: /* Convert a syntax specification STRING into syntax cell form.
897 STRING should be a string as it is allowed as argument of\n\ 897 STRING should be a string as it is allowed as argument of
898 `modify-syntax-entry'. Value is the equivalent cons cell\n\ 898 `modify-syntax-entry'. Value is the equivalent cons cell
899 \(CODE . MATCHING-CHAR) that can be used as value of a `syntax-table'\n\ 899 (CODE . MATCHING-CHAR) that can be used as value of a `syntax-table'
900 text property.") 900 text property. */)
901 (string) 901 (string)
902 Lisp_Object string; 902 Lisp_Object string;
903 { 903 {
904 register unsigned char *p; 904 register unsigned char *p;
905 register enum syntaxcode code; 905 register enum syntaxcode code;
906 int val; 906 int val;
967 else 967 else
968 /* Since we can't use a shared object, let's make a new one. */ 968 /* Since we can't use a shared object, let's make a new one. */
969 return Fcons (make_number (val), match); 969 return Fcons (make_number (val), match);
970 } 970 }
971 971
972 /* This comment supplies the doc string for modify-syntax-entry, 972 /* I really don't know why this is interactive
973 for make-docfile to see. We cannot put this in the real DEFUN 973 help-form should at least be made useful whilst reading the second arg
974 due to limits in the Unix cpp.
975
976 DEFUN ("modify-syntax-entry", foo, bar, 2, 3, 0,
977 "Set syntax for character CHAR according to string S.\n\
978 The syntax is changed only for table TABLE, which defaults to\n\
979 the current buffer's syntax table.\n\
980 The first character of S should be one of the following:\n\
981 Space or - whitespace syntax. w word constituent.\n\
982 _ symbol constituent. . punctuation.\n\
983 ( open-parenthesis. ) close-parenthesis.\n\
984 \" string quote. \\ escape.\n\
985 $ paired delimiter. ' expression quote or prefix operator.\n\
986 < comment starter. > comment ender.\n\
987 / character-quote. @ inherit from `standard-syntax-table'.\n\
988 | generic string fence. ! generic comment fence.\n\
989 \n\
990 Only single-character comment start and end sequences are represented thus.\n\
991 Two-character sequences are represented as described below.\n\
992 The second character of S is the matching parenthesis,\n\
993 used only if the first character is `(' or `)'.\n\
994 Any additional characters are flags.\n\
995 Defined flags are the characters 1, 2, 3, 4, b, p, and n.\n\
996 1 means CHAR is the start of a two-char comment start sequence.\n\
997 2 means CHAR is the second character of such a sequence.\n\
998 3 means CHAR is the start of a two-char comment end sequence.\n\
999 4 means CHAR is the second character of such a sequence.\n\
1000 \n\
1001 There can be up to two orthogonal comment sequences. This is to support\n\
1002 language modes such as C++. By default, all comment sequences are of style\n\
1003 a, but you can set the comment sequence style to b (on the second character\n\
1004 of a comment-start, or the first character of a comment-end sequence) using\n\
1005 this flag:\n\
1006 b means CHAR is part of comment sequence b.\n\
1007 n means CHAR is part of a nestable comment sequence.\n\
1008 \n\
1009 p means CHAR is a prefix character for `backward-prefix-chars';\n\
1010 such characters are treated as whitespace when they occur\n\
1011 between expressions.")
1012 (char, s, table)
1013 */ 974 */
1014
1015 DEFUN ("modify-syntax-entry", Fmodify_syntax_entry, Smodify_syntax_entry, 2, 3, 975 DEFUN ("modify-syntax-entry", Fmodify_syntax_entry, Smodify_syntax_entry, 2, 3,
1016 /* I really don't know why this is interactive
1017 help-form should at least be made useful whilst reading the second arg
1018 */
1019 "cSet syntax for character: \nsSet syntax for %s to: ", 976 "cSet syntax for character: \nsSet syntax for %s to: ",
1020 0 /* See immediately above */) 977 doc: /* Set syntax for character C according to string NEWENTRY.
1021 (c, newentry, syntax_table) 978 The syntax is changed only for table SYNTAX_TABLE, which defaults to
979 the current buffer's syntax table.
980 The first character of NEWENTRY should be one of the following:
981 Space or - whitespace syntax. w word constituent.
982 _ symbol constituent. . punctuation.
983 ( open-parenthesis. ) close-parenthesis.
984 " string quote. \\ escape.
985 $ paired delimiter. ' expression quote or prefix operator.
986 < comment starter. > comment ender.
987 / character-quote. @ inherit from `standard-syntax-table'.
988 | generic string fence. ! generic comment fence.
989
990 Only single-character comment start and end sequences are represented thus.
991 Two-character sequences are represented as described below.
992 The second character of NEWENTRY is the matching parenthesis,
993 used only if the first character is `(' or `)'.
994 Any additional characters are flags.
995 Defined flags are the characters 1, 2, 3, 4, b, p, and n.
996 1 means C is the start of a two-char comment start sequence.
997 2 means C is the second character of such a sequence.
998 3 means C is the start of a two-char comment end sequence.
999 4 means C is the second character of such a sequence.
1000
1001 There can be up to two orthogonal comment sequences. This is to support
1002 language modes such as C++. By default, all comment sequences are of style
1003 a, but you can set the comment sequence style to b (on the second character
1004 of a comment-start, or the first character of a comment-end sequence) using
1005 this flag:
1006 b means C is part of comment sequence b.
1007 n means C is part of a nestable comment sequence.
1008
1009 p means C is a prefix character for `backward-prefix-chars';
1010 such characters are treated as whitespace when they occur
1011 between expressions. */)
1012 (c, newentry, syntax_table)
1022 Lisp_Object c, newentry, syntax_table; 1013 Lisp_Object c, newentry, syntax_table;
1023 { 1014 {
1024 CHECK_NUMBER (c, 0); 1015 CHECK_NUMBER (c, 0);
1025 1016
1026 if (NILP (syntax_table)) 1017 if (NILP (syntax_table))
1199 set_buffer_internal (old); 1190 set_buffer_internal (old);
1200 return Qnil; 1191 return Qnil;
1201 } 1192 }
1202 1193
1203 DEFUN ("describe-syntax", Fdescribe_syntax, Sdescribe_syntax, 0, 0, "", 1194 DEFUN ("describe-syntax", Fdescribe_syntax, Sdescribe_syntax, 0, 0, "",
1204 "Describe the syntax specifications in the syntax table.\n\ 1195 doc: /* Describe the syntax specifications in the syntax table.
1205 The descriptions are inserted in a buffer, which is then displayed.") 1196 The descriptions are inserted in a buffer, which is then displayed. */)
1206 () 1197 ()
1207 { 1198 {
1208 internal_with_output_to_temp_buffer 1199 internal_with_output_to_temp_buffer
1209 ("*Help*", describe_syntax_1, current_buffer->syntax_table); 1200 ("*Help*", describe_syntax_1, current_buffer->syntax_table);
1210 1201
1211 return Qnil; 1202 return Qnil;
1313 1304
1314 return from; 1305 return from;
1315 } 1306 }
1316 1307
1317 DEFUN ("forward-word", Fforward_word, Sforward_word, 1, 1, "p", 1308 DEFUN ("forward-word", Fforward_word, Sforward_word, 1, 1, "p",
1318 "Move point forward ARG words (backward if ARG is negative).\n\ 1309 doc: /* Move point forward ARG words (backward if ARG is negative).
1319 Normally returns t.\n\ 1310 Normally returns t.
1320 If an edge of the buffer or a field boundary is reached, point is left there\n\ 1311 If an edge of the buffer or a field boundary is reached, point is left there
1321 and the function returns nil. Field boundaries are not noticed if\n\ 1312 and the function returns nil. Field boundaries are not noticed if
1322 `inhibit-field-text-motion' is non-nil.") 1313 `inhibit-field-text-motion' is non-nil. */)
1323 (count) 1314 (count)
1324 Lisp_Object count; 1315 Lisp_Object count;
1325 { 1316 {
1326 int orig_val, val; 1317 int orig_val, val;
1327 CHECK_NUMBER (count, 0); 1318 CHECK_NUMBER (count, 0);
1328 1319
1339 } 1330 }
1340 1331
1341 Lisp_Object skip_chars (); 1332 Lisp_Object skip_chars ();
1342 1333
1343 DEFUN ("skip-chars-forward", Fskip_chars_forward, Sskip_chars_forward, 1, 2, 0, 1334 DEFUN ("skip-chars-forward", Fskip_chars_forward, Sskip_chars_forward, 1, 2, 0,
1344 "Move point forward, stopping before a char not in STRING, or at pos LIM.\n\ 1335 doc: /* Move point forward, stopping before a char not in STRING, or at pos LIM.
1345 STRING is like the inside of a `[...]' in a regular expression\n\ 1336 STRING is like the inside of a `[...]' in a regular expression
1346 except that `]' is never special and `\\' quotes `^', `-' or `\\'\n\ 1337 except that `]' is never special and `\\' quotes `^', `-' or `\\'
1347 (but not as the end of a range; quoting is never needed there).\n\ 1338 (but not as the end of a range; quoting is never needed there).
1348 Thus, with arg \"a-zA-Z\", this skips letters stopping before first nonletter.\n\ 1339 Thus, with arg "a-zA-Z", this skips letters stopping before first nonletter.
1349 With arg \"^a-zA-Z\", skips nonletters stopping before first letter.\n\ 1340 With arg "^a-zA-Z", skips nonletters stopping before first letter.
1350 Returns the distance traveled, either zero or positive.") 1341 Returns the distance traveled, either zero or positive. */)
1351 (string, lim) 1342 (string, lim)
1352 Lisp_Object string, lim; 1343 Lisp_Object string, lim;
1353 { 1344 {
1354 return skip_chars (1, 0, string, lim); 1345 return skip_chars (1, 0, string, lim);
1355 } 1346 }
1356 1347
1357 DEFUN ("skip-chars-backward", Fskip_chars_backward, Sskip_chars_backward, 1, 2, 0, 1348 DEFUN ("skip-chars-backward", Fskip_chars_backward, Sskip_chars_backward, 1, 2, 0,
1358 "Move point backward, stopping after a char not in STRING, or at pos LIM.\n\ 1349 doc: /* Move point backward, stopping after a char not in STRING, or at pos LIM.
1359 See `skip-chars-forward' for details.\n\ 1350 See `skip-chars-forward' for details.
1360 Returns the distance traveled, either zero or negative.") 1351 Returns the distance traveled, either zero or negative. */)
1361 (string, lim) 1352 (string, lim)
1362 Lisp_Object string, lim; 1353 Lisp_Object string, lim;
1363 { 1354 {
1364 return skip_chars (0, 0, string, lim); 1355 return skip_chars (0, 0, string, lim);
1365 } 1356 }
1366 1357
1367 DEFUN ("skip-syntax-forward", Fskip_syntax_forward, Sskip_syntax_forward, 1, 2, 0, 1358 DEFUN ("skip-syntax-forward", Fskip_syntax_forward, Sskip_syntax_forward, 1, 2, 0,
1368 "Move point forward across chars in specified syntax classes.\n\ 1359 doc: /* Move point forward across chars in specified syntax classes.
1369 SYNTAX is a string of syntax code characters.\n\ 1360 SYNTAX is a string of syntax code characters.
1370 Stop before a char whose syntax is not in SYNTAX, or at position LIM.\n\ 1361 Stop before a char whose syntax is not in SYNTAX, or at position LIM.
1371 If SYNTAX starts with ^, skip characters whose syntax is NOT in SYNTAX.\n\ 1362 If SYNTAX starts with ^, skip characters whose syntax is NOT in SYNTAX.
1372 This function returns the distance traveled, either zero or positive.") 1363 This function returns the distance traveled, either zero or positive. */)
1373 (syntax, lim) 1364 (syntax, lim)
1374 Lisp_Object syntax, lim; 1365 Lisp_Object syntax, lim;
1375 { 1366 {
1376 return skip_chars (1, 1, syntax, lim); 1367 return skip_chars (1, 1, syntax, lim);
1377 } 1368 }
1378 1369
1379 DEFUN ("skip-syntax-backward", Fskip_syntax_backward, Sskip_syntax_backward, 1, 2, 0, 1370 DEFUN ("skip-syntax-backward", Fskip_syntax_backward, Sskip_syntax_backward, 1, 2, 0,
1380 "Move point backward across chars in specified syntax classes.\n\ 1371 doc: /* Move point backward across chars in specified syntax classes.
1381 SYNTAX is a string of syntax code characters.\n\ 1372 SYNTAX is a string of syntax code characters.
1382 Stop on reaching a char whose syntax is not in SYNTAX, or at position LIM.\n\ 1373 Stop on reaching a char whose syntax is not in SYNTAX, or at position LIM.
1383 If SYNTAX starts with ^, skip characters whose syntax is NOT in SYNTAX.\n\ 1374 If SYNTAX starts with ^, skip characters whose syntax is NOT in SYNTAX.
1384 This function returns the distance traveled, either zero or negative.") 1375 This function returns the distance traveled, either zero or negative. */)
1385 (syntax, lim) 1376 (syntax, lim)
1386 Lisp_Object syntax, lim; 1377 Lisp_Object syntax, lim;
1387 { 1378 {
1388 return skip_chars (0, 1, syntax, lim); 1379 return skip_chars (0, 1, syntax, lim);
1389 } 1380 }
1390 1381
1809 *bytepos_ptr = from_byte; 1800 *bytepos_ptr = from_byte;
1810 return 1; 1801 return 1;
1811 } 1802 }
1812 1803
1813 DEFUN ("forward-comment", Fforward_comment, Sforward_comment, 1, 1, 0, 1804 DEFUN ("forward-comment", Fforward_comment, Sforward_comment, 1, 1, 0,
1814 "Move forward across up to N comments. If N is negative, move backward.\n\ 1805 doc: /* Move forward across up to N comments. If N is negative, move backward.
1815 Stop scanning if we find something other than a comment or whitespace.\n\ 1806 Stop scanning if we find something other than a comment or whitespace.
1816 Set point to where scanning stops.\n\ 1807 Set point to where scanning stops.
1817 If N comments are found as expected, with nothing except whitespace\n\ 1808 If N comments are found as expected, with nothing except whitespace
1818 between them, return t; otherwise return nil.") 1809 between them, return t; otherwise return nil. */)
1819 (count) 1810 (count)
1820 Lisp_Object count; 1811 Lisp_Object count;
1821 { 1812 {
1822 register int from; 1813 register int from;
1823 int from_byte; 1814 int from_byte;
1824 register int stop; 1815 register int stop;
2397 2388
2398 /* NOTREACHED */ 2389 /* NOTREACHED */
2399 } 2390 }
2400 2391
2401 DEFUN ("scan-lists", Fscan_lists, Sscan_lists, 3, 3, 0, 2392 DEFUN ("scan-lists", Fscan_lists, Sscan_lists, 3, 3, 0,
2402 "Scan from character number FROM by COUNT lists.\n\ 2393 doc: /* Scan from character number FROM by COUNT lists.
2403 Returns the character number of the position thus found.\n\ 2394 Returns the character number of the position thus found.
2404 \n\ 2395
2405 If DEPTH is nonzero, paren depth begins counting from that value,\n\ 2396 If DEPTH is nonzero, paren depth begins counting from that value,
2406 only places where the depth in parentheses becomes zero\n\ 2397 only places where the depth in parentheses becomes zero
2407 are candidates for stopping; COUNT such places are counted.\n\ 2398 are candidates for stopping; COUNT such places are counted.
2408 Thus, a positive value for DEPTH means go out levels.\n\ 2399 Thus, a positive value for DEPTH means go out levels.
2409 \n\ 2400
2410 Comments are ignored if `parse-sexp-ignore-comments' is non-nil.\n\ 2401 Comments are ignored if `parse-sexp-ignore-comments' is non-nil.
2411 \n\ 2402
2412 If the beginning or end of (the accessible part of) the buffer is reached\n\ 2403 If the beginning or end of (the accessible part of) the buffer is reached
2413 and the depth is wrong, an error is signaled.\n\ 2404 and the depth is wrong, an error is signaled.
2414 If the depth is right but the count is not used up, nil is returned.") 2405 If the depth is right but the count is not used up, nil is returned. */)
2415 (from, count, depth) 2406 (from, count, depth)
2416 Lisp_Object from, count, depth; 2407 Lisp_Object from, count, depth;
2417 { 2408 {
2418 CHECK_NUMBER (from, 0); 2409 CHECK_NUMBER (from, 0);
2419 CHECK_NUMBER (count, 1); 2410 CHECK_NUMBER (count, 1);
2420 CHECK_NUMBER (depth, 2); 2411 CHECK_NUMBER (depth, 2);
2421 2412
2422 return scan_lists (XINT (from), XINT (count), XINT (depth), 0); 2413 return scan_lists (XINT (from), XINT (count), XINT (depth), 0);
2423 } 2414 }
2424 2415
2425 DEFUN ("scan-sexps", Fscan_sexps, Sscan_sexps, 2, 2, 0, 2416 DEFUN ("scan-sexps", Fscan_sexps, Sscan_sexps, 2, 2, 0,
2426 "Scan from character number FROM by COUNT balanced expressions.\n\ 2417 doc: /* Scan from character number FROM by COUNT balanced expressions.
2427 If COUNT is negative, scan backwards.\n\ 2418 If COUNT is negative, scan backwards.
2428 Returns the character number of the position thus found.\n\ 2419 Returns the character number of the position thus found.
2429 \n\ 2420
2430 Comments are ignored if `parse-sexp-ignore-comments' is non-nil.\n\ 2421 Comments are ignored if `parse-sexp-ignore-comments' is non-nil.
2431 \n\ 2422
2432 If the beginning or end of (the accessible part of) the buffer is reached\n\ 2423 If the beginning or end of (the accessible part of) the buffer is reached
2433 in the middle of a parenthetical grouping, an error is signaled.\n\ 2424 in the middle of a parenthetical grouping, an error is signaled.
2434 If the beginning or end is reached between groupings\n\ 2425 If the beginning or end is reached between groupings
2435 but before count is used up, nil is returned.") 2426 but before count is used up, nil is returned. */)
2436 (from, count) 2427 (from, count)
2437 Lisp_Object from, count; 2428 Lisp_Object from, count;
2438 { 2429 {
2439 CHECK_NUMBER (from, 0); 2430 CHECK_NUMBER (from, 0);
2440 CHECK_NUMBER (count, 1); 2431 CHECK_NUMBER (count, 1);
2441 2432
2442 return scan_lists (XINT (from), XINT (count), 0, 1); 2433 return scan_lists (XINT (from), XINT (count), 0, 1);
2443 } 2434 }
2444 2435
2445 DEFUN ("backward-prefix-chars", Fbackward_prefix_chars, Sbackward_prefix_chars, 2436 DEFUN ("backward-prefix-chars", Fbackward_prefix_chars, Sbackward_prefix_chars,
2446 0, 0, 0, 2437 0, 0, 0,
2447 "Move point backward over any number of chars with prefix syntax.\n\ 2438 doc: /* Move point backward over any number of chars with prefix syntax.
2448 This includes chars with \"quote\" or \"prefix\" syntax (' or p).") 2439 This includes chars with "quote" or "prefix" syntax (' or p). */)
2449 () 2440 ()
2450 { 2441 {
2451 int beg = BEGV; 2442 int beg = BEGV;
2452 int opoint = PT; 2443 int opoint = PT;
2453 int opoint_byte = PT_BYTE; 2444 int opoint_byte = PT_BYTE;
2454 int pos = PT; 2445 int pos = PT;
2834 immediate_quit = 0; 2825 immediate_quit = 0;
2835 2826
2836 *stateptr = state; 2827 *stateptr = state;
2837 } 2828 }
2838 2829
2839 /* This comment supplies the doc string for parse-partial-sexp,
2840 for make-docfile to see. We cannot put this in the real DEFUN
2841 due to limits in the Unix cpp.
2842
2843 DEFUN ("parse-partial-sexp", Ffoo, Sfoo, 2, 6, 0,
2844 "Parse Lisp syntax starting at FROM until TO; return status of parse at TO.\n\
2845 Parsing stops at TO or when certain criteria are met;\n\
2846 point is set to where parsing stops.\n\
2847 If fifth arg STATE is omitted or nil,\n\
2848 parsing assumes that FROM is the beginning of a function.\n\
2849 Value is a list of ten elements describing final state of parsing:\n\
2850 0. depth in parens.\n\
2851 1. character address of start of innermost containing list; nil if none.\n\
2852 2. character address of start of last complete sexp terminated.\n\
2853 3. non-nil if inside a string.\n\
2854 (it is the character that will terminate the string,\n\
2855 or t if the string should be terminated by a generic string delimiter.)\n\
2856 4. nil if outside a comment, t if inside a non-nestable comment, \n\
2857 else an integer (the current comment nesting).\n\
2858 5. t if following a quote character.\n\
2859 6. the minimum paren-depth encountered during this scan.\n\
2860 7. t if in a comment of style b; symbol `syntax-table' if the comment\n\
2861 should be terminated by a generic comment delimiter.\n\
2862 8. character address of start of comment or string; nil if not in one.\n\
2863 9. Intermediate data for continuation of parsing (subject to change).\n\
2864 If third arg TARGETDEPTH is non-nil, parsing stops if the depth\n\
2865 in parentheses becomes equal to TARGETDEPTH.\n\
2866 Fourth arg STOPBEFORE non-nil means stop when come to\n\
2867 any character that starts a sexp.\n\
2868 Fifth arg STATE is a nine-element list like what this function returns.\n\
2869 It is used to initialize the state of the parse. Elements number 1, 2, 6\n\
2870 and 8 are ignored; you can leave off element 8 (the last) entirely.\n\
2871 Sixth arg COMMENTSTOP non-nil means stop at the start of a comment.\n\
2872 If it is symbol `syntax-table', stop after the start of a comment or a\n\
2873 string, or after end of a comment or a string.")
2874 (from, to, targetdepth, stopbefore, state, commentstop)
2875 */
2876
2877 DEFUN ("parse-partial-sexp", Fparse_partial_sexp, Sparse_partial_sexp, 2, 6, 0, 2830 DEFUN ("parse-partial-sexp", Fparse_partial_sexp, Sparse_partial_sexp, 2, 6, 0,
2878 0 /* See immediately above */) 2831 doc: /* Parse Lisp syntax starting at FROM until TO; return status of parse at TO.
2879 (from, to, targetdepth, stopbefore, oldstate, commentstop) 2832 Parsing stops at TO or when certain criteria are met;
2833 point is set to where parsing stops.
2834 If fifth arg OLDSTATE is omitted or nil,
2835 parsing assumes that FROM is the beginning of a function.
2836 Value is a list of ten elements describing final state of parsing:
2837 0. depth in parens.
2838 1. character address of start of innermost containing list; nil if none.
2839 2. character address of start of last complete sexp terminated.
2840 3. non-nil if inside a string.
2841 (it is the character that will terminate the string,
2842 or t if the string should be terminated by a generic string delimiter.)
2843 4. nil if outside a comment, t if inside a non-nestable comment,
2844 else an integer (the current comment nesting).
2845 5. t if following a quote character.
2846 6. the minimum paren-depth encountered during this scan.
2847 7. t if in a comment of style b; symbol `syntax-table' if the comment
2848 should be terminated by a generic comment delimiter.
2849 8. character address of start of comment or string; nil if not in one.
2850 9. Intermediate data for continuation of parsing (subject to change).
2851 If third arg TARGETDEPTH is non-nil, parsing stops if the depth
2852 in parentheses becomes equal to TARGETDEPTH.
2853 Fourth arg STOPBEFORE non-nil means stop when come to
2854 any character that starts a sexp.
2855 Fifth arg OLDSTATE is a nine-element list like what this function returns.
2856 It is used to initialize the state of the parse. Elements number 1, 2, 6
2857 and 8 are ignored; you can leave off element 8 (the last) entirely.
2858 Sixth arg COMMENTSTOP non-nil means stop at the start of a comment.
2859 If it is symbol `syntax-table', stop after the start of a comment or a
2860 string, or after end of a comment or a string. */)
2861 (from, to, targetdepth, stopbefore, oldstate, commentstop)
2880 Lisp_Object from, to, targetdepth, stopbefore, oldstate, commentstop; 2862 Lisp_Object from, to, targetdepth, stopbefore, oldstate, commentstop;
2881 { 2863 {
2882 struct lisp_parse_state state; 2864 struct lisp_parse_state state;
2883 int target; 2865 int target;
2884 2866
3012 Fcons (Qscan_error, Fcons (Qerror, Qnil))); 2994 Fcons (Qscan_error, Fcons (Qerror, Qnil)));
3013 Fput (Qscan_error, Qerror_message, 2995 Fput (Qscan_error, Qerror_message,
3014 build_string ("Scan error")); 2996 build_string ("Scan error"));
3015 2997
3016 DEFVAR_BOOL ("parse-sexp-ignore-comments", &parse_sexp_ignore_comments, 2998 DEFVAR_BOOL ("parse-sexp-ignore-comments", &parse_sexp_ignore_comments,
3017 "Non-nil means `forward-sexp', etc., should treat comments as whitespace."); 2999 doc: /* Non-nil means `forward-sexp', etc., should treat comments as whitespace. */);
3018 3000
3019 DEFVAR_BOOL ("parse-sexp-lookup-properties", &parse_sexp_lookup_properties, 3001 DEFVAR_BOOL ("parse-sexp-lookup-properties", &parse_sexp_lookup_properties,
3020 "Non-nil means `forward-sexp', etc., obey `syntax-table' property.\n\ 3002 doc: /* Non-nil means `forward-sexp', etc., obey `syntax-table' property.
3021 Otherwise, that text property is simply ignored.\n\ 3003 Otherwise, that text property is simply ignored.
3022 See the info node `(elisp)Syntax Properties' for a description of the\n\ 3004 See the info node `(elisp)Syntax Properties' for a description of the
3023 `syntax-table' property."); 3005 `syntax-table' property. */);
3024 3006
3025 words_include_escapes = 0; 3007 words_include_escapes = 0;
3026 DEFVAR_BOOL ("words-include-escapes", &words_include_escapes, 3008 DEFVAR_BOOL ("words-include-escapes", &words_include_escapes,
3027 "Non-nil means `forward-word', etc., should treat escape chars part of words."); 3009 doc: /* Non-nil means `forward-word', etc., should treat escape chars part of words. */);
3028 3010
3029 DEFVAR_BOOL ("multibyte-syntax-as-symbol", &multibyte_syntax_as_symbol, 3011 DEFVAR_BOOL ("multibyte-syntax-as-symbol", &multibyte_syntax_as_symbol,
3030 "Non-nil means `scan-sexps' treats all multibyte characters as symbol."); 3012 doc: /* Non-nil means `scan-sexps' treats all multibyte characters as symbol. */);
3031 multibyte_syntax_as_symbol = 0; 3013 multibyte_syntax_as_symbol = 0;
3032 3014
3033 DEFVAR_BOOL ("open-paren-in-column-0-is-defun-start", 3015 DEFVAR_BOOL ("open-paren-in-column-0-is-defun-start",
3034 &open_paren_in_column_0_is_defun_start, 3016 &open_paren_in_column_0_is_defun_start,
3035 "Non-nil means an open paren in column 0 denotes the start of a defun."); 3017 doc: /* Non-nil means an open paren in column 0 denotes the start of a defun. */);
3036 open_paren_in_column_0_is_defun_start = 1; 3018 open_paren_in_column_0_is_defun_start = 1;
3037 3019
3038 defsubr (&Ssyntax_table_p); 3020 defsubr (&Ssyntax_table_p);
3039 defsubr (&Ssyntax_table); 3021 defsubr (&Ssyntax_table);
3040 defsubr (&Sstandard_syntax_table); 3022 defsubr (&Sstandard_syntax_table);