diff options
author | Michele Calgaro <[email protected]> | 2015-07-04 15:26:03 +0900 |
---|---|---|
committer | Michele Calgaro <[email protected]> | 2015-07-04 15:26:03 +0900 |
commit | 4e55a1cfaa00035481a72f1271aee8954e3053ad (patch) | |
tree | 8e292a5dc5661d692348b12218d5f9c1da953a9c | |
parent | ce9d4765cc846d40b3156ccb6a457adca8097564 (diff) | |
download | tdelibs-4e55a1cfaa00035481a72f1271aee8954e3053ad.tar.gz tdelibs-4e55a1cfaa00035481a72f1271aee8954e3053ad.zip |
Fixed C++ support in Kate syntax highlighting code. This resolves bug 2455.
Signed-off-by: Michele Calgaro <[email protected]>
-rw-r--r-- | kate/data/CMakeLists.txt | 2 | ||||
-rw-r--r-- | kate/data/Makefile.am | 4 | ||||
-rw-r--r-- | kate/data/cpp.xml | 31 | ||||
-rw-r--r-- | kate/data/update-files.xml | 1 | ||||
-rw-r--r-- | kate/part/katehighlight.cpp | 37 |
5 files changed, 56 insertions, 19 deletions
diff --git a/kate/data/CMakeLists.txt b/kate/data/CMakeLists.txt index ef8e4963c..9bbfc0889 100644 --- a/kate/data/CMakeLists.txt +++ b/kate/data/CMakeLists.txt @@ -30,7 +30,7 @@ install( FILES asm-dsp56k.xml asm-m68k.xml asn1.xml asp.xml asterisk.xml awk.xml bash.xml bibtex.xml bmethod.xml ccss.xml cgis.xml cg.xml changelog.xml chicken.xml cisco.xml clipper.xml clojure.xml cmake.xml coffee.xml coldfusion.xml - commonlisp.xml component-pascal.xml context.xml crk.xml css.xml + commonlisp.xml component-pascal.xml context.xml cpp.xml crk.xml css.xml cs.xml cue.xml curry.xml c.xml ddoc.xml debianchangelog.xml debiancontrol.xml desktop.xml diff.xml djangotemplate.xml dockerfile.xml dosbat.xml dot.xml doxygenlua.xml doxygen.xml dtd.xml d.xml eiffel.xml email.xml erlang.xml diff --git a/kate/data/Makefile.am b/kate/data/Makefile.am index cb17c0787..cd901fc20 100644 --- a/kate/data/Makefile.am +++ b/kate/data/Makefile.am @@ -18,8 +18,8 @@ syntaxkate_DATA = language.dtd syntax.template \ fsharp.xml fstab.xml ftl.xml gap.xml gcc.xml gdb.xml gdl.xml gettext.xml git-ignore.xml \ git-rebase.xml gitolite.xml glosstex.xml glsl.xml gnuassembler.xml gnuplot.xml go.xml \ grammar.xml hamlet.xml haml.xml haskell.xml haxe.xml html.xml html-php.xml hunspell-aff.xml \ - hunspell-dat.xml hunspell-dic.xml hunspell-idx.xml idconsole.xml idl.xml ilerpg.xml \ - inform.xml ini.xml jam.xml javadoc.xml javascript.xml javascript-php.xml java.xml json.xml \ + hunspell-dat.xml hunspell-dic.xml hunspell-idx.xml idconsole.xml idl.xml ilerpg.xml inform.xml \ + ini.xml isocpp.xml jam.xml javadoc.xml javascript.xml javascript-php.xml java.xml json.xml \ jsp.xml julia.xml j.xml kbasic.xml latex.xml ldif.xml ld.xml less.xml lex.xml lilypond.xml \ literate-curry.xml literate-haskell.xml logtalk.xml lpc.xml lsl.xml lua.xml m3u.xml \ m4.xml mab.xml makefile.xml mako.xml mandoc.xml mason.xml mathematica.xml matlab.xml \ diff --git a/kate/data/cpp.xml b/kate/data/cpp.xml new file mode 100644 index 000000000..1f3bb6a8f --- /dev/null +++ b/kate/data/cpp.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE language SYSTEM "language.dtd" +[ + <!ENTITY space " "> + <!ENTITY separators ",;"> + <!ENTITY ns_punctuators "!%&space;&()+-/.*<=>?[]{|}~^&separators;"> +]> + +<language + name="C++" section="Sources" version="1.0" kateversion="2.4" indenter="cstyle" style="C++" + mimetype="text/x-c++src;text/x-c++hdr;text/x-chdr" + extensions="*.c++;*.cxx;*.cpp;*.cc;*.C;*.h;*.hh;*.H;*.h++;*.hxx;*.hpp;*.hcc" + license="LGPL" priority="1" > + +<!-- + This file is a wrapper from C++ to ISO C++. Its purpose is to provide C++ rules + inclusion to existing files that already include the text + <IncludeRules context="##C++" /> +--> + +<highlighting> + <contexts> + <context attribute="Normal Text" lineEndContext="#stay" name="Normal"> + <IncludeRules context="##ISO C++" /> + </context> + </contexts> +</highlighting> + +</language> + +<!-- kate: indent-width 2; tab-width 2; --> diff --git a/kate/data/update-files.xml b/kate/data/update-files.xml index 443deddac..b81ed289e 100644 --- a/kate/data/update-files.xml +++ b/kate/data/update-files.xml @@ -38,6 +38,7 @@ <Definition name="Common Lisp" url="http://git.trinitydesktop.org/cgit/tdelibs/plain/kate/data/commonlisp.xml" version="1.05-1"/> <Definition name="Component-Pascal" url="http://git.trinitydesktop.org/cgit/tdelibs/plain/kate/data/component-pascal.xml" version="1.05"/> <Definition name="ConTeXt" url="http://git.trinitydesktop.org/cgit/tdelibs/plain/kate/data/context.xml" version="1.1"/> +<Definition name="C++" url="http://git.trinitydesktop.org/cgit/tdelibs/plain/kate/data/cpp.xml" version="1.0"/> <Definition name="Crack" url="http://git.trinitydesktop.org/cgit/tdelibs/plain/kate/data/crk.xml" version="1.1"/> <Definition name="CSS/PHP" url="http://git.trinitydesktop.org/cgit/tdelibs/plain/kate/data/css-php.xml" version="2.09"/> <Definition name="CSS" url="http://git.trinitydesktop.org/cgit/tdelibs/plain/kate/data/css.xml" version="2.09"/> diff --git a/kate/part/katehighlight.cpp b/kate/part/katehighlight.cpp index 8c6ce36e5..1adbba2d5 100644 --- a/kate/part/katehighlight.cpp +++ b/kate/part/katehighlight.cpp @@ -2438,28 +2438,33 @@ void KateHighlighting::makeContextList() buildPrefix=it.key()+':'; // attribute names get prefixed by the names // of the highlighting definitions they belong to - if (identifierToUse.isEmpty() ) + if (identifierToUse.isEmpty()) + { kdDebug(13010)<<"OHOH, unknown highlighting description referenced"<<endl; - - kdDebug(13010)<<"setting ("<<it.key()<<") to loaded"<<endl; - - //mark hl as loaded - it=embeddedHls.insert(it.key(),KateEmbeddedHlInfo(true,startctx)); - //set class member for context 0 offset, so we don't need to pass it around - buildContext0Offset=startctx; - //parse one hl definition file - startctx=addToContextList(identifierToUse,startctx); - - if (noHl) return; // an error occurred - - base_startctx = startctx; - something_changed=true; // something has been loaded + kdDebug(13010)<<"Highlighting for ("<<it.key()<<") can not be loaded"<<endl; + } + else + { + // Only do this if we have a non-empty identifier + kdDebug(13010)<<"setting ("<<it.key()<<") to loaded"<<endl; + + //mark hl as loaded + it=embeddedHls.insert(it.key(),KateEmbeddedHlInfo(true,startctx)); + //set class member for context 0 offset, so we don't need to pass it around + buildContext0Offset=startctx; + //parse one hl definition file + startctx=addToContextList(identifierToUse,startctx); + + if (noHl) return; // an error occurred + + base_startctx = startctx; + something_changed=true; // something has been loaded + } } } } while (something_changed); // as long as there has been another file parsed // repeat everything, there could be newly added embedded hls. - // at this point all needed highlighing (sub)definitions are loaded. It's time // to resolve cross file references (if there are any) kdDebug(13010)<<"Unresolved contexts, which need attention: "<<unresolvedContextReferences.count()<<endl; |