| 1 |
<?xml version="1.0" encoding="UTF-8"?> |
| 2 |
<!DOCTYPE language> |
| 3 |
<language name="Varnish module spec file" version="6" kateversion="5.0" section="Sources" extensions="*.vcc" author="Xavier Guerrin ([email protected])" license="WTFPL" priority="9"> |
| 4 |
<highlighting> |
| 5 |
<!-- Extracted from the "ctypes" hash in lib/libvmod_std/vmod.py --> |
| 6 |
<list name="VCC C Types"> |
| 7 |
<item>BACKEND</item> |
| 8 |
<item>BLOB</item> |
| 9 |
<item>BOOL</item> |
| 10 |
<item>BYTES</item> |
| 11 |
<item>DURATION</item> |
| 12 |
<item>HEADER</item> |
| 13 |
<item>HTTP</item> |
| 14 |
<item>INT</item> |
| 15 |
<item>IP</item> |
| 16 |
<item>PRIV_CALL</item> |
| 17 |
<item>PRIV_VCL</item> |
| 18 |
<item>REAL</item> |
| 19 |
<item>STRING</item> |
| 20 |
<item>STRING_LIST</item> |
| 21 |
<item>TIME</item> |
| 22 |
<item>VOID</item> |
| 23 |
</list> |
| 24 |
<contexts> |
| 25 |
<!-- Default context: define main keywords. --> |
| 26 |
<context name="vccnormal_text" attribute="Normal Text" lineEndContext="#stay"> |
| 27 |
<IncludeRules context="##reStructuredText" /> |
| 28 |
<StringDetect firstNonSpace="true" attribute="Keyword" context="module_declaration" String="$Module" endRegion="vcc_block" /> |
| 29 |
<StringDetect firstNonSpace="true" attribute="Keyword" context="init_declaration" String="$Init" endRegion="vcc_block" /> |
| 30 |
<StringDetect firstNonSpace="true" attribute="Keyword" context="function_declaration" String="$Function" endRegion="vcc_block" /> |
| 31 |
<StringDetect firstNonSpace="true" attribute="Keyword" context="object_declaration" String="$Object" endRegion="vcc_block" /> |
| 32 |
<StringDetect firstNonSpace="true" attribute="Keyword" context="method_declaration" String="$Method" endRegion="vcc_block" /> |
| 33 |
<IncludeRules context="comments" /> |
| 34 |
</context> |
| 35 |
|
| 36 |
<!-- Contexts for comments. --> |
| 37 |
<context name="comments" attribute="Comment" lineEndContext="#pop"> |
| 38 |
<DetectChar char="#" context="shell-like-comment" attribute="Comment" /> |
| 39 |
</context> |
| 40 |
<context name="shell-like-comment" attribute="Comment" lineEndContext="#pop"> |
| 41 |
<DetectSpaces /> |
| 42 |
<IncludeRules context="##Comments" /> |
| 43 |
</context> |
| 44 |
|
| 45 |
<!-- Contexts for the "$Module" keyword. --> |
| 46 |
<context name="module_declaration" attribute="Normal Text" lineEndContext="#pop"> |
| 47 |
<RegExpr attribute="VMod Identifier" context="module_section_expected" String="[a-zA-Z][a-zA-Z0-9_]*" /> |
| 48 |
</context> |
| 49 |
<context name="module_section_expected" attribute="Normal Text" lineEndContext="#pop"> |
| 50 |
<Int attribute="Decimal" context="module_fullname_expected" /> |
| 51 |
</context> |
| 52 |
<context name="module_fullname_expected" attribute="String" lineEndContext="#pop"> |
| 53 |
</context> |
| 54 |
|
| 55 |
<!-- Contexts for the "$Init" keyword. --> |
| 56 |
<context name="init_declaration" attribute="Normal Text" lineEndContext="#pop"> |
| 57 |
<RegExpr attribute="Function Identifier" context="#stay" String="[a-zA-Z][a-zA-Z0-9_]*$" /> |
| 58 |
</context> |
| 59 |
|
| 60 |
<!-- Contexts for the "$Function" keyword. --> |
| 61 |
<context name="function_declaration" attribute="Normal Text" lineEndContext="#pop"> |
| 62 |
<keyword attribute="Data Type" String="VCC C Types" context="return_type_declared" /> |
| 63 |
</context> |
| 64 |
<context name="return_type_declared" attribute="Normal Text" lineEndContext="#pop"> |
| 65 |
<RegExpr attribute="Function Identifier" context="function_name_declared" String="[a-zA-Z][a-zA-Z0-9_]*" /> |
| 66 |
</context> |
| 67 |
<context name="function_name_declared" attribute="Normal Text" lineEndContext="#pop"> |
| 68 |
<DetectChar char="(" context="function_arg_type_expected" attribute="Normal Text" /> |
| 69 |
</context> |
| 70 |
<context name="function_arg_type_expected" attribute="Normal Text" lineEndContext="#pop"> |
| 71 |
<keyword attribute="Data Type" String="VCC C Types" context="function_comma_expected" /> |
| 72 |
<StringDetect String="ENUM" context="enum" attribute="Data Type" /> |
| 73 |
<DetectChar char=")" context="function_end" attribute="Normal Text" beginRegion="vcc_block" /> |
| 74 |
</context> |
| 75 |
<context name="function_comma_expected" attribute="Normal Text" lineEndContext="#pop"> |
| 76 |
<DetectChar char="," context="function_arg_type_expected" attribute="Normal Text" /> |
| 77 |
<DetectChar char=")" context="function_end" attribute="Normal Text" beginRegion="vcc_block" /> |
| 78 |
</context> |
| 79 |
<context name="function_end" attribute="Normal Text" lineEndContext="#pop"> |
| 80 |
</context> |
| 81 |
|
| 82 |
<!-- Contexts for the "$Object" keyword. --> |
| 83 |
<context name="object_declaration" attribute="Normal Text" lineEndContext="#pop"> |
| 84 |
<!-- Parse $Object as a $Function which does not need to state a return type --> |
| 85 |
<IncludeRules context="return_type_declared" /> |
| 86 |
</context> |
| 87 |
|
| 88 |
<!-- Contexts for the "$Method" keyword. --> |
| 89 |
<context name="method_declaration" attribute="Normal Text" lineEndContext="#pop"> |
| 90 |
<keyword attribute="Data Type" String="VCC C Types" context="method_return_type_declared" /> |
| 91 |
</context> |
| 92 |
<context name="method_return_type_declared" attribute="Normal Text" lineEndContext="#pop"> |
| 93 |
<RegExpr attribute="Function Identifier" context="function_name_declared" String="\.[a-zA-Z][a-zA-Z0-9_]*" /> |
| 94 |
</context> |
| 95 |
|
| 96 |
<!-- Contexts for enums. --> |
| 97 |
<context name="enum" attribute="Normal Text" lineEndContext="#pop"> |
| 98 |
<DetectChar char="{" context="enum_c_name_expected" attribute="Normal Text" /> |
| 99 |
</context> |
| 100 |
<context name="enum_c_name_expected" attribute="Normal Text" lineEndContext="#pop"> |
| 101 |
<RegExpr attribute="Symbol" context="enum_comma_expected" String="[a-z][a-z0-9_]*" /> |
| 102 |
<DetectChar char="}" context="function_comma_expected" attribute="Normal Text" /> |
| 103 |
</context> |
| 104 |
<context name="enum_comma_expected" attribute="Normal Text" lineEndContext="#pop"> |
| 105 |
<DetectChar char="," context="enum_c_name_expected" attribute="Normal Text" /> |
| 106 |
<DetectChar char="}" context="function_comma_expected" attribute="Normal Text" /> |
| 107 |
</context> |
| 108 |
</contexts> |
| 109 |
<itemDatas> |
| 110 |
<itemData name="Normal Text" defStyleNum="dsNormal" /> |
| 111 |
<itemData name="Data Type" defStyleNum="dsDataType" spellChecking="false"/> |
| 112 |
<itemData name="Decimal" defStyleNum="dsDecVal" spellChecking="false"/> |
| 113 |
<itemData name="String" defStyleNum="dsString"/> |
| 114 |
<itemData name="VMod Identifier" defStyleNum="dsAttribute" /> <!-- #0000FF --> |
| 115 |
<itemData name="Function Identifier" defStyleNum="dsFunction" /> |
| 116 |
<itemData name="Comment" defStyleNum="dsComment" /> |
| 117 |
<itemData name="Symbol" defStyleNum="dsNormal" spellChecking="false"/> |
| 118 |
<itemData name="Keyword" defStyleNum="dsKeyword" /> |
| 119 |
</itemDatas> |
| 120 |
</highlighting> |
| 121 |
<general> |
| 122 |
<comments> |
| 123 |
<comment name="singleLine" start="#" /> |
| 124 |
</comments> |
| 125 |
<keywords casesensitive="1" /> |
| 126 |
</general> |
| 127 |
</language> |
| 128 |
<!-- kate: space-indent on; indent-width 2; replace-tabs on; --> |