Fix comment detection on open parens
commit201dfe311868932d10da146808fcdd681948ba53
authorNoam Postavsky <npostavs@gmail.com>
Sun, 18 Dec 2016 05:00:30 +0000 (18 00:00 -0500)
committerNoam Postavsky <npostavs@gmail.com>
Tue, 24 Jan 2017 00:28:30 +0000 (23 19:28 -0500)
tree17b0d5bd792909b88fa30de7282c5dd947d04e68
parent0c31ff43b6880c84498fbe1f06e1e5809b55e838
Fix comment detection on open parens

Characters having both open paren syntax and comment start syntax were
being detected as open parens even when they should have been part a
comment starter (Bug#24870).

* src/syntax.c (in_2char_comment_start): New function, extracted from
`scan_sexps_forward'.
(scan_sexps_forward): Add check for a 2-char comment starter before the
loop.  Inside the loop, do that check after incrementing the 'from'
character index.  Move the single char comment syntax cases into the
switch instead of special casing them before.
* test/src/syntax-tests.el (parse-partial-sexp-paren-comments):
(parse-partial-sexp-continue-over-comment-marker): New tests.
src/syntax.c
test/src/syntax-tests.el [new file with mode: 0644]