summaryrefslogtreecommitdiffstats
path: root/kate/data/json.xml
blob: 4121dbe52014fd258c9b3347ac6f0b2323d65ee1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "language.dtd">
<!--
 ***************************************************************************
 ** 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
 ***************************************************************************
-->
<language name="JSON" section="Markup" version="3" kateversion="2.4" extensions="*.json;.kateproject;.arcconfig;*.gltf" 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" />
        <RegExpr String="\\(?:[&quot;\\/bfnrt]|u[0-9a-fA-f]{4})" context="#stay" insensitive="false" minimal="false" attribute="Style_String_Key_Char" />
      </context>

      <context name="Value" 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" />
        <DetectChar char="}"       context="#pop" lookAhead="true" />
        <DetectChar char=","       context="#pop" lookAhead="true" />

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

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

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

      <context name="String_Value" lineEndContext="#stay" attribute="Style_String_Value">
        <DetectChar char="&quot;"  context="#pop" attribute="Style_String_Value" />
        <RegExpr String="\\(?:[&quot;\\/bfnrt]|u[0-9a-fA-f]{4})" context="#stay" insensitive="false" minimal="false" attribute="Style_String_Value_Char" />
      </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" />

        <DetectChar char="{"       context="Pair" beginRegion="Region_Object" attribute="Style_Seperator_Pair" />
        <DetectChar char="["       context="Array" beginRegion="Region_Array" attribute="Style_Seperator_Array" />
        <DetectChar char="&quot;"  context="String_Value" attribute="Style_String_Value" />

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

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

        <RegExpr String="-?(?:[0-9]|[1-9][0-9]+)\.[0-9]+(?:[eE][+-]?[0-9]+)?" context="#stay" insensitive="false" minimal="false" attribute="Style_Float" />
        <RegExpr String="-?(?:[0-9]|[1-9][0-9]+)(?:[eE][+-]?[0-9]+)?" context="#stay" insensitive="false" minimal="false" attribute="Style_Decimal" />
      </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>