aboutsummaryrefslogtreecommitdiffstats
path: root/src/syntax.c
diff options
context:
space:
mode:
authorAlan Mackenzie2016-10-30 17:29:52 +0000
committerAlan Mackenzie2016-10-30 17:29:52 +0000
commit8e7b1af1d708dcf41695cf3fbeff9d35cdb8e5b6 (patch)
tree6b6e86f7db8a35d3e554833a2f2a6ba77a3c833d /src/syntax.c
parenta37eba849eddc41375ad73974f6fcb1258aa8eba (diff)
downloademacs-8e7b1af1d708dcf41695cf3fbeff9d35cdb8e5b6.tar.gz
emacs-8e7b1af1d708dcf41695cf3fbeff9d35cdb8e5b6.zip
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.c23
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,
3124 ptrdiff_t prev_from; /* Keep one character before FROM. */ 3124 ptrdiff_t prev_from; /* Keep one character before FROM. */
3125 ptrdiff_t prev_from_byte; 3125 ptrdiff_t prev_from_byte;
3126 int prev_from_syntax, prev_prev_from_syntax; 3126 int prev_from_syntax, prev_prev_from_syntax;
3127 int syntax;
3127 bool boundary_stop = commentstop == -1; 3128 bool boundary_stop = commentstop == -1;
3128 bool nofence; 3129 bool nofence;
3129 bool found; 3130 bool found;
@@ -3191,8 +3192,6 @@ do { prev_from = from; \
3191 3192
3192 while (from < end) 3193 while (from < end)
3193 { 3194 {
3194 int syntax;
3195
3196 if (SYNTAX_FLAGS_COMSTART_FIRST (prev_from_syntax) 3195 if (SYNTAX_FLAGS_COMSTART_FIRST (prev_from_syntax)
3197 && (c1 = FETCH_CHAR (from_byte), 3196 && (c1 = FETCH_CHAR (from_byte),
3198 syntax = SYNTAX_WITH_FLAGS (c1), 3197 syntax = SYNTAX_WITH_FLAGS (c1),
@@ -3258,7 +3257,24 @@ do { prev_from = from; \
3258 while (from < end) 3257 while (from < end)
3259 { 3258 {
3260 int symchar = FETCH_CHAR_AS_MULTIBYTE (from_byte); 3259 int symchar = FETCH_CHAR_AS_MULTIBYTE (from_byte);
3261 switch (SYNTAX (symchar)) 3260
3261 if (SYNTAX_FLAGS_COMSTART_FIRST (prev_from_syntax)
3262 && (syntax = SYNTAX_WITH_FLAGS (symchar),
3263 SYNTAX_FLAGS_COMSTART_SECOND (syntax)))
3264 {
3265 state->comstyle
3266 = SYNTAX_FLAGS_COMMENT_STYLE (syntax, prev_from_syntax);
3267 comnested = (SYNTAX_FLAGS_COMMENT_NESTED (prev_from_syntax)
3268 | SYNTAX_FLAGS_COMMENT_NESTED (syntax));
3269 state->incomment = comnested ? 1 : -1;
3270 state->comstr_start = prev_from;
3271 INC_FROM;
3272 prev_from_syntax = Smax;
3273 code = Scomment;
3274 goto atcomment;
3275 }
3276
3277 switch (SYNTAX (symchar))
3262 { 3278 {
3263 case Scharquote: 3279 case Scharquote:
3264 case Sescape: 3280 case Sescape:
@@ -3280,6 +3296,7 @@ do { prev_from = from; \
3280 3296
3281 case Scomment_fence: /* Can't happen because it's handled above. */ 3297 case Scomment_fence: /* Can't happen because it's handled above. */
3282 case Scomment: 3298 case Scomment:
3299 atcomment:
3283 if (commentstop || boundary_stop) goto done; 3300 if (commentstop || boundary_stop) goto done;
3284 startincomment: 3301 startincomment:
3285 /* The (from == BEGV) test was to enter the loop in the middle so 3302 /* The (from == BEGV) test was to enter the loop in the middle so