summaryrefslogtreecommitdiffstats
path: root/kate/data/c.xml
diff options
context:
space:
mode:
Diffstat (limited to 'kate/data/c.xml')
-rw-r--r--kate/data/c.xml51
1 files changed, 41 insertions, 10 deletions
diff --git a/kate/data/c.xml b/kate/data/c.xml
index d4e8f1dd4..ee0e90fa8 100644
--- a/kate/data/c.xml
+++ b/kate/data/c.xml
@@ -1,6 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "language.dtd">
-<language name="C" version="1.25" kateversion="2.4" section="Sources" extensions="*.c;*.C;*.h" mimetype="text/x-csrc;text/x-c++src;text/x-chdr" priority="5">
+<language name="C" section="Sources"
+ version="1.42" kateversion="2.4"
+ indenter="cstyle"
+ extensions="*.c;*.C;*.h"
+ mimetype="text/x-csrc;text/x-c++src;text/x-chdr"
+ priority="5">
+<!--
+##########################################################################
+## Fixes by Sebastian Pipping (webmaster@hartwork.org)
+##
+## NOTE: Keep in sync with C++ highlighter! (cpp.xml)
+##########################################################################
+-->
<highlighting>
<list name="keywords">
<item> break </item>
@@ -55,8 +67,8 @@
<contexts>
<context attribute="Normal Text" lineEndContext="#stay" name="Normal">
<DetectSpaces />
- <RegExpr attribute="Preprocessor" context="Outscoped" String="#\s*if\s+0" beginRegion="Outscoped" firstNonSpace="true" />
- <DetectChar attribute="Preprocessor" context="Preprocessor" char="#" firstNonSpace="true" />
+ <RegExpr attribute="Preprocessor" context="Outscoped" String="#\s*if\s+0" beginRegion="PP" firstNonSpace="true" />
+ <DetectChar context="AfterHash" char="#" firstNonSpace="true" lookAhead="true" />
<StringDetect attribute="Region Marker" context="Region Marker" String="//BEGIN" beginRegion="Region1" firstNonSpace="true" />
<StringDetect attribute="Region Marker" context="Region Marker" String="//END" endRegion="Region1" firstNonSpace="true" />
<keyword attribute="Keyword" context="#stay" String="keywords"/>
@@ -86,35 +98,51 @@
<Detect2Chars attribute="Comment" context="Commentar 2" char="/" char1="*" beginRegion="Comment"/>
<AnyChar attribute="Symbol" context="#stay" String=":!%&amp;()+,-/.*&lt;=&gt;?[]|~^&#59;"/>
</context>
+
<context attribute="String" lineEndContext="#pop" name="String">
<LineContinue attribute="String" context="#stay"/>
<HlCStringChar attribute="String Char" context="#stay"/>
<DetectChar attribute="String" context="#pop" char="&quot;"/>
</context>
+
<context attribute="Region Marker" lineEndContext="#pop" name="Region Marker">
</context>
+
<context attribute="Comment" lineEndContext="#pop" name="Commentar 1">
+ <LineContinue attribute="Comment" context="#stay"/>
<IncludeRules context="##Alerts" />
</context>
+
<context attribute="Comment" lineEndContext="#stay" name="Commentar 2">
<Detect2Chars attribute="Comment" context="#pop" char="*" char1="/" endRegion="Comment"/>
<IncludeRules context="##Alerts" />
</context>
+
+ <context attribute="Error" lineEndContext="#pop" name="AfterHash">
+ <!-- define, elif, else, endif, error, if, ifdef, ifndef, include, include_next, line, pragma, undef, warning -->
+ <RegExpr attribute="Preprocessor" context="Preprocessor" String="#\s*if(?:def|ndef)?(?=\s+\S)" insensitive="true" beginRegion="PP" firstNonSpace="true" />
+ <RegExpr attribute="Preprocessor" context="Preprocessor" String="#\s*endif" insensitive="true" endRegion="PP" firstNonSpace="true" />
+ <RegExpr attribute="Preprocessor" context="Define" String="#\s*define.*((?=\\))" insensitive="true" firstNonSpace="true" />
+ <RegExpr attribute="Preprocessor" context="Preprocessor" String="#\s*(?:el(?:se|if)|include(?:_next)?|define|undef|line|error|warning|pragma)" insensitive="true" firstNonSpace="true" />
+ <RegExpr attribute="Preprocessor" context="Preprocessor" String="#\s+[0-9]+" insensitive="true" firstNonSpace="true" />
+ </context>
+
<context attribute="Preprocessor" lineEndContext="#pop" name="Preprocessor">
<LineContinue attribute="Preprocessor" context="#stay"/>
- <RegExpr attribute="Preprocessor" context="Define" String="define.*((?=\\))"/>
- <RegExpr attribute="Preprocessor" context="#stay" String="define.*"/>
<RangeDetect attribute="Prep. Lib" context="#stay" char="&quot;" char1="&quot;"/>
<RangeDetect attribute="Prep. Lib" context="#stay" char="&lt;" char1="&gt;"/>
<IncludeRules context="##Doxygen" />
- <Detect2Chars attribute="Comment" context="Commentar/Preprocessor" char="/" char1="*" beginRegion="Comment2"/>
+ <Detect2Chars attribute="Comment" context="Commentar/Preprocessor" char="/" char1="*" beginRegion="Comment2" />
</context>
+
<context attribute="Preprocessor" lineEndContext="#pop" name="Define">
<LineContinue attribute="Preprocessor" context="#stay"/>
</context>
+
<context attribute="Comment" lineEndContext="#stay" name="Commentar/Preprocessor">
<Detect2Chars attribute="Comment" context="#pop" char="*" char1="/" endRegion="Comment2" />
</context>
+
<context attribute="Comment" lineEndContext="#stay" name="Outscoped" >
<DetectSpaces />
<IncludeRules context="##Alerts" />
@@ -123,9 +151,11 @@
<IncludeRules context="##Doxygen" />
<Detect2Chars attribute="Comment" context="Commentar 1" char="/" char1="/"/>
<Detect2Chars attribute="Comment" context="Commentar 2" char="/" char1="*" beginRegion="Comment"/>
- <RegExpr attribute="Comment" context="Outscoped intern" String="#\s*if" beginRegion="Outscoped" firstNonSpace="true" />
- <RegExpr attribute="Preprocessor" context="#pop" String="#\s*(endif|else|elif)" endRegion="Outscoped" firstNonSpace="true" />
+ <RegExpr attribute="Comment" context="Outscoped intern" String="#\s*if" beginRegion="PP" firstNonSpace="true" />
+ <RegExpr attribute="Preprocessor" context="#pop" String="#\s*el(?:se|if)" firstNonSpace="true" />
+ <RegExpr attribute="Preprocessor" context="#pop" String="#\s*endif" endRegion="PP" firstNonSpace="true" />
</context>
+
<context attribute="Comment" lineEndContext="#stay" name="Outscoped intern">
<DetectSpaces />
<IncludeRules context="##Alerts" />
@@ -134,8 +164,8 @@
<IncludeRules context="##Doxygen" />
<Detect2Chars attribute="Comment" context="Commentar 1" char="/" char1="/"/>
<Detect2Chars attribute="Comment" context="Commentar 2" char="/" char1="*" beginRegion="Comment"/>
- <RegExpr attribute="Comment" context="Outscoped intern" String="#\s*if" beginRegion="Outscoped" firstNonSpace="true" />
- <RegExpr attribute="Comment" context="#pop" String="#\s*endif" endRegion="Outscoped" firstNonSpace="true" />
+ <RegExpr attribute="Comment" context="Outscoped intern" String="#\s*if" beginRegion="PP" firstNonSpace="true" />
+ <RegExpr attribute="Comment" context="#pop" String="#\s*endif" endRegion="PP" firstNonSpace="true" />
</context>
</contexts>
<itemDatas>
@@ -155,6 +185,7 @@
<itemData name="Prep. Lib" defStyleNum="dsOthers"/> <!--,Qt::darkYellow,Qt::yellow,false,false)); -->
<itemData name="Alert" defStyleNum="dsAlert" />
<itemData name="Region Marker" defStyleNum="dsRegionMarker" />
+ <itemData name="Error" defStyleNum="dsError" />
</itemDatas>
</highlighting>
<general>