Bug 425345

Summary: Nested parentheses in email (header) syntax highlighting not detected
Product: [Frameworks and Libraries] frameworks-syntax-highlighting Reporter: Erik Quaeghebeur <bugs.kde.org>
Component: syntaxAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: walter.von.entferndt
Priority: NOR    
Version: 5.70.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 5.79.0

Description Erik Quaeghebeur 2020-08-14 13:23:36 UTC
Nested parentheses in email (header) syntax highlighting are not detected. Namely, gray is used only from the first opening to the first closing parentheses instead of from the outer opening and closing parentheses.

(In email headers, parentheses indicate a comment. These comments can contain parenthetical material as well, leading to nested parentheses.)

A real-life example header where this issue shows:
---
Received: from redacted.outbound.protection.example.com
 (mail-redacted.outbound.protection.example.com [0.0.0.0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by mx2.example.org (Postfix) with ESMTPS for <someone@example.org>;
 Thu, 13 Aug 2020 06:35:02 -0400 (EDT)
---
The last closing parenthesis on line three of the example is black instead of gray.

(Beware Bug 398717.)
Comment 1 Bug Janitor Service 2021-01-17 22:03:50 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/syntax-highlighting/-/merge_requests/153
Comment 2 Bug Janitor Service 2021-01-17 22:03:50 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/syntax-highlighting/-/merge_requests/153
Comment 3 Martin Walch 2021-01-17 23:57:46 UTC
Git commit 90626bde463eca70a448579c7d6493546263152e by Martin Walch.
Committed on 17/01/2021 at 22:07.
Pushed by cullmann into branch 'master'.

email.xml: Detect nested comments and escaped characters

Conform to RFC 822 and 5322:

- Add support for nested comments.

- Add support for escaped characters in comments.

- Extend support for escaped characters in quoted strings.

- Extend and update test cases accordingly.
FIXED-IN: 5.79.0

M  +4    -0    autotests/folding/test.eml.fold
M  +4    -0    autotests/html/test.eml.dark.html
M  +4    -0    autotests/html/test.eml.html
M  +4    -0    autotests/input/test.eml
M  +4    -0    autotests/reference/test.eml.ref
M  +9    -2    data/syntax/email.xml

https://invent.kde.org/frameworks/syntax-highlighting/commit/90626bde463eca70a448579c7d6493546263152e