Debian Codegraph @

data/syntax/textproto.xml

raw
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE language>
3 <!--
4 ***************************************************************************
5 ** Text Format Language Specification:
6 ** https://protobuf.dev/reference/protobuf/textformat-spec/
7 **
8 ** Samples: https://github.com/protocolbuffers/protobuf/tree/main/src/google/protobuf/testdata
9 ***************************************************************************
10 -->
11 <language name="TextProto" section="Other" version="2" kateversion="5.62" extensions="*.textproto;*.textpb;*.pbtxt"
12 author="Alexander Potashev ([email protected])" license="MIT">
13 <highlighting>
14 <list name="Constants">
15 <item>t</item>
16 <item>true</item>
17 <item>True</item>
18 <item>f</item>
19 <item>false</item>
20 <item>False</item>
21 </list>
22
23 <contexts>
24 <context name="Normal" lineEndContext="#stay" fallthroughContext="Message" attribute="Style_Normal"/>
25
26 <context name="Message" lineEndContext="#stay" attribute="Style_Normal">
27 <DetectSpaces context="#stay" attribute="Style_Normal"/>
28 <DetectChar char="#" context="Comment" attribute="Style_Comment"/>
29 <DetectChar char="," context="#stay" attribute="Style_Separator_Pair"/>
30
31 <DetectIdentifier context="Field_Key" attribute="Style_Key"/>
32
33 <!-- Proto extension -->
34 <DetectChar char="[" context="Extension_Key" attribute="Style_Normal" lookAhead="true"/>
35
36 <AnyChar String="}&gt;" context="#pop" lookAhead="true"/>
37 </context>
38
39 <context name="Extension_Key" lineEndContext="#stay" attribute="Style_Error">
40 <DetectSpaces context="#stay" attribute="Style_Normal"/>
41 <RegExpr String="\[([a-zA-Z0-9\.\-]+/)?[a-zA-Z0-9\._]+\]" context="#pop!Field_Key"
42 attribute="Style_Extension_Type"/>
43 </context>
44
45 <context name="Field_Key" lineEndContext="#stay" attribute="Style_Normal">
46 <DetectSpaces context="#stay" attribute="Style_Normal"/>
47
48 <DetectChar char=":" context="#pop!Value" attribute="Style_Separator_Pair"/>
49 <AnyChar String="{&lt;" context="#pop!Value" attribute="Style_Normal" lookAhead="true"/>
50 </context>
51
52 <context name="Value" lineEndContext="#stay" attribute="Style_Normal">
53 <DetectSpaces context="#stay" attribute="Style_Normal"/>
54 <DetectChar char="#" context="Comment" attribute="Style_Comment"/>
55
56 <keyword String="Constants" context="#pop" attribute="Style_Keyword"/>
57 <DetectIdentifier context="#pop" attribute="Style_Identifier_Value"/>
58 <RegExpr String="[\-\.0-9]" context="#pop!ScalarValue" lookAhead="true"/>
59 <DetectChar char="&quot;" context="#pop!String_Value" attribute="Style_String_Value"/>
60 <DetectChar char="&lt;" context="#pop!PairAngle" beginRegion="Region_Message_Angle"
61 attribute="Style_Separator_Pair"/>
62 <DetectChar char="{" context="#pop!PairBrace" beginRegion="Region_Message_Brace"
63 attribute="Style_Separator_Pair"/>
64 <DetectChar char="[" context="#pop!Array" beginRegion="Region_Array" attribute="Style_Separator_Array"/>
65
66 <DetectChar char="," context="#pop" lookAhead="true"/>
67 </context>
68
69 <context name="ScalarValue" lineEndContext="#stay" attribute="Style_Decimal">
70 <RegExpr String="-?[0-9]*\.?[0-9]*([eE]?[-+]?[0-9]+)?" context="#pop" attribute="Style_Decimal"
71 insensitive="false" minimal="false"/>
72 </context>
73
74 <!-- Messages formatted as < ... > -->
75 <context name="PairAngle" lineEndContext="#stay" fallthroughContext="Message" attribute="Style_Normal">
76 <DetectChar char="&gt;" context="#pop" endRegion="Region_Message_Angle" attribute="Style_Separator_Pair"/>
77 </context>
78
79 <!-- Messages formatted as { ... } -->
80 <context name="PairBrace" lineEndContext="#stay" fallthroughContext="Message" attribute="Style_Normal">
81 <DetectChar char="}" context="#pop" endRegion="Region_Message_Brace" attribute="Style_Separator_Pair"/>
82 </context>
83
84 <context name="String_Value" lineEndContext="#stay" attribute="Style_String_Value">
85 <DetectChar char="&quot;" context="#pop!String_Value_End" attribute="Style_String_Value"/>
86 <HlCStringChar attribute="Style_String_Value_Char" context="#stay"/>
87 </context>
88
89 <!-- One string has ended, but there may be a continuation in another pair of quotes -->
90 <context name="String_Value_End" lineEndContext="#stay" fallthroughContext="#pop" attribute="Style_Normal">
91 <DetectSpaces context="#stay" attribute="Style_Normal"/>
92 <DetectChar char="#" context="Comment" attribute="Style_Comment"/>
93 <DetectChar char="&quot;" context="#pop!String_Value" attribute="Style_String_Value"/>
94 </context>
95
96 <context name="Array" lineEndContext="#stay" fallthroughContext="Value" attribute="Style_Normal">
97 <DetectSpaces context="#stay" attribute="Style_Normal"/>
98 <DetectChar char="#" context="Comment" attribute="Style_Comment"/>
99 <DetectChar char="," context="#stay" attribute="Style_Separator_Array"/>
100 <DetectChar char="]" context="#pop" endRegion="Region_Array" attribute="Style_Separator_Array"/>
101 </context>
102
103 <context name="Comment" lineEndContext="#pop" attribute="Style_Comment">
104 <IncludeRules context="##Comments" />
105 </context>
106 </contexts>
107
108 <itemDatas>
109 <itemData name="Style_Normal" defStyleNum="dsNormal"/>
110
111 <itemData name="Style_Separator_Pair" defStyleNum="dsFunction" bold="true"/>
112 <itemData name="Style_Separator_Array" defStyleNum="dsOthers" bold="true"/>
113
114 <itemData name="Style_Decimal" defStyleNum="dsDecVal"/>
115 <itemData name="Style_Key" defStyleNum="dsVariable"/>
116
117 <!-- e.g. enum values -->
118 <itemData name="Style_Identifier_Value" defStyleNum="dsConstant"/>
119
120 <itemData name="Style_String_Value" defStyleNum="dsString"/>
121 <itemData name="Style_String_Value_Char" defStyleNum="dsChar"/>
122
123 <itemData name="Style_Keyword" defStyleNum="dsKeyword"/>
124 <itemData name="Style_Extension_Type" defStyleNum="dsDataType"/>
125
126 <itemData name="Style_Comment" defStyleNum="dsComment" />
127
128 <itemData name="Style_Error" defStyleNum="dsError"/>
129 </itemDatas>
130 </highlighting>
131 </language>