Mercurial > hg > xemacs-beta
comparison src/syntax.c @ 272:c5d627a313b1 r21-0b34
Import from CVS: tag r21-0b34
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:28:48 +0200 |
parents | a2f645c6b9f8 |
children | a4f53d9b3154 |
comparison
equal
deleted
inserted
replaced
271:c7b7086b0a39 | 272:c5d627a313b1 |
---|---|
157 Return t if ARG is a syntax table. | 157 Return t if ARG is a syntax table. |
158 Any vector of 256 elements will do. | 158 Any vector of 256 elements will do. |
159 */ | 159 */ |
160 (obj)) | 160 (obj)) |
161 { | 161 { |
162 if (CHAR_TABLEP (obj) && XCHAR_TABLE_TYPE (obj) == CHAR_TABLE_TYPE_SYNTAX) | 162 return CHAR_TABLEP (obj) && XCHAR_TABLE_TYPE (obj) == CHAR_TABLE_TYPE_SYNTAX |
163 return Qt; | 163 ? Qt : Qnil; |
164 return Qnil; | |
165 } | 164 } |
166 | 165 |
167 static Lisp_Object | 166 static Lisp_Object |
168 check_syntax_table (Lisp_Object obj, Lisp_Object def) | 167 check_syntax_table (Lisp_Object obj, Lisp_Object default_) |
169 { | 168 { |
170 if (NILP (obj)) | 169 if (NILP (obj)) |
171 obj = def; | 170 obj = default_; |
172 while (NILP (Fsyntax_table_p (obj))) | 171 while (NILP (Fsyntax_table_p (obj))) |
173 obj = wrong_type_argument (Qsyntax_table_p, obj); | 172 obj = wrong_type_argument (Qsyntax_table_p, obj); |
174 return (obj); | 173 return obj; |
175 } | 174 } |
176 | 175 |
177 DEFUN ("syntax-table", Fsyntax_table, 0, 1, 0, /* | 176 DEFUN ("syntax-table", Fsyntax_table, 0, 1, 0, /* |
178 Return the current syntax table. | 177 Return the current syntax table. |
179 This is the one specified by the current buffer, or by BUFFER if it | 178 This is the one specified by the current buffer, or by BUFFER if it |
303 if (CONSP (code)) | 302 if (CONSP (code)) |
304 code2 = XCAR (code); | 303 code2 = XCAR (code); |
305 if (SYNTAX_FROM_CODE (XINT (code2)) == Sinherit) | 304 if (SYNTAX_FROM_CODE (XINT (code2)) == Sinherit) |
306 code = CHAR_TABLE_VALUE_UNSAFE (XCHAR_TABLE (Vstandard_syntax_table), | 305 code = CHAR_TABLE_VALUE_UNSAFE (XCHAR_TABLE (Vstandard_syntax_table), |
307 ch); | 306 ch); |
308 if (CONSP (code)) | 307 |
309 return XCDR (code); | 308 return CONSP (code) ? XCDR (code) : Qnil; |
310 else | |
311 return Qnil; | |
312 } | 309 } |
313 | 310 |
314 DEFUN ("matching-paren", Fmatching_paren, 1, 2, 0, /* | 311 DEFUN ("matching-paren", Fmatching_paren, 1, 2, 0, /* |
315 Return the matching parenthesis of CHAR, or nil if none. | 312 Return the matching parenthesis of CHAR, or nil if none. |
316 Optional second argument TABLE defaults to the current buffer's | 313 Optional second argument TABLE defaults to the current buffer's |
1487 { | 1484 { |
1488 struct lisp_parse_state state; | 1485 struct lisp_parse_state state; |
1489 int target; | 1486 int target; |
1490 Bufpos start, end; | 1487 Bufpos start, end; |
1491 struct buffer *buf = decode_buffer (buffer, 0); | 1488 struct buffer *buf = decode_buffer (buffer, 0); |
1489 Lisp_Object val; | |
1492 | 1490 |
1493 if (!NILP (targetdepth)) | 1491 if (!NILP (targetdepth)) |
1494 { | 1492 { |
1495 CHECK_INT (targetdepth); | 1493 CHECK_INT (targetdepth); |
1496 target = XINT (targetdepth); | 1494 target = XINT (targetdepth); |
1503 target, !NILP (stopbefore), oldstate, | 1501 target, !NILP (stopbefore), oldstate, |
1504 !NILP (commentstop)); | 1502 !NILP (commentstop)); |
1505 | 1503 |
1506 BUF_SET_PT (buf, state.location); | 1504 BUF_SET_PT (buf, state.location); |
1507 | 1505 |
1508 { | 1506 /* reverse order */ |
1509 /* | 1507 val = Qnil; |
1510 * This junk is necessary because of a bug in SparcWorks cc 2.0.1. It | 1508 val = Fcons (state.comstyle ? Qt : Qnil, val); |
1511 * doesn't handle functions as arguments to other functions very well. | 1509 val = Fcons (make_int (state.mindepth), val); |
1512 */ | 1510 val = Fcons (state.quoted ? Qt : Qnil, val); |
1513 Lisp_Object retval[8]; | 1511 val = Fcons (state.incomment ? Qt : Qnil, val); |
1514 | 1512 val = Fcons (state.instring < 0 ? Qnil : make_int (state.instring), val); |
1515 retval[0] = make_int (state.depth); | 1513 val = Fcons (state.thislevelstart < 0 ? Qnil : make_int (state.thislevelstart), val); |
1516 retval[1] = ((state.prevlevelstart < 0) ? Qnil : | 1514 val = Fcons (state.prevlevelstart < 0 ? Qnil : make_int (state.prevlevelstart), val); |
1517 make_int (state.prevlevelstart)); | 1515 val = Fcons (make_int (state.depth), val); |
1518 retval[2] = ((state.thislevelstart < 0) ? Qnil : | 1516 |
1519 make_int (state.thislevelstart)); | 1517 return val; |
1520 retval[3] = ((state.instring >= 0) ? make_int (state.instring) : Qnil); | |
1521 retval[4] = ((state.incomment) ? Qt : Qnil); | |
1522 retval[5] = ((state.quoted) ? Qt : Qnil); | |
1523 retval[6] = make_int (state.mindepth); | |
1524 retval[7] = ((state.comstyle) ? Qt : Qnil); | |
1525 | |
1526 return (Flist (8, retval)); | |
1527 } | |
1528 } | 1518 } |
1529 | 1519 |
1530 | 1520 |
1531 /* Updating of the mirror syntax table. | 1521 /* Updating of the mirror syntax table. |
1532 | 1522 |