aboutsummaryrefslogtreecommitdiffstats
path: root/src/share/3rdparty/generic-highlighter/css.xml
diff options
context:
space:
mode:
Diffstat (limited to 'src/share/3rdparty/generic-highlighter/css.xml')
-rw-r--r--src/share/3rdparty/generic-highlighter/css.xml215
1 files changed, 79 insertions, 136 deletions
diff --git a/src/share/3rdparty/generic-highlighter/css.xml b/src/share/3rdparty/generic-highlighter/css.xml
index afb184211d4..2215c162a98 100644
--- a/src/share/3rdparty/generic-highlighter/css.xml
+++ b/src/share/3rdparty/generic-highlighter/css.xml
@@ -12,6 +12,9 @@ Kate CSS syntax highlighting definition
Changelog:
+- Version 4, by Guo Yunhe guoyunhebrave@gmail.com
+- Remake for complex CSS syntax, avoid errors
+
- Version 2.13, by Guo Yunhe
- Add all W3C Work Draft properties
@@ -26,7 +29,7 @@ Changelog:
-->
-<language name="CSS" version="3" kateversion="5.0" section="Markup" extensions="*.css" indenter="cstyle" mimetype="text/css" author="Wilbert Berendsen (wilbert@kde.nl)" license="LGPL">
+<language name="CSS" version="4" kateversion="5.0" section="Markup" extensions="*.css" indenter="cstyle" mimetype="text/css" author="Wilbert Berendsen (wilbert@kde.nl)" license="LGPL" priority="10">
<highlighting>
<list name="properties">
@@ -560,7 +563,7 @@ Changelog:
<item> topline </item>
</list>
- <list name="types">
+ <list name="values">
<item> inherit </item>
<item> none </item>
<item> hidden </item>
@@ -798,7 +801,7 @@ Changelog:
<item> WindowText </item>
</list>
- <list name="paren">
+ <list name="functions">
<item> url </item>
<item> attr </item>
<item> rect </item>
@@ -905,185 +908,124 @@ Changelog:
</list>
<contexts>
- <context attribute="Normal Text" lineEndContext="#stay" name="Base">
- <LineContinue/>
- <DetectSpaces/>
- <IncludeRules context="FindRuleSets" />
+ <context name="Base" attribute="Normal Text" lineEndContext="#stay">
+ <IncludeRules context="FindComments" />
+ <DetectChar attribute="Normal Text" context="RuleSet" char="{" beginRegion="ruleset" />
+ <RegExpr attribute="At Rule" context="AtRule" String="@[a-zA-Z0-1-]+\b" />
+ <IncludeRules context="FindSelectors" />
</context>
- <!-- to be included -->
- <!-- finds rules and detects nesting -->
- <context attribute="Normal Text" lineEndContext="#stay" name="FindRuleSets">
- <RegExpr attribute="Media" context="Media" String="@media\b" />
- <RegExpr attribute="At Rule" context="Import" String="@import\b" />
- <RegExpr attribute="At Rule" context="#stay" String="@(font-face|charset)\b" />
- <DetectChar attribute="Property" context="RuleSet" char="{" beginRegion="ruleset" />
- <!--parse selectors-->
- <DetectChar attribute="Selector Attr" context="SelAttr" char="[" />
+ <!-- find selectors // .class #id :hover :nth-child(2n+1) [type="search"] -->
+ <context name="FindSelectors" attribute="Normal Text" lineEndContext="#stay">
+ <DetectChar attribute="Selector Attribute" context="SelectorAttr" char="[" />
<RegExpr attribute="Selector Id" context="#stay" String="#(-)?(&nmstart;)(&nmchar;)*" />
<RegExpr attribute="Selector Class" context="#stay" String="\.([a-zA-Z0-9\-_]|[\x80-\xFF]|\\[0-9A-Fa-f]{1,6})*" />
<RegExpr attribute="Selector Pseudo" context="#stay" String=":lang\([\w_-]+\)" />
- <DetectChar attribute="Selector Pseudo" context="SelPseudo" char=":" />
- <IncludeRules context="FindStrings" />
- <IncludeRules context="FindComments" />
+ <DetectChar attribute="Selector Pseudo" context="SelectorPseudo" char=":" />
+ </context>
+
+ <!-- find functions // rgba(255,255,255,0.75) -->
+ <context name="FindFunctions" attribute="Normal Text" lineEndContext="#stay">
+ <RegExpr attribute="Function" context="Function" String="[a-z\-]+\(" lookAhead="true" />
</context>
- <!-- finds arguments to properties -->
- <context attribute="Normal Text" lineEndContext="#stay" name="FindValues">
+ <!-- find values // 10px 12pt 2.5em 1rem 75% #ffcc99 red solid -->
+ <context name="FindValues" attribute="Normal Text" lineEndContext="#stay">
+ <RegExpr attribute="Annotation" context="#stay" String="!important\b" />
+ <keyword attribute="Value" context="#stay" String="values" />
+ <keyword attribute="Value" context="#stay" String="colors" />
+ <RegExpr attribute="Value" context="#stay" String="#([0-9A-Fa-f]{3}){1,4}\b" />
<RegExpr attribute="Value" context="#stay" String="[-+]?[0-9.]+(em|ex|ch|rem|vw|vh|vm|px|in|cm|mm|pt|pc|deg|rad|grad|turn|ms|s|Hz|kHz)\b" />
<RegExpr attribute="Value" context="#stay" String="[-+]?[0-9.]+[%]?" />
<RegExpr attribute="Normal Text" context="#stay" String="[\w\-]+" />
</context>
- <!-- finds strings -->
- <context attribute="Normal Text" lineEndContext="#stay" name="FindStrings">
+ <!-- find strings // "some words" 'some words' -->
+ <context name="FindStrings" attribute="Normal Text" lineEndContext="#stay">
<DetectChar attribute="String" context="StringDQ" char="&quot;" />
<DetectChar attribute="String" context="StringSQ" char="'" />
</context>
- <!-- finds comments -->
- <context attribute="Normal Text" lineEndContext="#stay" name="FindComments">
+ <!-- find comments // /* comment */ -->
+ <context name="FindComments" attribute="Normal Text" lineEndContext="#stay">
<RegExpr attribute="Region Marker" context="#stay" String="/\*BEGIN.*\*/" beginRegion="UserDefined" />
<RegExpr attribute="Region Marker" context="#stay" String="/\*END.*\*/" endRegion="UserDefined" />
<Detect2Chars attribute="Comment" context="Comment" char="/" char1="*" beginRegion="comment" />
</context>
- <!-- other contexts -->
- <context attribute="Normal Text" lineEndContext="#stay" name="Media">
- <DetectChar attribute="Media" context="Media2" char="{" beginRegion="media" />
- <DetectChar attribute="Media" context="MediaQueryExpression" char="(" />
- <keyword attribute="Media" context="MediaQueries" String="mediatypes"/>
- <keyword attribute="Media" context="MediaTypes" String="mediatypes_op" />
- <DetectChar attribute="Media" context="#stay" char="," />
+ <context name="AtRule" attribute="Normal Text" lineEndContext="#pop">
<IncludeRules context="FindComments" />
- <RegExpr attribute="Error" context="#stay" String="\S+" />
- </context>
-
- <context attribute="Media" lineEndContext="#stay" name="MediaTypes">
- <keyword attribute="Media" context="MediaQueries" String="mediatypes"/>
- <DetectChar attribute="Media" context="#pop" char= "{" lookAhead="true"/>
- <DetectChar attribute="Media" context="#pop" char= "," lookAhead="true"/>
- <DetectSpaces/>
- <IncludeRules context="FindComments"/>
- <RegExpr attribute="Error" context="#stay" String="\S+"/>
- </context>
-
- <context attribute="Media" lineEndContext="#stay" name="MediaQueries">
- <RegExpr attribute="Media" context="MediaQueryExpression" String="\s+and\s+\("/>
- <DetectChar attribute="Media" context="#pop" char= "{" lookAhead="true"/>
- <DetectChar attribute="Media" context="#pop" char= "," lookAhead="true"/>
- <DetectSpaces/>
- <IncludeRules context="FindComments"/>
- <RegExpr attribute="Error" context="#stay" String="\S+"/>
- </context>
-
- <context attribute="Media" lineEndContext="#stay" name="MediaQueryExpression">
- <DetectSpaces/>
- <keyword attribute="Media" context="MQEE" String="media_features"/>
- <IncludeRules context="FindComments"/>
- <RegExpr attribute="Error" context="#stay" String="\S+"/>
- </context>
-
- <context attribute="Media" lineEndContext="#stay" name="MQEE" fallthrough="true" fallthroughContext="#pop">
- <DetectSpaces/>
- <IncludeRules context="FindComments"/>
- <DetectChar attribute="Media" context="MQEV" char=":"/>
- <RegExpr attribute="Media" context="#pop" String="\)\s+and\s+\("/>
- <DetectChar attribute="Media" context="#pop#pop" char=")"/>
- </context>
-
- <context attribute="Media" lineEndContext="#stay" name="MQEV">
- <!-- this should be seperate for different features, for now it is all the same -->
- <DetectSpaces/>
- <RegExpr attribute="Value" context="#pop" String="[1-9][0-9.]*\s*/\s*[1-9][0-9.]*" />
- <RegExpr attribute="Value" context="#pop" String="[0-9.]+(em|ex|ch|rem|vw|vh|vm|px|in|cm|mm|pt|pc|deg|rad|grad|turn|ms|s|Hz|kHz|dpi|dpcm)\b" />
- <RegExpr attribute="Value" context="#pop" String="[0-9.]+[%]?" />
- <RegExpr attribute="Value" context="#pop" String="(portrait|landscape)" />
- <RegExpr attribute="Error" context="#stay" String=".*"/>
- </context>
-
- <context attribute="Normal Text" lineEndContext="#stay" name="Media2">
- <DetectChar attribute="Media" context="#pop#pop" char="}" endRegion="media" />
- <IncludeRules context="FindRuleSets" />
+ <IncludeRules context="FindStrings" />
+ <keyword attribute="Value" context="#stay" String="mediatypes" />
+ <keyword attribute="Property" context="#stay" String="media_features" />
+ <AnyChar attribute="Normal Text" context="#pop" String=";{" lookAhead="true" />
+ <IncludeRules context="FindValues" />
</context>
- <context attribute="Selector Attr" lineEndContext="#stay" name="SelAttr">
- <DetectChar attribute="Selector Attr" context="#pop" char="]" />
+ <context name="SelectorAttr" attribute="Selector Attribute" lineEndContext="#stay">
+ <DetectChar attribute="Selector Attribute" context="#pop" char="]" />
<IncludeRules context="FindStrings" />
</context>
- <context attribute="Selector Pseudo" lineEndContext="#pop" name="SelPseudo"
+ <context name="SelectorPseudo" attribute="Selector Pseudo" lineEndContext="#pop"
fallthrough="true" fallthroughContext="#pop">
<keyword attribute="Selector Pseudo" context="#pop" String="pseudoclasses" />
</context>
- <context attribute="Normal Text" lineEndContext="#stay" name="Import">
- <DetectChar attribute="At Rule" context="#pop" char=";" />
- <keyword attribute="Media" context="#stay" String="mediatypes" />
- <IncludeRules context="FindValues" />
- <IncludeRules context="FindStrings" />
- <IncludeRules context="FindComments" />
- </context>
-
- <context attribute="Comment" lineEndContext="#stay" name="Comment">
- <DetectSpaces/>
+ <context name="Comment" attribute="Comment" lineEndContext="#stay">
<Detect2Chars attribute="Comment" context="#pop" char="*" char1="/" endRegion="comment" />
<IncludeRules context="##Alerts" />
- <DetectIdentifier/>
</context>
- <context attribute="Normal Text" lineEndContext="#stay" name="RuleSet">
- <DetectChar attribute="Property" context="#pop" char="}" endRegion="ruleset" />
- <keyword attribute="Property" context="Rule" String="properties" />
- <RegExpr attribute="Unknown Property" context="Rule" String="-?[A-Za-z_-]+(?=\s*:)" />
- <IncludeRules context="FindComments" />
- <RegExpr attribute="Error" context="#stay" String="\S" />
+ <context name="RuleSet" attribute="Normal Text" lineEndContext="#stay">
+ <DetectChar attribute="Normal Text" context="RuleSet" char="{" beginRegion="ruleset" />
+ <DetectChar attribute="Normal Text" context="#pop" char="}" endRegion="ruleset" />
+ <RegExpr attribute="Property" context="Rule" String="-?[A-Za-z_-]+(?=\s*:)" lookAhead="true" />
+ <IncludeRules context="Base" />
</context>
- <context attribute="Normal Text" lineEndContext="#stay" name="Rule">
- <DetectChar attribute="Property" context="Rule2" char=":" />
+ <context name="Rule" attribute="Normal Text" lineEndContext="#stay">
+ <DetectChar attribute="Normal Text" context="RuleParameters" char=":" />
+ <keyword attribute="Property" context="#stay" String="properties" />
+ <RegExpr attribute="Unknown Property" context="#stay" String="-?[A-Za-z_-]+(?=\s*:)" />
<RegExpr attribute="Error" context="#stay" String="\S" />
</context>
- <context attribute="Normal Text" lineEndContext="#stay" name="Rule2">
- <DetectChar attribute="Property" context="#pop#pop" char=";" />
- <DetectChar attribute="Property" context="#pop#pop#pop" char="}" endRegion="ruleset" />
- <!-- parse property values -->
- <keyword attribute="Value" context="#stay" String="types" />
- <keyword attribute="Value" context="#stay" String="colors" />
- <RegExpr attribute="Value" context="#stay" String="#([0-9A-Fa-f]{3}){1,4}\b" />
- <keyword attribute="Value" context="PropParen" String="paren" />
- <RegExpr attribute="Important" context="#stay" String="!important\b" />
- <IncludeRules context="FindValues" />
- <IncludeRules context="FindStrings" />
+ <context name="RuleParameters" attribute="Normal Text" lineEndContext="#stay">
<IncludeRules context="FindComments" />
+ <IncludeRules context="FindStrings" />
+ <IncludeRules context="FindFunctions" />
+ <IncludeRules context="FindValues" />
+ <!-- Jump out conditions -->
+ <DetectChar attribute="Normal Text" context="#pop#pop" char=";" />
+ <DetectChar attribute="Normal Text" context="#pop#pop#pop" char="}" endRegion="ruleset" />
</context>
- <context attribute="Normal Text" lineEndContext="#stay" name="PropParen">
- <DetectChar attribute="Value" context="PropParen2" char="(" />
- <IncludeRules context="FindComments" />
- <RegExpr attribute="Error" context="#stay" String="\S" />
+ <context name="Function" attribute="Normal Text" lineEndContext="#stay">
+ <DetectChar attribute="Normal Text" context="FunctionParameters" char="(" />
+ <keyword attribute="Function" context="#stay" String="functions" />
</context>
- <context attribute="Normal Text" lineEndContext="#stay" name="PropParen2">
- <DetectChar attribute="Value" context="#pop#pop" char=")" />
- <IncludeRules context="FindValues" />
- <IncludeRules context="FindStrings" />
+ <context name="FunctionParameters" attribute="Normal Text" lineEndContext="#stay">
<IncludeRules context="FindComments" />
+ <IncludeRules context="FindStrings" />
+ <IncludeRules context="FindValues" />
+ <!-- Jump out conditions -->
+ <DetectChar attribute="Normal Text" context="#pop#pop" char=")" />
</context>
<!-- string contexts -->
- <context attribute="String" lineEndContext="#stay" name="StringDQ">
+ <context name="StringDQ" attribute="String" lineEndContext="#stay">
<DetectChar attribute="String" context="#pop" char="&quot;" />
<IncludeRules context="InsideString" />
</context>
- <context attribute="String" lineEndContext="#stay" name="StringSQ">
+ <context name="StringSQ" attribute="String" lineEndContext="#stay">
<DetectChar attribute="String" context="#pop" char="'" />
<IncludeRules context="InsideString" />
</context>
- <context attribute="String" lineEndContext="#stay" name="InsideString">
+ <context name="InsideString" attribute="String" lineEndContext="#stay">
<RegExpr attribute="String" context="#stay" String="\\[&quot;']" />
<DetectIdentifier/>
</context>
@@ -1092,19 +1034,20 @@ Changelog:
<itemDatas>
<itemData name="Normal Text" defStyleNum="dsNormal" spellChecking="false"/>
- <itemData name="Property" defStyleNum="dsKeyword" spellChecking="false"/>
- <itemData name="Unknown Property" defStyleNum="dsKeyword" italic="1" spellChecking="false"/>
- <itemData name="Media" defStyleNum="dsDecVal" bold="1" spellChecking="false"/>
- <itemData name="At Rule" defStyleNum="dsDecVal" spellChecking="false"/>
- <itemData name="String" defStyleNum="dsString"/>
- <itemData name="Value" defStyleNum="dsDataType" spellChecking="false"/>
- <itemData name="Important" defStyleNum="dsKeyword" spellChecking="false"/>
- <itemData name="Selector Attr" defStyleNum="dsAttribute" spellChecking="false"/>
- <itemData name="Selector Id" defStyleNum="dsFloat" bold="1" spellChecking="false"/>
- <itemData name="Selector Class" defStyleNum="dsFloat" spellChecking="false"/>
- <itemData name="Selector Pseudo" defStyleNum="dsDecVal" spellChecking="false"/>
+ <itemData name="At Rule" defStyleNum="dsImport" spellChecking="false"/>
+ <itemData name="Property" defStyleNum="dsKeyword" spellChecking="false"/>
+ <itemData name="Unknown Property" defStyleNum="dsNormal" spellChecking="false"/>
+ <itemData name="String" defStyleNum="dsString"/>
+ <itemData name="Value" defStyleNum="dsDecVal" spellChecking="false"/>
+ <itemData name="Function" defStyleNum="dsFunction" spellChecking="false"/>
+ <itemData name="Annotation" defStyleNum="dsAttribute" spellChecking="false"/>
+ <itemData name="Selector Id" defStyleNum="dsPreprocessor" bold="1" spellChecking="false"/>
+ <itemData name="Selector Class" defStyleNum="dsFunction" spellChecking="false"/>
+ <itemData name="Selector Attribute" defStyleNum="dsExtension" spellChecking="false"/>
+ <itemData name="Selector Pseudo" defStyleNum="dsInformation" italic="1" spellChecking="false"/>
<itemData name="Comment" defStyleNum="dsComment" />
<itemData name="Region Marker" defStyleNum="dsRegionMarker" spellChecking="false"/>
+ <itemData name="Alert" defStyleNum="dsAlert" spellChecking="false"/>
<itemData name="Error" defStyleNum="dsError" spellChecking="false"/>
</itemDatas>
</highlighting>