diff options
author | Alan Mackenzie <acm@muc.de> | 2016-10-30 17:29:52 +0000 |
---|---|---|
committer | Alan Mackenzie <acm@muc.de> | 2016-10-30 17:29:52 +0000 |
commit | 8e7b1af1d708dcf41695cf3fbeff9d35cdb8e5b6 (patch) | |
tree | 6b6e86f7db8a35d3e554833a2f2a6ba77a3c833d /src/syntax.c | |
parent | a37eba849eddc41375ad73974f6fcb1258aa8eba (diff) | |
download | emacs-8e7b1af1d708dcf41695cf3fbeff9d35cdb8e5b6.tar.gz |
Handle chars of syntax word which are also flagged as comment delimiters
src/syntax.c (scan_sexps_forward): When chars of syntax word are also flagged
as the start/end of two char comment delimiters, recognize a comment delimiter
in preference to a portion of a word. This fixes bug #24767.
Diffstat (limited to 'src/syntax.c')
-rw-r--r-- | src/syntax.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/src/syntax.c b/src/syntax.c index 667de402ec4..d463f7e93db 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -3124,6 +3124,7 @@ scan_sexps_forward (struct lisp_parse_state *state, ptrdiff_t prev_from; /* Keep one character before FROM. */ ptrdiff_t prev_from_byte; int prev_from_syntax, prev_prev_from_syntax; + int syntax; bool boundary_stop = commentstop == -1; bool nofence; bool found; @@ -3191,8 +3192,6 @@ do { prev_from = from; \ while (from < end) { - int syntax; - if (SYNTAX_FLAGS_COMSTART_FIRST (prev_from_syntax) && (c1 = FETCH_CHAR (from_byte), syntax = SYNTAX_WITH_FLAGS (c1), @@ -3258,7 +3257,24 @@ do { prev_from = from; \ while (from < end) { int symchar = FETCH_CHAR_AS_MULTIBYTE (from_byte); - switch (SYNTAX (symchar)) + + if (SYNTAX_FLAGS_COMSTART_FIRST (prev_from_syntax) + && (syntax = SYNTAX_WITH_FLAGS (symchar), + SYNTAX_FLAGS_COMSTART_SECOND (syntax))) + { + state->comstyle + = SYNTAX_FLAGS_COMMENT_STYLE (syntax, prev_from_syntax); + comnested = (SYNTAX_FLAGS_COMMENT_NESTED (prev_from_syntax) + | SYNTAX_FLAGS_COMMENT_NESTED (syntax)); + state->incomment = comnested ? 1 : -1; + state->comstr_start = prev_from; + INC_FROM; + prev_from_syntax = Smax; + code = Scomment; + goto atcomment; + } + + switch (SYNTAX (symchar)) { case Scharquote: case Sescape: @@ -3280,6 +3296,7 @@ do { prev_from = from; \ case Scomment_fence: /* Can't happen because it's handled above. */ case Scomment: + atcomment: if (commentstop || boundary_stop) goto done; startincomment: /* The (from == BEGV) test was to enter the loop in the middle so |