Python: fix escapes in quoted-comments

Authored by nibags on Jul 12 2018, 6:46 AM.



BUG: 386685

Escape characters are not detected in triple-quote comments.
Comments in quotes are literal strings that do not have assignment or operations, so the interpreter ignores them. These are also used to associate documentation with objects, using the __doc__ attribute (Docstrings [1][2]).

Comments in quotes support the same escapes as normal string. Also, since these can be used as documentation strings, I believe that the correct way is to use the same string escape highlight.

Diff Detail

R216 Syntax Highlighting
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
nibags created this revision.Jul 12 2018, 6:46 AM
Restricted Application added projects: Kate, Frameworks. · View Herald TranscriptJul 12 2018, 6:46 AM
Restricted Application added subscribers: kde-frameworks-devel, kwrite-devel. · View Herald Transcript
nibags requested review of this revision.Jul 12 2018, 6:46 AM
ngraham added a subscriber: ngraham.

Please change Bug #386685: to BUG: 386685. See

Can you add a test line to autotests/input/ ?

nibags edited the summary of this revision. (Show Details)Jul 13 2018, 3:52 AM
nibags updated this revision to Diff 37722.Jul 14 2018, 3:45 AM
  • Add test.

I also included a missing MIME type, obtained from shared-mime-info.

dhaumann accepted this revision.Jul 14 2018, 8:25 AM

Thanks! Looks good to me.

This revision is now accepted and ready to land.Jul 14 2018, 8:25 AM
This revision was automatically updated to reflect the committed changes.