docs, Kate and VS Code: const, if as a value, """ text, 1e9, str(x, 2), min/max/abs/clamp, import a/b and as, fs, C unions and macros

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016GzNP6r8dg6WDxUVZy8wjL
This commit is contained in:
Nexoniarz 2026-10-29 09:40:06 +01:00
commit 17863ecf7b
8 changed files with 163 additions and 35 deletions

View file

@ -5,7 +5,7 @@
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="2" kateversion="5.0" section="Sources" extensions="*.fch"
<language name="Finch" version="3" 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">
@ -13,6 +13,7 @@
<item>struct</item>
<item>enum</item>
<item>export</item>
<item>const</item>
</list>
<list name="control">
<item>if</item>
@ -79,6 +80,7 @@
<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"/>
@ -91,7 +93,8 @@
<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_]*)?[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 -->
@ -136,6 +139,11 @@
<DetectChar char="&quot;" attribute="String" context="#pop"/>
</context>
<context name="LongString" attribute="String" lineEndContext="#stay">
<RegExpr String="\\[ntr0\\&quot;']" attribute="Escape"/>
<StringDetect String="&quot;&quot;&quot;" attribute="String" context="#pop" endRegion="LongString"/>
</context>
<context name="Char" attribute="Char" lineEndContext="#pop">
<RegExpr String="\\[ntr0\\&quot;']" attribute="Escape"/>
<DetectChar char="'" attribute="Char" context="#pop"/>

View file

@ -106,6 +106,9 @@
{
"include": "#comments"
},
{
"include": "#longstrings"
},
{
"include": "#strings"
},
@ -125,7 +128,7 @@
},
{
"name": "storage.type.struct.finch",
"match": "\\b(struct|enum)\\b"
"match": "\\b(struct|enum|const)\\b"
},
{
"name": "storage.modifier.finch",
@ -243,13 +246,24 @@
},
{
"name": "constant.numeric.float.finch",
"match": "\\b\\d[\\d_]*\\.\\d[\\d_]*\\b"
"match": "\\b\\d[\\d_]*(\\.\\d[\\d_]*([eE][+-]?\\d+)?|[eE][+-]?\\d+)\\b"
},
{
"name": "constant.numeric.integer.finch",
"match": "\\b\\d[\\d_]*\\b"
}
]
},
"longstrings": {
"name": "string.quoted.triple.finch",
"begin": "\"\"\"",
"end": "\"\"\"",
"patterns": [
{
"name": "constant.character.escape.finch",
"match": "\\\\[ntr0\\\\\"']"
}
]
}
}
}