updated Kate syntax file to fix string match problem

This commit is contained in:
Irmen de Jong
2026-03-14 18:21:41 +01:00
parent 5c9c6bd023
commit 276121bfb3
4 changed files with 26 additions and 61 deletions
+5
View File
@@ -18,6 +18,11 @@ Context and instructions for AI Agents to work on this project.
- Dependent library versions can be found in 'build.gradle.kts' and in the IntelliJ IDEA configuration files in .idea/libraries
- The compiler main entrypoint is in the "compiler" module, in src/prog8/CompilerMain.kt
## CRITICAL: NO FORMATTING
- NEVER run formatters (black, ruff, prettier, etc.) after edits
- Preserve my exact indentation, line lengths, and spacing
- Make ONLY the requested changes, nothing else
## Prog8 language feature hints
### General & Setup
@@ -27,10 +27,8 @@ NOTE: status flags are only affected by the CMP instruction or explicit CLC/SEC,
Instruction set is mostly a load/store architecture, there are few instructions operating on memory directly.
Value types: integers (.b=byte=8 bits, .w=word=16 bits) and float (.f=64 bits). Omitting it defaults to b if the instruction requires a type.
Currently ther is NO support for 24 or 32 bits integers.
There is no distinction between signed and unsigned integers.
Instead, a different instruction is used if a distinction should be made (for example div and divs).
Value types: integers (.b=byte=8 bits, .w=word=16 bits, .l=long=32 bits) and float (.f=64 bits). Omitting it defaults to b if the instruction requires a type.
There is no distinction between signed and unsigned. Instead, a different instruction is used if a distinction should be made (for example div and divs).
Floating point operations are just 'f' typed regular instructions, however there are a few unique fp conversion instructions.
NOTE: Labels in source text should always start with an underscore.
+18 -13
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language>
<language name="Prog8" version="1.0" kateversion="5.62" section="Scripts" extensions="*.p8;*.prog8" mimetype="application/x-prog8;text" author="Irmen de Jong" license="MIT">
<language name="Prog8" version="12.2" kateversion="5.62" section="Scripts" extensions="*.p8;*.prog8" mimetype="application/x-prog8;text" author="Irmen de Jong" license="MIT">
<highlighting>
<list name="keywords">
<item>alias</item>
@@ -180,7 +180,7 @@
<keyword String="builtinfuncs" attribute="Builtin Function"/>
<keyword String="operators" attribute="Operator"/>
<IncludeRules context="Numbers"/>
<IncludeRules context="Strings"/>
<IncludeRules context="FindStrings"/>
<DetectChar char="@" attribute="Attribute"/>
<DetectChar char="%" attribute="Directive"/>
<DetectChar char="(" attribute="Normal Text"/>
@@ -207,24 +207,28 @@
<RegExpr String="\b[0-9][0-9_]*\.[0-9]+([eE][+-]?[0-9]+)?\b" attribute="Float"/>
<RegExpr String="\b[0-9][0-9_]*\b" attribute="Number"/>
</context>
<context name="Strings" attribute="String" lineEndContext="#stay">
<RegExpr String="(atascii|c64os|cp437|default|iso16|iso5|iso|kata|petscii|sc):" attribute="String"/>
<context name="FindStrings" attribute="Normal Text" lineEndContext="#stay">
<DetectChar char="&quot;" attribute="String" context="String"/>
<DetectChar char="'" attribute="String" context="StringSQ"/>
</context>
<context name="String" attribute="String" lineEndContext="#stay">
<context name="String" attribute="String">
<IncludeRules context="Escape"/>
<DetectChar char="&quot;" attribute="String" context="#pop"/>
<DetectChar char="\" attribute="StringEscape" context="StringEscape"/>
</context>
<context name="StringSQ" attribute="String" lineEndContext="#stay">
<context name="StringSQ" attribute="String">
<IncludeRules context="Escape"/>
<DetectChar char="'" attribute="String" context="#pop"/>
<DetectChar char="\" attribute="StringEscape" context="StringEscape"/>
</context>
<context name="StringEscape" attribute="StringEscape" lineEndContext="#pop">
<RegExpr String="\\[\\&quot;'abfnrtv0]" attribute="StringEscape" context="#pop"/>
<RegExpr String="\\x[0-9A-Fa-f]{2}" attribute="StringEscape" context="#pop"/>
<RegExpr String="\\u[0-9A-Fa-f]{4}" attribute="StringEscape" context="#pop"/>
<RegExpr String="\\U[0-9A-Fa-f]{8}" attribute="StringEscape" context="#pop"/>
<context name="Escape" attribute="StringEscape">
<LineContinue attribute="StringEscape"/>
<RegExpr String="\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|u\{[0-9a-fA-F]+\}|[0-3][0-7]{1,2}|[4-7][0-7]|[1-7])" attribute="StringEscape"/>
<StringDetect String="\x" attribute="Error"/>
<StringDetect String="\u" attribute="Error"/>
<DetectChar char="\" attribute="StringEscape" context="Character Escape"/>
</context>
<context name="Character Escape" attribute="StringEscape">
<AnyChar String="0bfnrtv" attribute="StringEscape" context="#pop"/>
<RegExpr String="." attribute="StringEscape" context="#pop"/>
</context>
</contexts>
<itemDatas>
@@ -243,6 +247,7 @@
<itemData name="Float" defStyleNum="dsFloat" spellChecking="0"/>
<itemData name="String" defStyleNum="dsString"/>
<itemData name="StringEscape" defStyleNum="dsSpecialChar" spellChecking="0"/>
<itemData name="Error" defStyleNum="dsError"/>
</itemDatas>
</highlighting>
<general>
+1 -44
View File
@@ -37,51 +37,8 @@ If you're using Kate as part of another application (e.g., KDevelop):
VERIFY INSTALLATION
-------------------
To verify the syntax file is recognized by Kate:
To verify that Kate recognizes the syntax file:
1. Open Kate
2. Go to: Tools → Highlighting
3. Look for "Prog8" under the "Scripts" section
FEATURES
--------
- Keywords (if, for, while, sub, return, break, continue, etc.)
- All if_* condition codes (if_z, if_nz, if_cs, if_cc, etc.)
- Compiler directives (%import, %zeropage, %asm, %ir, %option, etc.)
- Attributes (@zp, @shared, @align64, @dirty, @nosplit, etc.)
- Data types (byte, word, ubyte, uword, long, float, str, etc.)
- Pointer types (^^byte, ^^word, ^^ubyte, etc.)
- Built-in functions (peek, poke, push, pop, rol, ror, etc.)
- Encoding prefixes (petscii:, iso:, cp437:, atascii:, etc.)
- Comments (line ; and block /* */)
- Numbers (decimal, hexadecimal $, binary %)
- Strings and character literals
FILE FORMAT
-----------
The syntax definition follows the Kate 6.x XML format.
For more information, see:
https://docs.kde.org/stable6/en/kate/katepart/highlighting.html
TROUBLESHOOTING
---------------
If the syntax doesn't appear after installation:
1. Check for XML errors:
xmllint --noout ~/.local/share/org.kde.syntax-highlighting/syntax/prog8.xml
2. Clear Kate's syntax cache:
rm -rf ~/.cache/kate*
3. Restart Kate completely
4. Verify the file is in the correct location:
ls -la ~/.local/share/org.kde.syntax-highlighting/syntax/prog8.xml
LICENSE
-------
This syntax definition is licensed under GPL-3.0.