Mercurial > hg > xemacs-beta
comparison src/syntax.c @ 2:ac2d302a0011 r19-15b2
Import from CVS: tag r19-15b2
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:46:35 +0200 |
parents | 376386a54a3c |
children | 0293115a14e9 |
comparison
equal
deleted
inserted
replaced
1:c0c6a60d29db | 2:ac2d302a0011 |
---|---|
53 Lisp_Object Vsyntax_designator_chars_string; | 53 Lisp_Object Vsyntax_designator_chars_string; |
54 | 54 |
55 /* This is the internal form of the parse state used in parse-partial-sexp. */ | 55 /* This is the internal form of the parse state used in parse-partial-sexp. */ |
56 | 56 |
57 struct lisp_parse_state | 57 struct lisp_parse_state |
58 { | 58 { |
59 int depth; /* Depth at end of parsing */ | 59 int depth; /* Depth at end of parsing */ |
60 Emchar instring; /* -1 if not within string, else desired terminator. */ | 60 Emchar instring; /* -1 if not within string, else desired terminator */ |
61 int incomment; /* Nonzero if within a comment at end of parsing */ | 61 int incomment; /* Nonzero if within a comment at end of parsing */ |
62 int comstyle; /* comment style a=0, or b=1 */ | 62 int comstyle; /* comment style a=0, or b=1 */ |
63 int quoted; /* Nonzero if just after an escape char at end of | 63 int quoted; /* Nonzero if just after an escape char at end of |
64 parsing */ | 64 parsing */ |
65 Bufpos thislevelstart;/* Char number of most recent start-of-expression | 65 Bufpos thislevelstart;/* Char number of most recent start-of-expression |
66 at current level */ | 66 at current level */ |
67 Bufpos prevlevelstart;/* Char number of start of containing expression */ | 67 Bufpos prevlevelstart;/* Char number of start of containing expression */ |
68 Bufpos location; /* Char number at which parsing stopped. */ | 68 Bufpos location; /* Char number at which parsing stopped */ |
69 int mindepth; /* Minimum depth seen while scanning. */ | 69 int mindepth; /* Minimum depth seen while scanning */ |
70 Bufpos comstart; /* Position just after last comment starter. */ | 70 Bufpos comstart; /* Position just after last comment starter */ |
71 }; | 71 }; |
72 | 72 |
73 /* These variables are a cache for finding the start of a defun. | 73 /* These variables are a cache for finding the start of a defun. |
74 find_start_pos is the place for which the defun start was found. | 74 find_start_pos is the place for which the defun start was found. |
75 find_start_value is the defun start position found for it. | 75 find_start_value is the defun start position found for it. |
76 find_start_buffer is the buffer it was found in. | 76 find_start_buffer is the buffer it was found in. |
77 find_start_begv is the BEGV value when it was found. | 77 find_start_begv is the BEGV value when it was found. |
78 find_start_modiff is the value of MODIFF when it was found. */ | 78 find_start_modiff is the value of MODIFF when it was found. */ |
79 | 79 |
80 static Bufpos find_start_pos; | 80 static Bufpos find_start_pos; |
81 static Bufpos find_start_value; | 81 static Bufpos find_start_value; |
82 static struct buffer *find_start_buffer; | 82 static struct buffer *find_start_buffer; |
115 /* Move to beg of previous line. */ | 115 /* Move to beg of previous line. */ |
116 tem = find_next_newline (buf, tem, -2); | 116 tem = find_next_newline (buf, tem, -2); |
117 } | 117 } |
118 | 118 |
119 /* Record what we found, for the next try. */ | 119 /* Record what we found, for the next try. */ |
120 find_start_value = tem; | 120 find_start_value = tem; |
121 find_start_buffer = buf; | 121 find_start_buffer = buf; |
122 find_start_modiff = BUF_MODIFF (buf); | 122 find_start_modiff = BUF_MODIFF (buf); |
123 find_start_begv = BUF_BEGV (buf); | 123 find_start_begv = BUF_BEGV (buf); |
124 find_start_pos = pos; | 124 find_start_pos = pos; |
125 | 125 |
126 return find_start_value; | 126 return find_start_value; |
127 } | 127 } |
128 | 128 |
129 DEFUN ("syntax-table-p", Fsyntax_table_p, Ssyntax_table_p, 1, 1, 0 /* | 129 DEFUN ("syntax-table-p", Fsyntax_table_p, Ssyntax_table_p, 1, 1, 0 /* |
130 Return t if ARG is a syntax table. | 130 Return t if ARG is a syntax table. |
131 Any vector of 256 elements will do. | 131 Any vector of 256 elements will do. |
132 */ ) | 132 */ ) |
133 (obj) | 133 (obj) |
134 Lisp_Object obj; | 134 Lisp_Object obj; |
135 { | 135 { |
136 if (VECTORP (obj) && vector_length (XVECTOR (obj)) == 0400) | 136 if (VECTORP (obj) && vector_length (XVECTOR (obj)) == 0400) |
137 return Qt; | 137 return Qt; |
138 return Qnil; | 138 return Qnil; |
139 } | 139 } |
199 buf->local_var_flags |= XINT (buffer_local_flags.syntax_table); | 199 buf->local_var_flags |= XINT (buffer_local_flags.syntax_table); |
200 return table; | 200 return table; |
201 } | 201 } |
202 | 202 |
203 /* Convert a letter which signifies a syntax code | 203 /* Convert a letter which signifies a syntax code |
204 into the code it signifies. | 204 into the code it signifies. |
205 This is used by modify-syntax-entry, and other things. */ | 205 This is used by modify-syntax-entry, and other things. */ |
206 | 206 |
207 CONST unsigned char syntax_spec_code[0400] = | 207 CONST unsigned char syntax_spec_code[0400] = |
208 { 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, | 208 { 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, |
209 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, | 209 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, |
210 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, | 210 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, |
250 are listed in the documentation of `modify-syntax-entry'. | 250 are listed in the documentation of `modify-syntax-entry'. |
251 Optional second argument TABLE defaults to the current buffer's | 251 Optional second argument TABLE defaults to the current buffer's |
252 syntax table. | 252 syntax table. |
253 */ ) | 253 */ ) |
254 (ch, table) | 254 (ch, table) |
255 Lisp_Object ch, table; | 255 Lisp_Object ch, table; |
256 { | 256 { |
257 CHECK_CHAR_COERCE_INT (ch); | 257 CHECK_CHAR_COERCE_INT (ch); |
258 table = check_syntax_table (table, current_buffer->syntax_table); | 258 table = check_syntax_table (table, current_buffer->syntax_table); |
259 | 259 |
260 return make_int (syntax_code_spec[(int) SYNTAX (table, XINT (ch))]); | 260 return make_int (syntax_code_spec[(int) SYNTAX (table, XINT (ch))]); |
387 Normally returns t. | 387 Normally returns t. |
388 If an edge of the buffer is reached, point is left there | 388 If an edge of the buffer is reached, point is left there |
389 and nil is returned. | 389 and nil is returned. |
390 */ ) | 390 */ ) |
391 (count, buffer) | 391 (count, buffer) |
392 Lisp_Object count, buffer; | 392 Lisp_Object count, buffer; |
393 { | 393 { |
394 Bufpos val; | 394 Bufpos val; |
395 struct buffer *buf = decode_buffer (buffer, 0); | 395 struct buffer *buf = decode_buffer (buffer, 0); |
396 CHECK_INT (count); | 396 CHECK_INT (count); |
397 | 397 |
593 If N comments are found as expected, with nothing except whitespace | 593 If N comments are found as expected, with nothing except whitespace |
594 between them, return t; otherwise return nil. | 594 between them, return t; otherwise return nil. |
595 Point is set in either case. | 595 Point is set in either case. |
596 Optional argument BUFFER defaults to the current buffer. | 596 Optional argument BUFFER defaults to the current buffer. |
597 */ ) | 597 */ ) |
598 (n, buffer) | 598 (n, buffer) |
599 Lisp_Object n, buffer; | 599 Lisp_Object n, buffer; |
600 { | 600 { |
601 Bufpos from; | 601 Bufpos from; |
602 Bufpos stop; | 602 Bufpos stop; |
603 Emchar c; | 603 Emchar c; |
604 enum syntaxcode code; | 604 enum syntaxcode code; |