Bug 212798 - kate error on highlighting for cmake
Summary: kate error on highlighting for cmake
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: syntax (show other bugs)
Version: unspecified
Platform: Ubuntu Linux
: NOR minor
Target Milestone: ---
Assignee: Matthew Woehlke
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-11-02 20:52 UTC by Matthew Woehlke
Modified: 2009-11-03 00:05 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matthew Woehlke 2009-11-02 20:52:17 UTC
Version:            (using KDE 4.3.0)
OS:                Linux
Installed from:    Ubuntu Packages

Forwarding upstream bug report: https://bugs.launchpad.net/ubuntu/+source/kdesdk/+bug/405760

Original description:
---------------------
kate Versione 4.2.98 (KDE 4.2.98 (KDE 4.3 RC3))

there is an error on recognize \" , the text after is highlighting with red

try to use highlighting for cmake with the text below
example:

project( test )

#for slice2cpp
ADD_CUSTOM_COMMAND( OUTPUT src/test.cpp src/test.hpp
     COMMAND slice2cpp --header-ext hpp --output-dir src idl/test.ice
     COMMAND sed
     -i 's,include <test.hpp>,include \"test.hpp\",' ${archiveTest_SOURCE_DIR}/src/test.cpp
     WORKING_DIRECTORY ${archiveTest_SOURCE_DIR}
     )
Comment 1 Matthew Woehlke 2009-11-02 20:54:55 UTC
From my own testing, it appears that CMake accepts '\"' outside of a string as not starting a string (that is, it is an escape outside of a string as well as inside).

For what it's worth, vim has the same bug. (Also I am reasonably certain that the snippet code is not what the OP intended.)
Comment 2 Erlend Hamberg 2009-11-02 21:03:40 UTC
maybe something like this would be better for detecting the start of a string, if it's actually allowd to have \" outside of a string...

-        <DetectChar attribute="Strings" context="String" char="&quot;"/>
+        <RegExpr attribute="Strings" context="String" String="[^\\]&quot;"/>
Comment 3 Matthew Woehlke 2009-11-02 21:13:29 UTC
(Gee, that was quick :-)...)

Nah, I'd rather avoid the regex. Besides, your example is wrong; it would have to be a look-back expression to be correct (and to not highlight too much).

See http://reviewboard.kde.org/r/2043/ for my proposed fix (basically, copy the rule that detects '\"' to just before we would detect starting a string, as well as where it currently is, just before we would detect ending a string).
Comment 4 Matthew Woehlke 2009-11-03 00:05:36 UTC
SVN commit 1044075 by mwoehlke:

improve cmake.xml

Rearrange stuff to reduce rule duplication, and recognize '\"' as an
escape outside of strings.

BUG: 212798
REVIEW: 2043


 M  +8 -10     cmake.xml  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1044075