return find_start_value;
/* Back up to start of line. */
- tem = scan_buffer ('\n', pos, -1, &shortage);
+ tem = scan_buffer ('\n', pos, -1, &shortage, 1);
while (tem > BEGV)
{
if (SYNTAX (FETCH_CHAR (tem)) == Sopen)
break;
/* Move to beg of previous line. */
- tem = scan_buffer ('\n', tem, -2, &shortage);
+ tem = scan_buffer ('\n', tem, -2, &shortage, 1);
}
/* Record what we found, for the next try. */
0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377,
0377, 0377, 0377, 0377,
(char) Scomment, 0377, (char) Sendcomment, 0377,
- 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, /* @, A, ... */
+ (char) Sinherit, 0377, 0377, 0377, 0377, 0377, 0377, 0377, /* @, A ... */
0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377,
0377, 0377, 0377, 0377, 0377, 0377, 0377, (char) Sword,
0377, 0377, 0377, 0377, (char) Sescape, 0377, 0377, (char) Ssymbol,
/* Indexed by syntax code, give the letter that describes it. */
-char syntax_code_spec[13] =
+char syntax_code_spec[14] =
{
- ' ', '.', 'w', '_', '(', ')', '\'', '\"', '$', '\\', '/', '<', '>'
+ ' ', '.', 'w', '_', '(', ')', '\'', '\"', '$', '\\', '/', '<', '>', '@'
};
\f
DEFUN ("char-syntax", Fchar_syntax, Schar_syntax, 1, 1, 0,
( open-parenthesis. ) close-parenthesis.\n\
\" string quote. \\ escape.\n\
$ paired delimiter. ' expression quote or prefix operator.\n\
- < comment starter. > comment ender.\n\
- / character-quote.\n\
+ < comment starter. > comment ender.\n\
+ / character-quote. @ inherit from `standard-syntax-table'.\n\
+\n\
Only single-character comment start and end sequences are represented thus.\n\
Two-character sequences are represented as described below.\n\
The second character of S is the matching parenthesis,\n\
\n\
There can be up to two orthogonal comment sequences. This is to support\n\
language modes such as C++. By default, all comment sequences are of style\n\
-a, but you can set the comment sequence style to b (on the second character of a\n\
-comment-start, or the first character of a comment-end sequence) by using\n\
+a, but you can set the comment sequence style to b (on the second character\n\
+of a comment-start, or the first character of a comment-end sequence) using\n\
this flag:\n\
b means C is part of comment sequence b.\n\
\n\
insert_string ("comment"); break;
case Sendcomment:
insert_string ("endcomment"); break;
+ case Sinherit:
+ insert_string ("inherit"); break;
default:
insert_string ("invalid");
return;
while (count1 > 0)
{
stop = ZV;
- while (from < stop)
+ do
{
+ if (from == stop)
+ {
+ SET_PT (from);
+ return Qnil;
+ }
c = FETCH_CHAR (from);
code = SYNTAX (c);
from++;
if (from < stop && SYNTAX_COMSTART_FIRST (c)
&& SYNTAX_COMSTART_SECOND (FETCH_CHAR (from)))
{
- /* we have encountered a comment start sequence and we
- are ignoring all text inside comments. we must record
+ /* We have encountered a comment start sequence and we
+ are ignoring all text inside comments. We must record
the comment style this sequence begins so that later,
only a comment end of the same style actually ends
- the comment section */
+ the comment section. */
code = Scomment;
comstyle = SYNTAX_COMMENT_STYLE (FETCH_CHAR (from));
from++;
}
-
- if (code == Scomment)
- {
- while (1)
- {
- if (from == stop)
- {
- immediate_quit = 0;
- SET_PT (from);
- return Qnil;
- }
- c = FETCH_CHAR (from);
- if (SYNTAX (c) == Sendcomment
- && SYNTAX_COMMENT_STYLE (c) == comstyle)
- /* we have encountered a comment end of the same style
- as the comment sequence which began this comment
- section */
- break;
- from++;
- if (from < stop && SYNTAX_COMEND_FIRST (c)
- && SYNTAX_COMEND_SECOND (FETCH_CHAR (from))
- && SYNTAX_COMMENT_STYLE (c) == comstyle)
- /* we have encountered a comment end of the same style
- as the comment sequence which began this comment
- section */
- { from++; break; }
- }
- /* We have skipped one comment. */
- break;
- }
- else if (code != Swhitespace && code != Sendcomment)
+ }
+ while (code == Swhitespace || code == Sendcomment);
+ if (code != Scomment)
+ {
+ immediate_quit = 0;
+ SET_PT (from - 1);
+ return Qnil;
+ }
+ /* We're at the start of a comment. */
+ while (1)
+ {
+ if (from == stop)
{
immediate_quit = 0;
- SET_PT (from - 1);
+ SET_PT (from);
return Qnil;
}
+ c = FETCH_CHAR (from);
+ if (SYNTAX (c) == Sendcomment
+ && SYNTAX_COMMENT_STYLE (c) == comstyle)
+ /* we have encountered a comment end of the same style
+ as the comment sequence which began this comment
+ section */
+ break;
+ from++;
+ if (from < stop && SYNTAX_COMEND_FIRST (c)
+ && SYNTAX_COMEND_SECOND (FETCH_CHAR (from))
+ && SYNTAX_COMMENT_STYLE (c) == comstyle)
+ /* we have encountered a comment end of the same style
+ as the comment sequence which began this comment
+ section */
+ { from++; break; }
}
-
- /* End of comment reached */
+ /* We have skipped one comment. */
count1--;
}
c = FETCH_CHAR (from);
code = SYNTAX (c);
comstyle = 0;
+ if (code == Sendcomment)
+ comstyle = SYNTAX_COMMENT_STYLE (c);
if (from > stop && SYNTAX_COMEND_SECOND (c)
&& SYNTAX_COMEND_FIRST (FETCH_CHAR (from - 1))
&& !char_quoted (from - 1))
{
- /* we must record the comment style encountered so that
+ /* We must record the comment style encountered so that
later, we can match only the proper comment begin
- sequence of the same style */
+ sequence of the same style. */
code = Sendcomment;
comstyle = SYNTAX_COMMENT_STYLE (FETCH_CHAR (from - 1));
from--;
from = comment_end;
}
}
+ /* We have skipped one comment. */
+ break;
}
else if ((code != Swhitespace && code != Scomment) || quoted)
{
from--;
c = FETCH_CHAR (from);
code = SYNTAX (c);
+ comstyle = 0;
+ if (code == Sendcomment)
+ comstyle = SYNTAX_COMMENT_STYLE (c);
if (from > stop && SYNTAX_COMEND_SECOND (c)
&& SYNTAX_COMEND_FIRST (FETCH_CHAR (from - 1))
&& !char_quoted (from - 1)