summaryrefslogtreecommitdiffstats
path: root/kate/data/diff.xml
blob: 62fdceb1e31634e5fc6e0563e451322d9bd8e657 (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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "language.dtd"
[
  <!ENTITY file  "(====|\*\*\*|\-\-\-|diff|Only in .*:).*$">
  <!ENTITY chunk "(\@\@|\d).*$">
  <!ENTITY csep  "(\+\+\+|\-\-\-).*$">
  <!ENTITY index  "Index:.*">
]>
<!--
    2006-08-02: 1.10 Matthew Woehlke <mw_triad@sourceforge.net>
      Added folding. Context diff changes are now identified as old/new (using
      seperate attributes). Recognize 'Only in' from 'diff -r' output.
      There is currently a bug (KATE limitation?) where regions may sometimes
      pick up one line too many.
    2008-02-13: 1.11 Eduardo Robles Elvira <edulix AT gmail DOT com>
     Fixed folding.
-->
<language name="Diff" version="1.13" kateversion="2.4" section="Other" extensions="*.diff;*patch" mimetype="text/x-patch">

  <highlighting>

    <contexts>

      <context attribute="Normal Text" lineEndContext="#stay" name="Normal">
        <RegExpr attribute="Header" context="Chunk" String="&chunk;" beginRegion="chunk" column="0"/>
        <RegExpr attribute="Header" context="RChunk" String="\*+$" beginRegion="chunk" column="0"/>
        <RegExpr attribute="File" context="#stay" String="Only in .*:.*$" column="0"/>
        <RegExpr attribute="File" context="RFile" String="diff.*$" beginRegion="chunk" column="0"/>
        <RegExpr attribute="File" context="#stay" String="====.*$" column="0"/>
        <RegExpr attribute="File" context="File" String="(\*\*\*|\-\-\-).*$" beginRegion="chunk" column="0"/>
        <IncludeRules context="FindDiff"/>
        <DetectChar attribute="Changed line" context="ChangedOld" char="!" column="0"/>
      </context>

      <context attribute="Normal Text" lineEndContext="#stay" name="FindDiff">
        <RegExpr attribute="File" context="#stay" String="\-\-\-.*$" column="0"/>
        <RegExpr attribute="Header" context="#stay" String="&csep;" column="0"/>
        <AnyChar attribute="Added line" context="Added" String="+&gt;" column="0"/>
        <AnyChar attribute="Removed line" context="Removed" String="-&lt;" column="0"/>
      </context>

      <!-- block contexts -->
      <context attribute="Normal Text" lineEndContext="#stay" name="File">
        <IncludeRules context="FindDiff"/>
        <RegExpr attribute="Header" context="ChunkInFile" String="&chunk;" beginRegion="chunk" column="0"/>
        <RegExpr attribute="Header" context="RChunkInFile" String="\*+$" beginRegion="chunk" column="0"/>
        <RegExpr attribute="File" context="#pop" String="&file;" endRegion="chunk" column="0"/>
        <DetectChar attribute="Changed line (old)" context="ChangedOld" char="!" column="0"/>
      </context>

      <context attribute="Normal Text" lineEndContext="#stay" name="Chunk">
        <IncludeRules context="FindDiff"/>
        <RegExpr attribute="Header" context="#pop" String="&chunk;" endRegion="chunk" lookAhead="true" column="0"/>
        <DetectChar attribute="Changed line (old)" context="ChangedOld" char="!" column="0"/>
      </context>

      <context attribute="Normal Text" lineEndContext="#stay" name="ChunkInFile">
        <IncludeRules context="FindDiff"/>
        <RegExpr attribute="Header" context="#pop" String="&chunk;" endRegion="chunk" lookAhead="true" column="0"/>
        <RegExpr attribute="Normal Text" context="#pop" String="&index;" endRegion="chunk" column="0"/>
        <RegExpr attribute="File" context="#pop" String="&file;" endRegion="chunk" lookAhead="true" column="0"/>
        <DetectChar attribute="Changed line (old)" context="ChangedOld" char="!" column="0"/>
      </context>

      <!-- block contexts (diff -r) -->
      <context attribute="Normal Text" lineEndContext="#stay" name="RFile">
        <RegExpr attribute="File" context="#pop" String="(diff|Only in .*:).*$" endRegion="chunk" lookAhead="true" column="0"/>
        <RegExpr attribute="Header" context="#stay" String="&file;" column="0"/>
        <RegExpr attribute="Header" context="RChunkInFile" String="\*+$" beginRegion="chunk" column="0"/>
        <IncludeRules context="File"/>
      </context>

      <context attribute="Normal Text" lineEndContext="#stay" name="RChunk">
        <RegExpr attribute="Header" context="#stay" String="\*\*\* .* \*\*\*\*$" column="0"/>
        <RegExpr attribute="Header" context="RChunkNew" String="\-\-\- .* \-\-\-\-$" column="0"/>
        <IncludeRules context="Chunk"/>
      </context>

      <context attribute="Normal Text" lineEndContext="#stay" name="RChunkInFile">
        <RegExpr attribute="Header" context="#stay" String="\*\*\* .* \*\*\*\*$" column="0"/>
        <RegExpr attribute="Header" context="RChunkInFileNew" String="\-\-\- .* \-\-\-\-$" column="0"/>
        <IncludeRules context="ChunkInFile"/>
      </context>

      <context attribute="Normal Text" lineEndContext="#stay" name="RChunkNew">
        <RegExpr attribute="Header" context="#pop#pop" String="&chunk;" lookAhead="true" column="0"/>
        <DetectChar attribute="Changed line (new)" context="ChangedNew" char="!" column="0"/>
        <IncludeRules context="FindDiff"/>
      </context>

      <context attribute="Normal Text" lineEndContext="#stay" name="RChunkInFileNew">
        <RegExpr attribute="Header" context="#pop#pop" String="&chunk;" lookAhead="true" column="0"/>
        <RegExpr attribute="File" context="#pop#pop" String="&file;" endRegion="chunk" lookAhead="true" column="0"/>
        <DetectChar attribute="Changed line (new)" context="ChangedNew" char="!" column="0"/>
        <IncludeRules context="FindDiff"/>
      </context>

      <!-- line contexts -->
      <context attribute="File" lineEndContext="#pop" name="File"/>
      <context attribute="Removed line" lineEndContext="#pop" name="Removed"/>
      <context attribute="Added line" lineEndContext="#pop" name="Added"/>
      <context attribute="Changed line (old)" lineEndContext="#pop" name="ChangedOld"/>
      <context attribute="Changed line (new)" lineEndContext="#pop" name="ChangedNew"/>

    </contexts>

    <itemDatas>
      <itemData name="Normal Text" defStyleNum="dsNormal"/>
      <itemData name="File"  defStyleNum="dsKeyword"/>
      <itemData name="Header"  defStyleNum="dsDataType"/>
      <itemData name="Removed line"  defStyleNum="dsString" backgroundColor="#ffeef0"/>
      <itemData name="Added line"  defStyleNum="dsOthers" backgroundColor="#e6ffed"/>
      <itemData name="Changed line (old)"  defStyleNum="dsString" color="#FF0000"/>
      <itemData name="Changed line (new)"  defStyleNum="dsOthers" color="#0000FF"/>
    </itemDatas>

  </highlighting>

</language>