Version: 2.3.1 (using KDE 3.3.1, SuSE) Compiler: gcc version 3.3.1 (SuSE Linux) OS: Linux (i686) release 2.6.9-rc4 In the typical "clean" rule the escaped '#' is still seen as the beginning of a comment: clean: rm -f *.o *~ \#* $(TARGETS)
Created attachment 8148 [details] Patch to Makefile.xml This one works for me.
The patch has two bugs: the file names look reversed and now comments at the beginning of a line are ignored :(
CVS commit by alund: do not render escaped hashmark ('\#') as comment BUG: 92628 M +1 -1 makefile.xml 1.9 --- kdelibs/kate/data/makefile.xml #1.8:1.9 @@ -27,5 +27,5 @@ <AnyChar attribute="Operator" context="#stay" String="+*=%$():\\;" /> <RegExpr attribute="Operator" context="Commands" String="^\s*[@-]"/> - <RegExpr attribute="Comment" context="#stay" String="#.*$"/> + <RegExpr attribute="Comment" context="#stay" String="(:^|[^\\])#.*$"/> </context>
Doesn't work for me (kate 2.3.2), full line comments are not highlighted as comments. Local problem or should it be reopened?
It works in head, where it was applied. Did you apply the change to your local copy of makefile.xml? In that case, make sure that the copy you changed is the one used (up the version number and make sure you haven't a copy under ~/.kde) I can't see why it shouldn't work under kde 3.2.
Verified on different machine: -- this is code #this is comment this is code \# this is still code #this one is not recognized as comment #but this one is --
Created attachment 11104 [details] quick and dirty fix against version 1.06, works for me
Still present in 3.5.0. What about my patch?
SVN commit 555659 by dhaumann: fix: highlight # at the beginning of a line as comment BUG: 92628 M +2 -2 makefile.xml --- branches/KDE/3.5/kdelibs/kate/data/makefile.xml #555658:555659 @@ -2,7 +2,7 @@ <!DOCTYPE language SYSTEM "language.dtd"> <!-- Makefile syntaxfile v0.9 by Per Wigren <wigren@home.se> --> <!-- Modified by Joseph Wenninger <jowenn@kde.org> --> -<language name="Makefile" version="1.06" kateversion="2.4" section="Other" extensions="*makefile*;*Makefile*" mimetype="text/x-makefile" author="Per Wigren (wigren@home.se)" license=""> +<language name="Makefile" version="1.07" kateversion="2.4" section="Other" extensions="*makefile*;*Makefile*" mimetype="text/x-makefile" author="Per Wigren (wigren@home.se)" license=""> <highlighting> <list name = "keywords"> <item> include </item> @@ -26,7 +26,7 @@ <RegExpr attribute="Operator" context="VarFromNormal" String="[$][\({]"/> <AnyChar attribute="Operator" context="#stay" String="+*=%$():\\;" /> <RegExpr attribute="Operator" context="Commands" String="[@-]" firstNonSpace="true"/> - <RegExpr attribute="Comment" context="#stay" String="(:^|[^\\])#.*$"/> + <RegExpr attribute="Comment" context="#stay" String="(?:^|[^\\])#.*$"/> </context> <context attribute="String" lineEndContext="#pop" name="String">
SVN commit 555660 by dhaumann: fix: highlight # at the beginning of a line as comment CCBUG: 92628 M +2 -2 makefile.xml --- trunk/KDE/kdelibs/kate/data/makefile.xml #555659:555660 @@ -2,7 +2,7 @@ <!DOCTYPE language SYSTEM "language.dtd"> <!-- Makefile syntaxfile v0.9 by Per Wigren <wigren@home.se> --> <!-- Modified by Joseph Wenninger <jowenn@kde.org> --> -<language name="Makefile" version="1.06" kateversion="2.4" section="Other" extensions="*makefile*;*Makefile*" mimetype="text/x-makefile" author="Per Wigren (wigren@home.se)" license=""> +<language name="Makefile" version="1.07" kateversion="2.4" section="Other" extensions="*makefile*;*Makefile*" mimetype="text/x-makefile" author="Per Wigren (wigren@home.se)" license=""> <highlighting> <list name = "keywords"> <item> include </item> @@ -26,7 +26,7 @@ <RegExpr attribute="Operator" context="VarFromNormal" String="[$][\({]"/> <AnyChar attribute="Operator" context="#stay" String="+*=%$():\\;" /> <RegExpr attribute="Operator" context="Commands" String="[@-]" firstNonSpace="true"/> - <RegExpr attribute="Comment" context="#stay" String="(:^|[^\\])#.*$"/> + <RegExpr attribute="Comment" context="#stay" String="(?:^|[^\\])#.*$"/> </context> <context attribute="String" lineEndContext="#pop" name="String">
I agree that for the life of me, the patch *should* work. However, I have applied it to my own makefile.xml, and it doesn't (worse, I seem to recall it WAS working yesterday). Any guesses? I have tried these regexpr's (none work): "(:^|[^\\])#.*$" "(?:^|[^\\])#.*$" "(?=^|[^\\])#.*$" "(?!\\)#.*$"
Can you give me the strings/examples where it does not work? Did you restart kate?
I started a brand new KATE while I had the '?:' variant in my makefile.xml... it fails on a file consisting of the two characters "\#". I can also verify my method of making KATE reload the highlighter by making verifiable changes, so I'm somewhat comfortable testing without restarting for each minor change. I *am* running older KATE (KWrite 4.4, from KDE 3.4.3 I think, not sure what actual version of KATE), but I didn't think KATE itself was broken here... maybe I am wrong? Anyway, thanks for the help!
No, it's not broken in 3.4. Please try <RegExpr attribute="Comment" context="#stay" String="(^|[^\\])#.*$"/> and if this does not work, try <RegExpr attribute="Comment" context="#stay" String="^#.*$"/> <RegExpr attribute="Comment" context="#stay" String="[^\\])#.*$"/> Thanks.
See comment #6 for examples. None of the provided regexps works correctly in all cases. The two from comment #14 will do lines 2 and 3 right, the one committed does everything but line 2 correct.
SVN commit 556104 by dhaumann: backport: really fix comments + optimizations; please test :) CCBUG:92628 M +6 -5 makefile.xml --- branches/KDE/3.5/kdelibs/kate/data/makefile.xml #556103:556104 @@ -2,7 +2,7 @@ <!DOCTYPE language SYSTEM "language.dtd"> <!-- Makefile syntaxfile v0.9 by Per Wigren <wigren@home.se> --> <!-- Modified by Joseph Wenninger <jowenn@kde.org> --> -<language name="Makefile" version="1.07" kateversion="2.4" section="Other" extensions="*makefile*;*Makefile*" mimetype="text/x-makefile" author="Per Wigren (wigren@home.se)" license=""> +<language name="Makefile" version="1.08" kateversion="2.4" section="Other" extensions="*makefile*;*Makefile*" mimetype="text/x-makefile" author="Per Wigren (wigren@home.se)" license=""> <highlighting> <list name = "keywords"> <item> include </item> @@ -24,9 +24,10 @@ <RegExpr attribute="Section" context="#stay" String="^[.].*:"/> <DetectChar attribute="String" context="String" char="""/> <RegExpr attribute="Operator" context="VarFromNormal" String="[$][\({]"/> - <AnyChar attribute="Operator" context="#stay" String="+*=%$():\\;" /> - <RegExpr attribute="Operator" context="Commands" String="[@-]" firstNonSpace="true"/> - <RegExpr attribute="Comment" context="#stay" String="(?:^|[^\\])#.*$"/> + <Detect2Chars attribute="Special" context="#stay" char="\" char1="#"/> + <AnyChar attribute="Operator" context="#stay" String="+*=%$():\\;"/> + <AnyChar attribute="Operator" context="Commands" String="@-" firstNonSpace="true"/> + <RegExpr attribute="Comment" context="#stay" String="#.*$"/> </context> <context attribute="String" lineEndContext="#pop" name="String"> @@ -49,7 +50,7 @@ </context> <context name="VarFromNormal" attribute="Variable" lineEndContext="#stay"> - <RegExpr attribute="Operator" String="[\)}]" context="#pop"/> + <AnyChar attribute="Operator" String=")}" context="#pop"/> </context> <context name="Commands" attribute="Normal Text" lineEndContext="#pop">
FWIW, that's what I finally came up with independantly, except that Detect2Chars on my KATE doesn't seem to want to work with '\', as a result of which I had to use a RegExpr instead. It does seem to work, however.
Detect2Chars really should work. In what way does it not work? I cannot imagine ;) Just for info: I used Detect2Chars because it is *much much* faster than RegExpr, and if you look closely, the whole highlighting definition almost uses 100% only RegExprs, which is speedwise very bad.
Um... huh, it's working now. It doesn't understand escape chars ("\\" doesn't work, which is somewhat unfortunate), but I thought I had tried "\" as well. Oh, well.
\\ are both colored pink as far as I know. This is due to the rule <AnyChar ... String="...\..." /> Feel free to fix/rewrite the parts ;) But if it works now that's good.
My testcase now works. What about things like this: foo \\#bar This still does not work. But I don't see any use for such things. Just leave it as is. Don't forget to put the same thing into trunk/
SVN commit 556472 by dhaumann: SVN_SILENT: neverending story CCBUG: 92628 M +2 -1 makefile.xml --- branches/KDE/3.5/kdelibs/kate/data/makefile.xml #556471:556472 @@ -25,7 +25,8 @@ <DetectChar attribute="String" context="String" char="""/> <RegExpr attribute="Operator" context="VarFromNormal" String="[$][\({]"/> <Detect2Chars attribute="Special" context="#stay" char="\" char1="#"/> - <AnyChar attribute="Operator" context="#stay" String="+*=%$():\\;"/> + <Detect2Chars attribute="Special" context="#stay" char="\" char1="\"/> + <AnyChar attribute="Operator" context="#stay" String="+*=%$():\;"/> <AnyChar attribute="Operator" context="Commands" String="@-" firstNonSpace="true"/> <RegExpr attribute="Comment" context="#stay" String="#.*$"/> </context>
SVN commit 556473 by dhaumann: SVN_SILENT: forward port: neverending story ;) make \\# bla work CCBUG: 92628 M +2 -1 makefile.xml --- trunk/KDE/kdelibs/kate/data/makefile.xml #556472:556473 @@ -25,7 +25,8 @@ <DetectChar attribute="String" context="String" char="""/> <RegExpr attribute="Operator" context="VarFromNormal" String="[$][\({]"/> <Detect2Chars attribute="Special" context="#stay" char="\" char1="#"/> - <AnyChar attribute="Operator" context="#stay" String="+*=%$():\\;"/> + <Detect2Chars attribute="Special" context="#stay" char="\" char1="\"/> + <AnyChar attribute="Operator" context="#stay" String="+*=%$():\;"/> <AnyChar attribute="Operator" context="Commands" String="@-" firstNonSpace="true"/> <RegExpr attribute="Comment" context="#stay" String="#.*$"/> </context>
Created attachment 81449 [details] Describes the bug as encountered in version 3.10.5
Hi, I have a similar problem in version 3.10.5 (see attached screenshot for details) Maybe this bug should be re-opened ?
Erwan, no, what you see is a different bug, please report it separately. I can reproduce it on today's master. The issue is with the colon within the comments, causing the highlighter to treat it as a rule.