Created attachment 128412 [details] Screenshot of incorrectly highlighted opening double quote SUMMARY When double quoting a string in a PostgreSQL statement such as when setting an output name in a select statement, the opening double quote is highlighted as a comment instead of as an identifier. STEPS TO REPRODUCE 1. Create a new document in Kate 2. Set syntax highlighting language to "SQL (PostgreSQL)" 3. Write a statement including a double quote, for example select 'foo' "bar"; OBSERVED RESULT The opening double quote is highlighted as a comment, the identifier and the closing double quote as an identifier (see attachment). EXPECTED RESULT The quoted string is highlighted as an identifier, both quotes included. SOFTWARE/OS VERSIONS Ubuntu 19.10 Kate 19.04.3 KDE Frameworks 5.62.0 Qt 5.12.4 (built against 5.12.4) ADDITIONAL INFORMATION The same error affects Pandoc syntax highlighting, which uses Skylighting, which uses the KDE syntax definition files. John MacFarlane, the creator of Skylighting and Pandoc, pointed me to this line in the syntax file, which seems to be the culprit: <DetectChar attribute="Comment" context="Identifier" char="""/> Phabricator link: https://phabricator.kde.org/source/syntax-highlighting/browse/master/data/syntax/sql-postgresql.xml$1010 Looking further to when this was introduced, I found this commit back when syntax highlighting was in Kate: https://invent.kde.org/kde/kate/-/commit/2e55bd0ca7deaaffe5546f04e2925112cca2a9a6#5d04d3f12b2774e3618e339c318f3154ac45df03 It changes line 749 from <DetectChar attribute="9" context="5" char="""/> to the line shown above (line 750 after commit diff): <DetectChar attribute="Comment" context="Identifier" char="""/> but attribute="9" corresponds to "Identifier"; "Comment" would be "8", as can be seen by inspecting the surrounding lines and the <itemDatas> array.
Git commit f804af905ef3a3de8aa6bdd49344f231e420b82d by Christoph Cullmann. Committed on 15/05/2020 at 15:45. Pushed by cullmann into branch 'master'. Assign "Identifier" attribute to opening double quote instead of "Comment" Summary: When the PostgreSQL syntax definition file was converted from using named attributes and contexts instead of numbers in [this commit](https://invent.kde.org/kde/kate/-/commit/2e55bd0ca7deaaffe5546f04e2925112cca2a9a6#5d04d3f12b2774e3618e339c318f3154ac45df03), the attribute for an opening double quote was incorrectly set to `"Comment"` instead of `"Identifier"`. This patch fixes that. Test Plan: Incorrect opening double quote before fix: {F8318517} Correct opening double quote after fix: {F8318530} Reviewers: #framework_syntax_highlighting, dhaumann Reviewed By: #framework_syntax_highlighting, dhaumann Subscribers: cullmann, dhaumann, kwrite-devel, kde-frameworks-devel Tags: #framework_syntax_highlighting, #kate, #frameworks Differential Revision: https://phabricator.kde.org/D29735 M +2 -2 data/syntax/sql-postgresql.xml https://commits.kde.org/syntax-highlighting/f804af905ef3a3de8aa6bdd49344f231e420b82d