| 1 |
<?xml version="1.0" encoding="UTF-8"?> |
| 2 |
<!DOCTYPE language |
| 3 |
[ |
| 4 |
<!-- In EBNF: Identifier ::= [a-zA-Z] [a-zA-Z0-9_-]*--> |
| 5 |
<!ENTITY identifier "[a-zA-Z0-9_-]"> |
| 6 |
<!ENTITY number "-?\d+(?:\.\d+)?"> |
| 7 |
<!ENTITY variant_key "\[(?:&identifier;+|(?:&number;))\]"> |
| 8 |
<!ENTITY hex "[0-9a-fA-F]"> |
| 9 |
]> |
| 10 |
<language name="Fluent" version="1" kateversion="5.0" section="Markup" extensions="*.ftl" mimetype="text/x-fluent-translation" author="Fabian Wunsch ([email protected])" license="MIT" priority="-1"> |
| 11 |
<highlighting> |
| 12 |
<contexts> |
| 13 |
<context name="Normal" attribute="Normal Text" lineEndContext="#stay"> |
| 14 |
<StringDetect String="###" context="FileComment" column="0"/> |
| 15 |
<Detect2Chars char="#" char1="#" context="StandaloneComment" column="0"/> |
| 16 |
<DetectChar char="#" context="MessageComment" column="0"/> |
| 17 |
<RegExpr String="^(&identifier;+)" context="Identifier" column="0"/> |
| 18 |
<DetectSpaces/> |
| 19 |
</context> |
| 20 |
|
| 21 |
<context name="Identifier" attribute="Identifier" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop!Error"> |
| 22 |
<RegExpr String="\s*=\s*" context="MultiLineText" attribute="Normal Text"/> |
| 23 |
</context> |
| 24 |
|
| 25 |
<context name="AttributeIdentifier" attribute="Identifier" lineEndContext="#pop"> |
| 26 |
<RegExpr String="\s*=\s*" context="#pop#pop!MultiLineText" attribute="Normal Text"/> |
| 27 |
<DetectChar char=" " context="#pop#pop!Error"/> |
| 28 |
</context> |
| 29 |
|
| 30 |
<context name="Error" attribute="Error" lineEndContext="#pop"> |
| 31 |
</context> |
| 32 |
|
| 33 |
<context name="MessageComment" attribute="Comment" lineEndContext="#pop"> |
| 34 |
<IncludeRules context="##Comments"/> |
| 35 |
</context> |
| 36 |
|
| 37 |
<context name="StandaloneComment" attribute="DocumentationComment" lineEndContext="#pop"> |
| 38 |
<IncludeRules context="MessageComment"/> |
| 39 |
</context> |
| 40 |
|
| 41 |
<context name="FileComment" attribute="DocumentationComment" lineEndContext="#pop"> |
| 42 |
<IncludeRules context="MessageComment"/> |
| 43 |
</context> |
| 44 |
|
| 45 |
<context name="SingleLineText" attribute="Text" lineEndContext="#pop"> |
| 46 |
<DetectIdentifier/> |
| 47 |
<DetectChar char="{" context="Placeable"/> |
| 48 |
</context> |
| 49 |
|
| 50 |
<context name="MultiLineText" attribute="Text" lineEndContext="#stay"> |
| 51 |
<DetectSpaces/> |
| 52 |
<RegExpr String="^[^ ]" context="#pop#pop" column="0" lookAhead="true"/> |
| 53 |
<RegExpr String="(?<=[ ])(?:\.&identifier;)" context="AttributeIdentifier" lookAhead="true"/> |
| 54 |
<IncludeRules context="SingleLineText"/> |
| 55 |
</context> |
| 56 |
|
| 57 |
<context name="Expression" lineEndContext="#pop" attribute="Normal Text"> |
| 58 |
<DetectChar char=""" context="Quoted"/> |
| 59 |
<RegExpr String="&number;" attribute="Number"/> |
| 60 |
<RegExpr String="(?:&identifier;+\s*\()" context="Function"/> |
| 61 |
<RegExpr String="(?:\$&identifier;+)" attribute="Variable"/> |
| 62 |
<RegExpr String="(?:&identifier;+(?:\.&identifier;+)?)"/> |
| 63 |
<DetectChar char="{" context="Placeable"/> |
| 64 |
</context> |
| 65 |
|
| 66 |
<context name="Placeable" attribute="Placeable" lineEndContext="#stay" fallthrough="true" fallthroughContext="#pop!Error"> |
| 67 |
<DetectSpaces/> |
| 68 |
<DetectChar char="}" context="#pop" attribute="Placeable"/> |
| 69 |
<RegExpr String="(?:\*&variant_key;)" context="SingleLineText" attribute="DefaultIdentifier"/> |
| 70 |
<RegExpr String="(?:&variant_key;)" context="SingleLineText" attribute="Identifier"/> |
| 71 |
<Detect2Chars char="-" char1=">"/> |
| 72 |
<IncludeRules context="Expression"/> |
| 73 |
</context> |
| 74 |
|
| 75 |
<context name="Function" attribute="Function" lineEndContext="#pop!Error" fallthrough="true" fallthroughContext="#pop!Error"> |
| 76 |
<DetectSpaces/> |
| 77 |
<DetectChar char=")" context="#pop" attribute="Function"/> |
| 78 |
<RegExpr String="(?:&identifier;+\s*:\s*)"/> |
| 79 |
<DetectChar char=","/> |
| 80 |
<IncludeRules context="Expression"/> |
| 81 |
</context> |
| 82 |
|
| 83 |
<context name="Quoted" attribute="Quoted" lineEndContext="#pop!Error"> |
| 84 |
<DetectIdentifier/> |
| 85 |
<RegExpr String="\\(?:"|\\|u&hex;{4}|U&hex;{6})"/> |
| 86 |
<DetectChar char="\" context="#pop!Error"/> |
| 87 |
<DetectChar char=""" context="#pop" attribute="Quoted"/> |
| 88 |
</context> |
| 89 |
</contexts> |
| 90 |
|
| 91 |
<itemDatas> |
| 92 |
<itemData name="Normal Text" defStyleNum="dsNormal" spellChecking="false"/> |
| 93 |
<itemData name="Error" defStyleNum="dsError" spellChecking="false"/> |
| 94 |
<itemData name="Identifier" defStyleNum="dsKeyword" spellChecking="false"/> |
| 95 |
<itemData name="DefaultIdentifier" defStyleNum="dsKeyword" spellChecking="false"/> |
| 96 |
<itemData name="Text" defStyleNum="dsString" spellChecking="true"/> |
| 97 |
<itemData name="Function" defStyleNum="dsFunction" spellChecking="false"/> |
| 98 |
<itemData name="Placeable" defStyleNum="dsSpecialChar" spellChecking="false"/> |
| 99 |
<itemData name="Comment" defStyleNum="dsComment" spellChecking="true"/> |
| 100 |
<itemData name="DocumentationComment" defStyleNum="dsDocumentation" spellChecking="true"/> |
| 101 |
<itemData name="Quoted" defStyleNum="dsString" spellChecking="true"/> |
| 102 |
<itemData name="Variable" defStyleNum="dsVariable" spellChecking="false"/> |
| 103 |
<itemData name="Number" defStyleNum="dsDecVal" spellChecking="false"/> |
| 104 |
</itemDatas> |
| 105 |
</highlighting> |
| 106 |
<general> |
| 107 |
<comments> |
| 108 |
<comment name="singleLine" start="#"/> |
| 109 |
</comments> |
| 110 |
<folding indentationsensitive="true"/> |
| 111 |
</general> |
| 112 |
</language> |
| 113 |
<!-- kate: replace-tabs on; tab-width 2; indent-width 2; --> |