Finch/editors/kate/finch.xml
Claude 1f45bd8a01
docs (en, pl) and editors: masks, tails, shuffles, lookup, dot_add, @cpu, cpu_has, Nix
- technicians' guides: section 31 rewritten around kernels (masks, the end of a list, moving lanes,
  int8 dot products, choosing instructions at build and at run time)
- cheat sheets and engineers' guides: the new operations and their IR; how features are found
- Kate and VS Code: @cpu, boolxN and the new built-ins highlighted

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Psc42moPLwP43Cmb9oZqSR
2026-11-01 15:46:04 +00:00

227 lines
9.3 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language>
<!--
Finch syntax highlighting for Kate, KWrite and KDevelop (KSyntaxHighlighting).
Install: copy to ~/.local/share/org.kde.syntax-highlighting/syntax/finch.xml
(or run editors/kate/install.sh), then restart Kate.
-->
<language name="Finch" version="5" kateversion="5.0" section="Sources" extensions="*.fch"
mimetype="text/x-finch" indenter="cstyle" author="The Finch authors" license="Apache-2.0">
<highlighting>
<list name="keywords">
<item>fn</item>
<item>struct</item>
<item>enum</item>
<item>export</item>
<item>const</item>
</list>
<list name="control">
<item>if</item>
<item>else</item>
<item>while</item>
<item>for</item>
<item>in</item>
<item>break</item>
<item>continue</item>
<item>return</item>
<item>defer</item>
<item>or</item>
<item>try</item>
<item>match</item>
</list>
<list name="imports">
<item>import</item>
<item>link</item>
</list>
<list name="constants">
<item>true</item>
<item>false</item>
<item>null</item>
<item>self</item>
</list>
<list name="types">
<item>int</item>
<item>float</item>
<item>bool</item>
<item>char</item>
<item>str</item>
<item>ptr</item>
<item>map</item>
<item>i8</item>
<item>i16</item>
<item>i32</item>
<item>i64</item>
<item>u8</item>
<item>u16</item>
<item>u32</item>
<item>u64</item>
<item>f32</item>
<item>f64</item>
</list>
<list name="builtins">
<item>print</item>
<item>input</item>
<item>read_file</item>
<item>write_file</item>
<item>file_exists</item>
<item>delete_file</item>
<item>shell</item>
<item>exit</item>
<item>addr</item>
<item>new</item>
<item>free</item>
<item>error</item>
<item>min</item>
<item>max</item>
<item>abs</item>
<item>clamp</item>
<item>assert</item>
<item>atomic_add</item>
<item>atomic_sub</item>
<item>atomic_load</item>
<item>atomic_store</item>
<item>atomic_swap</item>
<item>atomic_cas</item>
<item>select</item>
<item>concat</item>
<item>fma</item>
<item>muladd</item>
<item>cpu_has</item>
<item>f32_bits</item>
<item>f32_from_bits</item>
<item>f64_bits</item>
<item>f64_from_bits</item>
<item>f16_to_f32</item>
<item>f32_to_f16</item>
<item>bf16_to_f32</item>
<item>f32_to_bf16</item>
</list>
<contexts>
<context name="Normal" attribute="Normal Text" lineEndContext="#stay">
<DetectSpaces/>
<Detect2Chars char="/" char1="/" attribute="Comment" context="LineComment"/>
<Detect2Chars char="/" char1="*" attribute="Comment" context="BlockComment" beginRegion="Comment"/>
<DetectChar char="{" attribute="Symbol" beginRegion="Brace"/>
<DetectChar char="}" attribute="Symbol" endRegion="Brace"/>
<StringDetect String="&quot;&quot;&quot;" attribute="String" context="LongString" beginRegion="LongString"/>
<DetectChar char="&quot;" attribute="String" context="String"/>
<DetectChar char="'" attribute="Char" context="Char"/>
<WordDetect String="fn" attribute="Keyword" context="FunctionName"/>
<RegExpr String="\btest(?=\s*&quot;)" attribute="Keyword"/>
<RegExpr String="(?&lt;=\s)as(?=\s+[A-Za-z_])" attribute="Import"/>
<WordDetect String="struct" attribute="Keyword" context="StructName"/>
<keyword String="control" attribute="Control Flow"/>
<keyword String="imports" attribute="Import"/>
<keyword String="constants" attribute="Constant"/>
<keyword String="types" attribute="Data Type"/>
<!-- vectors: f32x8, i8x32, u16x16, f64x4 ... -->
<RegExpr String="\b([iuf](8|16|32|64)|bool)x(2|4|8|16|32|64)\b" attribute="Data Type"/>
<RegExpr String="@cpu\b" attribute="Keyword"/>
<keyword String="builtins" attribute="Built-in"/>
<RegExpr String="\b0[xX][0-9a-fA-F_]+\b" attribute="Hex"/>
<RegExpr String="\b[0-9][0-9_]*(\.[0-9][0-9_]*)?[eE][+-]?[0-9]+\b" attribute="Float"/>
<RegExpr String="\b[0-9][0-9_]*\.[0-9][0-9_]*\b" attribute="Float"/>
<RegExpr String="\b[0-9][0-9_]*\b" attribute="Decimal"/>
<!-- a call: name( ; method or field after a dot -->
<RegExpr String="\b[A-Za-z_][A-Za-z0-9_]*(?=\s*\()" attribute="Function"/>
<!-- struct names are written with a capital letter by convention -->
<RegExpr String="\b[A-Z][A-Za-z0-9_]*\b" attribute="Data Type"/>
<DetectIdentifier/>
<Detect2Chars char=":" char1="=" attribute="Operator"/>
<Detect2Chars char="-" char1="&gt;" attribute="Operator"/>
<Detect2Chars char="." char1="." attribute="Operator"/>
<AnyChar String="+-*/%=&lt;&gt;!&amp;|^~" attribute="Operator"/>
<AnyChar String="()[],.:" attribute="Symbol"/>
</context>
<!-- fn name( or fn Type.method( -->
<context name="FunctionName" attribute="Normal Text" lineEndContext="#pop" fallthroughContext="#pop">
<DetectSpaces/>
<RegExpr String="[A-Za-z_][A-Za-z0-9_]*(?=\.)" attribute="Data Type"/>
<DetectChar char="." attribute="Symbol"/>
<RegExpr String="[A-Za-z_][A-Za-z0-9_]*" attribute="Function Definition" context="#pop"/>
</context>
<context name="StructName" attribute="Normal Text" lineEndContext="#pop" fallthroughContext="#pop">
<DetectSpaces/>
<RegExpr String="[A-Za-z_][A-Za-z0-9_]*" attribute="Data Type" context="#pop"/>
</context>
<context name="LineComment" attribute="Comment" lineEndContext="#pop">
<DetectSpaces/>
<IncludeRules context="##Comments"/>
</context>
<context name="BlockComment" attribute="Comment" lineEndContext="#stay">
<Detect2Chars char="*" char1="/" attribute="Comment" context="#pop" endRegion="Comment"/>
<IncludeRules context="##Comments"/>
</context>
<context name="String" attribute="String" lineEndContext="#pop">
<RegExpr String="\\\(" attribute="Escape" context="Interpolation"/>
<RegExpr String="\\[ntr0\\&quot;']" attribute="Escape"/>
<RegExpr String="\\." attribute="Error"/>
<DetectChar char="&quot;" attribute="String" context="#pop"/>
</context>
<context name="LongString" attribute="String" lineEndContext="#stay">
<RegExpr String="\\\(" attribute="Escape" context="Interpolation"/>
<RegExpr String="\\[ntr0\\&quot;']" attribute="Escape"/>
<StringDetect String="&quot;&quot;&quot;" attribute="String" context="#pop" endRegion="LongString"/>
</context>
<!-- "hp \(hp + 1)": code inside text, up to the ) that closes \( -->
<context name="Interpolation" attribute="Normal Text" lineEndContext="#stay">
<DetectChar char=")" attribute="Escape" context="#pop"/>
<DetectChar char="(" attribute="Symbol" context="InterpolationParen"/>
<IncludeRules context="Normal"/>
</context>
<context name="InterpolationParen" attribute="Normal Text" lineEndContext="#stay">
<DetectChar char=")" attribute="Symbol" context="#pop"/>
<DetectChar char="(" attribute="Symbol" context="InterpolationParen"/>
<IncludeRules context="Normal"/>
</context>
<context name="Char" attribute="Char" lineEndContext="#pop">
<RegExpr String="\\[ntr0\\&quot;']" attribute="Escape"/>
<DetectChar char="'" attribute="Char" context="#pop"/>
</context>
</contexts>
<itemDatas>
<itemData name="Normal Text" defStyleNum="dsNormal" spellChecking="false"/>
<itemData name="Keyword" defStyleNum="dsKeyword" spellChecking="false"/>
<itemData name="Control Flow" defStyleNum="dsControlFlow" spellChecking="false"/>
<itemData name="Import" defStyleNum="dsImport" spellChecking="false"/>
<itemData name="Constant" defStyleNum="dsConstant" spellChecking="false"/>
<itemData name="Data Type" defStyleNum="dsDataType" spellChecking="false"/>
<itemData name="Built-in" defStyleNum="dsBuiltIn" spellChecking="false"/>
<itemData name="Function" defStyleNum="dsFunction" spellChecking="false"/>
<itemData name="Function Definition" defStyleNum="dsFunction" bold="true" spellChecking="false"/>
<itemData name="Decimal" defStyleNum="dsDecVal" spellChecking="false"/>
<itemData name="Hex" defStyleNum="dsBaseN" spellChecking="false"/>
<itemData name="Float" defStyleNum="dsFloat" spellChecking="false"/>
<itemData name="String" defStyleNum="dsString"/>
<itemData name="Char" defStyleNum="dsChar" spellChecking="false"/>
<itemData name="Escape" defStyleNum="dsSpecialChar" spellChecking="false"/>
<itemData name="Operator" defStyleNum="dsOperator" spellChecking="false"/>
<itemData name="Symbol" defStyleNum="dsNormal" spellChecking="false"/>
<itemData name="Comment" defStyleNum="dsComment"/>
<itemData name="Error" defStyleNum="dsError" spellChecking="false"/>
</itemDatas>
</highlighting>
<general>
<comments>
<comment name="singleLine" start="//"/>
<comment name="multiLine" start="/*" end="*/" region="Comment"/>
</comments>
<keywords casesensitive="1"/>
<folding indentationsensitive="0"/>
</general>
</language>