<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language>
<!--
 ***************************************************************************
 ** Writing a Kate Highlighting XML File
 ** http://kate-editor.org/article/writing_a_kate_highlighting_xml_file
 **
 ** Introducing JSON
 ** http://www.json.org/
 **
 ** The application/json Media Type for JavaScript Object Notation (JSON)
 ** http://tools.ietf.org/html/rfc4627
 ** https://www.json.org/json-en.html
 ***************************************************************************
-->
<language name="JSON" section="Markup" version="9" kateversion="2.4" extensions="*.json;*.jsonl;.kateproject;.arcconfig;*.geojson;*.gltf;*.theme;*.cast" mimetype="application/json" author="Sebastian Pipping (sebastian@pipping.org)" license="GPL">
  <highlighting>
    <list name="Constants">
      <item>null</item>
      <item>true</item>
      <item>false</item>
    </list>

    <contexts>
      <context name="Normal" lineEndContext="#stay" attribute="Style_Error">
        <DetectChar char="{"       context="Pair" beginRegion="Region_Object" attribute="Style_Seperator_Pair" />
        <DetectChar char="["       context="Array" beginRegion="Region_Array" attribute="Style_Seperator_Array" />

        <DetectSpaces context="#stay" attribute="Style_Normal" />
      </context>

      <context name="Pair" lineEndContext="#stay" attribute="Style_Error">
        <DetectChar char="&quot;"  context="String_Key" attribute="Style_String_Key" />
        <DetectChar char=":"       context="Value" attribute="Style_Seperator_Pair" />
        <DetectChar char="}"       context="#pop" endRegion="Region_Object" attribute="Style_Seperator_Pair" />
        <DetectChar char=","       context="#stay" attribute="Style_Seperator_Pair" />

        <DetectSpaces context="#stay" attribute="Style_Normal" />
      </context>

      <context name="String_Key" lineEndContext="#stay" attribute="Style_String_Key">
        <DetectChar char="&quot;"  context="#pop" attribute="Style_String_Key" />
        <DetectChar char="\"       context="String_Key_Char" lookAhead="1"/>
      </context>

      <context name="String_Key_Char" lineEndContext="#stay" attribute="Style_Normal">
        <RegExpr String="\\(?:[&quot;\\/bfnrt]|u[0-9a-fA-f]{4})" context="#pop" attribute="Style_String_Key_Char" />
        <RegExpr String="\\(u[0-9a-fA-f]+|.)?" context="#pop" attribute="Style_Error" />
      </context>

      <context name="Value" lineEndContext="#stay" attribute="Style_Error" >
        <AnyChar String="},"       context="#pop" lookAhead="true" />
        <IncludeRules context="JsonValue"/>
      </context>

      <context name="JsonValue" lineEndContext="#stay" attribute="Style_Error" >
        <DetectChar char="&quot;"  context="String_Value" attribute="Style_String_Value" />
        <DetectChar char="{"       context="Pair" beginRegion="Region_Object" attribute="Style_Seperator_Pair" />
        <DetectChar char="["       context="Array" beginRegion="Region_Array" attribute="Style_Seperator_Array" />

        <DetectSpaces context="#stay" attribute="Style_Normal" />

        <keyword String="Constants" context="#stay" attribute="Style_Keyword" />

        <RegExpr String="-?\b((0\b|[1-9][0-9]*)\.[0-9]+(?:[eE][+-]?[0-9]+)?)" context="#stay" attribute="Style_Float" />
        <RegExpr String="-?\b(0\b|[1-9][0-9]*(?:[eE][+-]?[0-9]+)?)" context="#stay" attribute="Style_Decimal" />
      </context>

      <context name="String_Value" lineEndContext="#stay" attribute="Style_String_Value">
        <DetectChar char="&quot;"  context="#pop" attribute="Style_String_Value" />
        <DetectChar char="\"       context="String_Key_Value" lookAhead="1" />
      </context>

      <context name="String_Key_Value" lineEndContext="#stay" attribute="Style_Normal">
        <RegExpr String="\\(?:[&quot;\\/bfnrt]|u[0-9a-fA-f]{4})" context="#pop"  attribute="Style_String_Value_Char" />
        <RegExpr String="\\(u[0-9a-fA-f]+|.)?" context="#pop" attribute="Style_Error" />
      </context>

      <context name="Array" lineEndContext="#stay" attribute="Style_Error">
        <DetectChar char=","       context="#stay" attribute="Style_Seperator_Array" />
        <DetectChar char="]"       context="#pop" endRegion="Region_Array" attribute="Style_Seperator_Array" />

        <IncludeRules context="JsonValue"/>
      </context>
    </contexts>

    <itemDatas>
      <itemData name="Style_Normal"             defStyleNum="dsNormal" />

      <itemData name="Style_Seperator_Pair"     defStyleNum="dsFunction" bold="true" />
      <itemData name="Style_Seperator_Array"    defStyleNum="dsOthers" bold="true" />

      <itemData name="Style_Decimal"            defStyleNum="dsDecVal" />
      <itemData name="Style_Float"              defStyleNum="dsFloat" />
      <itemData name="Style_String_Key"         defStyleNum="dsDataType" />
      <itemData name="Style_String_Value"       defStyleNum="dsString" />
      <itemData name="Style_String_Key_Char"    defStyleNum="dsChar" />
      <itemData name="Style_String_Value_Char"  defStyleNum="dsChar" />

      <itemData name="Style_Keyword"            defStyleNum="dsKeyword" />

      <itemData name="Style_Error"              defStyleNum="dsError" />
    </itemDatas>
  </highlighting>
</language>
<!--
// kate: space-indent on; indent-width 2; replace-tabs on;
-->

