the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-#include "config.h"
+#include <config.h>
#include <ctype.h>
#include "lisp.h"
#include "commands.h"
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;
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++;
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)
If fifth arg STATE is omitted or nil,\n\
parsing assumes that FROM is the beginning of a function.\n\
Value is a list of eight elements describing final state of parsing:\n\
- 1. depth in parens.\n\
- 2. character address of start of innermost containing list; nil if none.\n\
- 3. character address of start of last complete sexp terminated.\n\
- 4. non-nil if inside a string.\n\
+ 0. depth in parens.\n\
+ 1. character address of start of innermost containing list; nil if none.\n\
+ 2. character address of start of last complete sexp terminated.\n\
+ 3. non-nil if inside a string.\n\
(it is the character that will terminate the string.)\n\
- 5. t if inside a comment.\n\
- 6. t if following a quote character.\n\
- 7. the minimum paren-depth encountered during this scan.\n\
- 8. t if in a comment of style `b'.\n\
+ 4. t if inside a comment.\n\
+ 5. t if following a quote character.\n\
+ 6. the minimum paren-depth encountered during this scan.\n\
+ 7. t if in a comment of style `b'.\n\
If third arg TARGETDEPTH is non-nil, parsing stops if the depth\n\
in parentheses becomes equal to TARGETDEPTH.\n\
Fourth arg STOPBEFORE non-nil means stop when come to\n\
any character that starts a sexp.\n\
-Fifth arg STATE is a seven-list like what this function returns.\n\
+Fifth arg STATE is an eight-list like what this function returns.\n\
It is used to initialize the state of the parse. Its second and third
elements are ignored.
Sixth args COMMENTSTOP non-nil means stop at the start of a comment.")