<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language
[
  <!-- http://www.w3.org/TR/CSS21/syndata.html#tokenization -->
  <!ENTITY escaped "\\([0-9a-fA-F]{1,6}|[^\n\r\f0-9a-fA-F])">
  <!ENTITY nmstart "[_a-zA-Z]|&escaped;">
  <!ENTITY nmchar  "[_a-zA-Z0-9-]|&escaped;">
]>
<language name="LESSCSS" version="10" kateversion="5.79" section="Markup" extensions="*.less" mimetype="text/css"
          author="from CCS:Wilbert Berendsen (wilbert@kde.nl)" license="LGPL">

    <highlighting>
        <list name="properties">
            <include>properties##CSS</include>
        </list>

        <list name="vendor properties">
            <include>vendor properties##CSS</include>
        </list>

        <list name="values">
            <include>values##CSS</include>
        </list>

        <list name="value keywords">
            <include>value keywords##CSS</include>
        </list>

        <list name="colors">
            <include>colors##CSS</include>
        </list>

        <list name="functions">
            <include>functions##CSS</include>

            <!-- Less functions, @see http://lesscss.org/functions/ -->
            <item>%</item>
            <item>abs</item>
            <item>acos</item>
            <item>alpha</item>
            <item>argb</item>
            <item>asin</item>
            <item>atan</item>
            <item>average</item>
            <item>blue</item>
            <item>boolean</item>
            <item>ceil</item>
            <item>color</item>
            <item>contrast</item>
            <item>convert</item>
            <item>cos</item>
            <item>darken</item>
            <item>data-uri</item>
            <item>default</item>
            <item>desaturate</item>
            <item>difference</item>
            <item>e</item>
            <item>each</item>
            <item>escape</item>
            <item>exclusion</item>
            <item>extract</item>
            <item>fade</item>
            <item>fadein</item>
            <item>fadeout</item>
            <item>floor</item>
            <item>get-unit</item>
            <item>green</item>
            <item>greyscale</item>
            <item>hardlight</item>
            <item>hsl</item>
            <item>hsla</item>
            <item>hsv</item>
            <item>hsva</item>
            <item>hsvhue</item>
            <item>hsvsaturation</item>
            <item>hsvvalue</item>
            <item>hue</item>
            <item>if</item>
            <item>image-height</item>
            <item>image-size</item>
            <item>image-width</item>
            <item>iscolor</item>
            <item>isdefined</item>
            <item>isem</item>
            <item>iskeyword</item>
            <item>isnumber</item>
            <item>ispercentage</item>
            <item>ispixel</item>
            <item>isruleset</item>
            <item>isstring</item>
            <item>isunit</item>
            <item>isurl</item>
            <item>length</item>
            <item>lighten</item>
            <item>lightness</item>
            <item>luma</item>
            <item>luminance</item>
            <item>max</item>
            <item>min</item>
            <item>mix</item>
            <item>mod</item>
            <item>multiply</item>
            <item>negation</item>
            <item>overlay</item>
            <item>percentage</item>
            <item>pi</item>
            <item>pow</item>
            <item>range</item>
            <item>red</item>
            <item>replace</item>
            <item>rgb</item>
            <item>rgba</item>
            <item>round</item>
            <item>saturate</item>
            <item>saturation</item>
            <item>screen</item>
            <item>shade</item>
            <item>sin</item>
            <item>softlight</item>
            <item>spin</item>
            <item>sqrt</item>
            <item>svg-gradient</item>
            <item>tan</item>
            <item>tint</item>
            <item>unit</item>
        </list>

        <list name="media types">
            <include>media types##CSS</include>
        </list>

        <list name="media operators">
            <include>media operators##CSS</include>
        </list>

        <list name="media features">
            <include>media features##CSS</include>
        </list>

        <list name="pseudo-classes">
            <include>pseudo-classes##CSS</include>
            <!-- Less -->
            <item>extend</item>
        </list>

        <list name="pseudo-elements">
            <include>pseudo-elements##CSS</include>
        </list>

        <contexts>
            <context attribute="Normal Text" lineEndContext="#stay" name="Base">
                <IncludeRules context="FindComments"/>

                <DetectChar attribute="Normal Text" beginRegion="ruleset" char="{" context="RuleSet"/>
                <RegExpr attribute="Variable" context="VariableDefine" String="\@[a-zA-Z0-9\-_]+\s*:"/>
                <RegExpr attribute="At Rule" context="AtRule" String="@[a-zA-Z0-1\-]+\b"/>

                <IncludeRules context="FindSelectors"/>
            </context>

            <!-- find selectors // .class #id :hover :nth-child(2n+1) [type="search"] -->
            <context attribute="Normal Text" lineEndContext="#stay" name="FindSelectors">
                <IncludeRules context="FindInterpolation"/>

                <DetectChar attribute="Annotation" context="Annotation" char="!"/>
                <DetectChar attribute="Selector Attribute" char="[" context="SelectorAttr"/>
                <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" char=":" context="SelectorPseudo"/>
                <RegExpr attribute="Control Flow" context="Condition" String="when\s*(not)?(?=\s*\()"/>
                <DetectChar attribute="Normal Text" char="(" context="Function" lookAhead="true"/>

                <IncludeRules context="FindVariables"/>
            </context>

            <context attribute="Normal Text" lineEndContext="#stay" name="Condition">
                <DetectChar attribute="Normal Text" char=")" context="#pop"/>

                <IncludeRules context="FindFunctions"/>
                <IncludeRules context="FindVariables"/>
                <IncludeRules context="FindValues"/>
            </context>

            <!-- find variables // @page-width -->
            <context attribute="Normal Text" lineEndContext="#stay" name="FindVariables">
                <RegExpr attribute="Variable" context="#stay" String="[\@]{1,2}[a-zA-Z0-9\-_]+"/>
            </context>

            <context attribute="Normal Text" lineEndContext="#stay" name="FindInterpolation">
                <!-- @{variable} -->
                <RegExpr attribute="Variable" context="Interpolation" String="\@\{\s*[a-zA-Z0-9\-_]+"/>
            </context>

            <!-- find functions // rgba(255,255,255,0.75) -->
            <context attribute="Normal Text" lineEndContext="#stay" name="FindFunctions">
                <RegExpr attribute="Function" context="Function" String="([a-z\-]+|%)\(" lookAhead="true"/>
            </context>

            <!-- find values //  10px 12pt 2.5em 1rem 75% #ffcc99 red solid -->
            <context attribute="Normal Text" lineEndContext="#stay" name="FindValues">
                <DetectChar attribute="Annotation" context="Annotation" char="!"/>

                <IncludeRules context="FindInterpolation"/>
                <IncludeRules context="FindVariables"/>

                <keyword attribute="Value Keyword" context="#stay" String="value keywords"/>
                <keyword attribute="Value" context="#stay" String="values"/>
                <keyword attribute="Color" context="#stay" String="colors"/>
                <RegExpr attribute="Color" context="#stay" String="#([0-9A-Fa-f]{3,4}){1,2}\b"/>
                <RegExpr attribute="Number" context="FindUnits" String="[-+]?([0-9]+(\.[0-9]+)?|\.[0-9]+)([eE][+-]?[0-9]+)?(?![-+])"/>
                <RegExpr attribute="Value" context="#stay" String="[-+]?[0-9.]+[%]?"/>
                <RegExpr attribute="Normal Text" context="#stay" String="[\w\-]+"/>
            </context>

            <context name="Annotation" attribute="Normal Text" lineEndContext="#pop" fallthroughContext="#pop">
                <WordDetect attribute="Annotation" context="#pop" String="important"/>
                <WordDetect attribute="Annotation" context="#pop" String="default"/>
            </context>

            <context name="FindUnits" attribute="Normal Text" lineEndContext="#pop" fallthroughContext="#pop">
                <RegExpr attribute="Unit" context="#stay" String="(%|(em|ex|cap|ch|ic|rem|lh|rlh|vw|vh|vi|vb|vmin|vmax|cqw|cqh|cqi|cqb|cqmin|cqmax|cm|mm|Q|in|pc|pt|px|deg|grad|rad|turn|s|ms|Hz|kHz|fr|dpi|dpcm|dppx|x)\b)"/>
            </context>

            <!-- find strings // "some words" 'some words' -->
            <context attribute="Normal Text" lineEndContext="#stay" name="FindStrings">
                <DetectChar attribute="String" context="StringDQ" char="&quot;"/>
                <DetectChar attribute="String" context="StringSQ" char="'"/>
            </context>

            <!-- find comments // /* comment */  // comment -->
            <context attribute="Normal Text" lineEndContext="#stay" name="FindComments">
                <RegExpr attribute="Region Marker" context="#stay" String="/\*BEGIN.*\*/|//\s*BEGIN.*" beginRegion="UserDefined"/>
                <RegExpr attribute="Region Marker" context="#stay" String="/\*END.*\*/|//\s*END.*" endRegion="UserDefined"/>
                <Detect2Chars attribute="Comment" context="Comment" char="/" char1="*" beginRegion="comment"/>
                <Detect2Chars attribute="Comment" context="LessComment" char="/" char1="/" />
            </context>

            <context attribute="Normal Text" lineEndContext="#pop" name="AtRule">
                <IncludeRules context="FindComments"/>
                <IncludeRules context="FindStrings"/>

                <keyword attribute="Value" context="#stay" String="media types"/>
                <keyword attribute="Control Flow" context="#stay" String="media operators"/>
                <keyword attribute="Property" context="#stay" String="media features"/>
                <AnyChar attribute="Normal Text" context="#pop" lookAhead="true" String=";{"/>

                <IncludeRules context="FindInterpolation"/>
                <IncludeRules context="FindVariables"/>
                <IncludeRules context="FindValues"/>
            </context>

            <context attribute="Normal Text" lineEndContext="#stay" name="VariableDefine">
                <DetectChar attribute="Normal Text" beginRegion="ruleset" char="{" context="#pop!RuleSet"/>
                <DetectChar attribute="Normal Text" char=";" context="#pop"/>

                <IncludeRules context="FindInterpolation"/>
                <IncludeRules context="FindVariables"/>
                <IncludeRules context="FindComments"/>
                <IncludeRules context="FindStrings"/>
                <IncludeRules context="FindFunctions"/>
                <IncludeRules context="FindValues"/>
            </context>

            <!-- Interpolation -->
            <context attribute="Normal Text" lineEndContext="#stay" name="Interpolation">
                <DetectChar attribute="Variable" char="}" context="#pop"/>

                <IncludeRules context="FindInterpolation"/>
                <IncludeRules context="FindVariables"/>
            </context>

            <context attribute="Selector Attribute" lineEndContext="#stay" name="SelectorAttr">
                <DetectChar attribute="Selector Attribute" char="]" context="#pop"/>

                <IncludeRules context="FindStrings"/>
            </context>

            <context attribute="Selector Pseudo" fallthroughContext="#pop" lineEndContext="#pop"
                     name="SelectorPseudo">
                <RegExpr attribute="Selector Pseudo" context="SelectorPseudoParameters" String="extend(?=\s*\()"/>
                <keyword attribute="Selector Pseudo" context="#pop" String="pseudo-classes"/>
            </context>

            <context attribute="Normal Text" lineEndContext="#stay" name="SelectorPseudoParameters">
                <DetectChar attribute="Normal Text" char="(" context="#stay"/>
                <DetectChar attribute="Normal Text" char=")" context="#pop#pop"/>

                <IncludeRules context="FindSelectors"/>
            </context>

            <context attribute="Comment" lineEndContext="#pop" name="LessComment">
                <DetectSpaces />
                <IncludeRules context="##Comments"/>
                <DetectIdentifier />
            </context>

            <context attribute="Comment" lineEndContext="#stay" name="Comment">
                <Detect2Chars attribute="Comment" context="#pop" char="*" char1="/" endRegion="comment"/>

                <IncludeRules context="LessComment"/>
            </context>

            <context attribute="Normal Text" lineEndContext="#stay" name="RuleSet">
                <DetectChar attribute="Normal Text" char="{" context="RuleSet" beginRegion="ruleset"/>
                <DetectChar attribute="Normal Text" char="}" context="#pop" endRegion="ruleset"/>
                <!-- find CSS property, like border-radius with optional + or +- decorators -->
                <!-- as above, but include support for interpolation -->
                <RegExpr attribute="Property" context="Rule"
                         String="-?[A-Za-z_\-]+(?=\s*(\+|\+_)?\s*:)|-?[A-Za-z_\-]*@{\s*[a-zA-Z0-9\-_]+}[A-Za-z_\-]*(?=\s*(\+|\+_)?\s*:)" lookAhead="true"
                         />

                <IncludeRules context="Base"/>
            </context>

            <context attribute="Normal Text" lineEndContext="#stay" name="Rule">
                <IncludeRules context="FindInterpolation"/>

                <RegExpr attribute="Normal Text" context="RuleParameters" String="(\+|\+_)?\s*:"/>
                <keyword attribute="Property" context="#stay" String="properties"/>
                <RegExpr attribute="Vendor Property" context="#stay" String="-(webkit|moz|o|ms)-[-_a-zA-Z0-9]*"/>
                <RegExpr attribute="Unknown Property" context="#stay" String="\S[a-zA-Z0-9]*"/>
            </context>

            <context attribute="Normal Text" lineEndContext="#stay" name="RuleParameters">
                <DetectChar attribute="Normal Text" context="#pop#pop" char=";"/>
                <DetectChar attribute="Normal Text" context="#pop#pop#pop" char="}" endRegion="ruleset"/>

                <IncludeRules context="FindComments"/>
                <IncludeRules context="FindStrings"/>
                <IncludeRules context="FindFunctions"/>
                <IncludeRules context="FindValues"/>
            </context>

            <context attribute="Normal Text" lineEndContext="#stay" name="Function">
                <DetectChar attribute="Normal Text" char="(" context="FunctionParameters"/>
                <keyword attribute="Function" context="#stay" String="functions"/>
            </context>

            <context attribute="Normal Text" lineEndContext="#stay" name="FunctionParameters">
                <DetectChar attribute="Normal Text" context="#pop#pop" char=")"/>
                <IncludeRules context="FindComments"/>
                <IncludeRules context="FindStrings"/>
                <IncludeRules context="FindInterpolation"/>
                <IncludeRules context="FindVariables"/>
                <IncludeRules context="FindFunctions"/>
                <IncludeRules context="FindValues"/>
            </context>

            <!-- string contexts -->
            <context attribute="String" lineEndContext="#stay" name="StringDQ">
                <DetectChar attribute="String" char="&quot;" context="#pop"/>

                <IncludeRules context="InsideString"/>
            </context>

            <context attribute="String" lineEndContext="#stay" name="StringSQ">
                <DetectChar attribute="String" char="'" context="#pop"/>

                <IncludeRules context="InsideString"/>
            </context>

            <context attribute="String" lineEndContext="#stay" name="InsideString">
                <RegExpr attribute="String" context="#stay" String="\\[&quot;']"/>

                <IncludeRules context="FindInterpolation"/>

                <DetectIdentifier/>
            </context>
        </contexts>

        <itemDatas>
            <itemData defStyleNum="dsNormal" name="Normal Text" spellChecking="false"/>
            <itemData defStyleNum="dsVariable" name="Variable" spellChecking="false"/>
            <itemData defStyleNum="dsControlFlow" name="Control Flow" spellChecking="false"/>
            <itemData defStyleNum="dsImport" name="At Rule" spellChecking="false"/>
            <itemData defStyleNum="dsKeyword" name="Property" spellChecking="false"/>
            <itemData defStyleNum="dsKeyword" name="Vendor Property" spellChecking="false" italic="1"/>
            <itemData defStyleNum="dsNormal" italic="1" name="Unknown Property" spellChecking="false"/>
            <itemData defStyleNum="dsString" name="String"/>
            <itemData defStyleNum="dsDecVal" name="Value" spellChecking="false"/>
            <itemData defStyleNum="dsDecVal" name="Number" spellChecking="false"/>
            <itemData defStyleNum="dsBuiltIn" name="Value Keyword" spellChecking="false"/>
            <itemData defStyleNum="dsConstant" name="Color" spellChecking="false"/>
            <itemData defStyleNum="dsDataType" name="Unit" spellChecking="false"/>
            <itemData defStyleNum="dsBuiltIn" name="Function" spellChecking="false"/>
            <itemData defStyleNum="dsAttribute" name="Annotation" spellChecking="false"/>
            <itemData bold="1" defStyleNum="dsPreprocessor" name="Selector Id" spellChecking="false"/>
            <itemData defStyleNum="dsFunction" name="Selector Class" spellChecking="false"/>
            <itemData defStyleNum="dsExtension" name="Selector Attribute" spellChecking="false"/>
            <itemData defStyleNum="dsInformation" name="Selector Pseudo" spellChecking="false"/>
            <itemData defStyleNum="dsComment" name="Comment"/>
            <itemData defStyleNum="dsRegionMarker" name="Region Marker" spellChecking="false"/>
        </itemDatas>
    </highlighting>

    <general>
        <keywords casesensitive="0" weakDeliminator="-%"/>
        <comments>
            <comment name="multiLine" start="/*" end="*/" region="comment"/>
            <comment name="singleLine" start="//" position="afterwhitespace"/>
        </comments>
    </general>
</language>
<!-- kate: replace-tabs on; tab-width 4; indent-width 4; -->
