https://bugs.kde.org/show_bug.cgi?id=421445

            Bug ID: 421445
           Summary: Opening double quote in sql-postgresql has "comment"
                    attribute instead of "identifier"
           Product: frameworks-syntax-highlighting
           Version: 5.70.0
          Platform: Ubuntu Packages
                OS: Linux
            Status: REPORTED
          Severity: minor
          Priority: NOR
         Component: syntax
          Assignee: kwrite-bugs-n...@kde.org
          Reporter: benjamin.wuethr...@gmail.com
  Target Milestone: ---

Created attachment 128412
  --> https://bugs.kde.org/attachment.cgi?id=128412&action=edit
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="&quot;"/>

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="&quot;"/>

to the line shown above (line 750 after commit diff):

    <DetectChar attribute="Comment" context="Identifier" char="&quot;"/>

but attribute="9" corresponds to "Identifier"; "Comment" would be "8", as can
be seen by inspecting the surrounding lines and the <itemDatas> array.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to