Python: fix escapes in quoted-comments
ClosedPublic

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

Details

Summary

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

Repository
R216 Syntax Highlighting
Lint
Automatic diff as part of commit; lint not applicable.
Unit
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: https://bugs.kde.org/show_bug.cgi?id=386685 to BUG: 386685. See https://community.kde.org/Infrastructure/Phabricator#Add_special_keywords

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

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.