From e645b0abe1abe5b33ce7bc2f71b2228418935dc0 Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Sun, 12 Jul 2026 12:37:42 +0200 Subject: [PATCH] add pokep() and peekp() builtin functions --- .../src/prog8/code/core/BuiltinFunctions.kt | 2 ++ .../compiler/astprocessing/CodeDesugarer.kt | 16 +++++++++++++++ .../_static/symboldumps/skeletons-c128.txt | 2 ++ .../_static/symboldumps/skeletons-c64.txt | 2 ++ .../_static/symboldumps/skeletons-cx16.txt | 2 ++ .../_static/symboldumps/skeletons-pet32.txt | 2 ++ .../_static/symboldumps/skeletons-qemu68k.txt | 20 ++++++++++--------- .../_static/symboldumps/skeletons-virtual.txt | 2 ++ docs/source/conf.py | 1 + docs/source/libraries.rst | 12 +++++++++-- docs/source/prog8_lexer.py | 5 +++++ docs/source/structpointers.rst | 7 +++---- docs/source/todo.rst | 5 ----- examples/m68k/textelite.p8 | 10 +++++----- syntax-files/Jetbrains-IDEs/Prog8.xml | 2 +- syntax-files/Kate/prog8.xml | 2 ++ syntax-files/NotepadPlusPlus/Prog8.xml | 2 +- syntax-files/NotepadPlusPlus/Prog8dark.xml | 2 +- syntax-files/SublimeText/Prog8.sublime-syntax | 2 +- syntax-files/Vim/prog8_builtins.vim | 2 +- syntax-files/nano/prog8.nanorc | 2 +- 21 files changed, 71 insertions(+), 31 deletions(-) diff --git a/codeCore/src/prog8/code/core/BuiltinFunctions.kt b/codeCore/src/prog8/code/core/BuiltinFunctions.kt index 20cdb5e62..63f834e32 100644 --- a/codeCore/src/prog8/code/core/BuiltinFunctions.kt +++ b/codeCore/src/prog8/code/core/BuiltinFunctions.kt @@ -163,12 +163,14 @@ val BuiltinFunctions: Map = mapOf( "peekw" to FSignature(true, arrayOf(BaseDataType.UWORD), FParam("address", BaseDataType.UWORD, BaseDataType.LONG)), "peekl" to FSignature(true, arrayOf(BaseDataType.LONG), FParam("address", BaseDataType.UWORD, BaseDataType.LONG)), "peekf" to FSignature(true, arrayOf(BaseDataType.FLOAT), FParam("address", BaseDataType.UWORD, BaseDataType.LONG)), + "peekp" to FSignature(true, arrayOf(BaseDataType.POINTER), FParam("address", BaseDataType.POINTER, BaseDataType.UWORD, BaseDataType.LONG)), "poke" to FSignature(false, emptyArray(), FParam("address", BaseDataType.UWORD, BaseDataType.LONG), FParam("value", BaseDataType.UBYTE, BaseDataType.BYTE)), "pokebool" to FSignature(false, emptyArray(), FParam("address", BaseDataType.UWORD, BaseDataType.LONG), FParam("value", BaseDataType.BOOL)), "pokebowl" to FSignature(false, emptyArray(), FParam("address", BaseDataType.UWORD, BaseDataType.LONG), FParam("value", BaseDataType.BOOL)), "pokew" to FSignature(false, emptyArray(), FParam("address", BaseDataType.UWORD, BaseDataType.LONG), FParam("value", BaseDataType.UWORD, BaseDataType.WORD)), "pokel" to FSignature(false, emptyArray(), FParam("address", BaseDataType.UWORD, BaseDataType.LONG), FParam("value", BaseDataType.LONG)), "pokef" to FSignature(false, emptyArray(), FParam("address", BaseDataType.UWORD, BaseDataType.LONG), FParam("value", BaseDataType.FLOAT)), + "pokep" to FSignature(false, emptyArray(), FParam("address", BaseDataType.POINTER, BaseDataType.UWORD, BaseDataType.LONG), FParam("value", BaseDataType.POINTER)), "pokemon" to FSignature(false, arrayOf(BaseDataType.UBYTE), FParam("address", BaseDataType.UWORD), FParam("value", BaseDataType.UBYTE)), "rsave" to FSignature(false, emptyArray()), "rrestore" to FSignature(false, emptyArray()), diff --git a/compiler/src/prog8/compiler/astprocessing/CodeDesugarer.kt b/compiler/src/prog8/compiler/astprocessing/CodeDesugarer.kt index 1de3f8dc7..25d3191d9 100644 --- a/compiler/src/prog8/compiler/astprocessing/CodeDesugarer.kt +++ b/compiler/src/prog8/compiler/astprocessing/CodeDesugarer.kt @@ -271,6 +271,14 @@ _after: ) return listOf(AstReplaceNode(functionCall as Node, newCall, parent)) } + if(outerFunc==listOf("pokep")) { + val pokeName = if(target.POINTER_MEM_SIZE > 2u) "pokel" else "pokew" + val newCall = FunctionCallStatement( + IdentifierReference(listOf(pokeName), position), + functionCall.args, false, position + ) + return listOf(AstReplaceNode(functionCall as Node, newCall, parent)) + } return noModifications } @@ -336,6 +344,14 @@ _after: } return mods } + if(functionCallExpr.target.nameInSource==listOf("peekp")) { + val peekName = if(target.POINTER_MEM_SIZE > 2u) "peekl" else "peekw" + val newCall = FunctionCallExpression( + IdentifierReference(listOf(peekName), functionCallExpr.position), + functionCallExpr.args.toMutableList(), functionCallExpr.position + ) + return listOf(AstReplaceNode(functionCallExpr, newCall, parent)) + } return noModifications } diff --git a/docs/source/_static/symboldumps/skeletons-c128.txt b/docs/source/_static/symboldumps/skeletons-c128.txt index 6048235dd..cebf04c83 100644 --- a/docs/source/_static/symboldumps/skeletons-c128.txt +++ b/docs/source/_static/symboldumps/skeletons-c128.txt @@ -34,6 +34,7 @@ peekbool (uword|long address) -> bool peekf (uword|long address) -> float peekl (uword|long address) -> long peekw (uword|long address) -> uword +peekp (pointer|uword|long address) -> pointer poke (uword|long address, ubyte|byte value) pokebool (uword|long address, bool value) pokebowl (uword|long address, bool value) @@ -41,6 +42,7 @@ pokef (uword|long address, float value) pokel (uword|long address, long value) pokemon (uword address, ubyte value) -> ubyte pokew (uword|long address, uword|word value) +pokep (pointer|uword|long address, pointer value) pop () -> ubyte popf () -> float popl () -> long diff --git a/docs/source/_static/symboldumps/skeletons-c64.txt b/docs/source/_static/symboldumps/skeletons-c64.txt index 1f3c2240c..e3669315a 100644 --- a/docs/source/_static/symboldumps/skeletons-c64.txt +++ b/docs/source/_static/symboldumps/skeletons-c64.txt @@ -34,6 +34,7 @@ peekbool (uword|long address) -> bool peekf (uword|long address) -> float peekl (uword|long address) -> long peekw (uword|long address) -> uword +peekp (pointer|uword|long address) -> pointer poke (uword|long address, ubyte|byte value) pokebool (uword|long address, bool value) pokebowl (uword|long address, bool value) @@ -41,6 +42,7 @@ pokef (uword|long address, float value) pokel (uword|long address, long value) pokemon (uword address, ubyte value) -> ubyte pokew (uword|long address, uword|word value) +pokep (pointer|uword|long address, pointer value) pop () -> ubyte popf () -> float popl () -> long diff --git a/docs/source/_static/symboldumps/skeletons-cx16.txt b/docs/source/_static/symboldumps/skeletons-cx16.txt index 61897fdc1..87649db31 100644 --- a/docs/source/_static/symboldumps/skeletons-cx16.txt +++ b/docs/source/_static/symboldumps/skeletons-cx16.txt @@ -34,6 +34,7 @@ peekbool (uword|long address) -> bool peekf (uword|long address) -> float peekl (uword|long address) -> long peekw (uword|long address) -> uword +peekp (pointer|uword|long address) -> pointer poke (uword|long address, ubyte|byte value) pokebool (uword|long address, bool value) pokebowl (uword|long address, bool value) @@ -41,6 +42,7 @@ pokef (uword|long address, float value) pokel (uword|long address, long value) pokemon (uword address, ubyte value) -> ubyte pokew (uword|long address, uword|word value) +pokep (pointer|uword|long address, pointer value) pop () -> ubyte popf () -> float popl () -> long diff --git a/docs/source/_static/symboldumps/skeletons-pet32.txt b/docs/source/_static/symboldumps/skeletons-pet32.txt index fafb71726..6e81081ff 100644 --- a/docs/source/_static/symboldumps/skeletons-pet32.txt +++ b/docs/source/_static/symboldumps/skeletons-pet32.txt @@ -34,6 +34,7 @@ peekbool (uword|long address) -> bool peekf (uword|long address) -> float peekl (uword|long address) -> long peekw (uword|long address) -> uword +peekp (pointer|uword|long address) -> pointer poke (uword|long address, ubyte|byte value) pokebool (uword|long address, bool value) pokebowl (uword|long address, bool value) @@ -41,6 +42,7 @@ pokef (uword|long address, float value) pokel (uword|long address, long value) pokemon (uword address, ubyte value) -> ubyte pokew (uword|long address, uword|word value) +pokep (pointer|uword|long address, pointer value) pop () -> ubyte popf () -> float popl () -> long diff --git a/docs/source/_static/symboldumps/skeletons-qemu68k.txt b/docs/source/_static/symboldumps/skeletons-qemu68k.txt index 83cb6ba97..8d44fe890 100644 --- a/docs/source/_static/symboldumps/skeletons-qemu68k.txt +++ b/docs/source/_static/symboldumps/skeletons-qemu68k.txt @@ -32,15 +32,17 @@ offsetof (ubyte field) -> ubyte peek (uword|long address) -> ubyte peekbool (uword|long address) -> bool peekf (uword|long address) -> float -peekl (uword|long address) -> long -peekw (uword|long address) -> uword -poke (uword|long address, ubyte|byte value) -pokebool (uword|long address, bool value) -pokebowl (uword|long address, bool value) -pokef (uword|long address, float value) -pokel (uword|long address, long value) -pokemon (uword address, ubyte value) -> ubyte -pokew (uword|long address, uword|word value) + peekl (uword|long address) -> long + peekw (uword|long address) -> uword + peekp (pointer|uword|long address) -> pointer + poke (uword|long address, ubyte|byte value) + pokebool (uword|long address, bool value) + pokebowl (uword|long address, bool value) + pokef (uword|long address, float value) + pokel (uword|long address, long value) + pokemon (uword address, ubyte value) -> ubyte + pokew (uword|long address, uword|word value) + pokep (pointer|uword|long address, pointer value) pop () -> ubyte popf () -> float popl () -> long diff --git a/docs/source/_static/symboldumps/skeletons-virtual.txt b/docs/source/_static/symboldumps/skeletons-virtual.txt index 45adba079..e8dd2e60d 100644 --- a/docs/source/_static/symboldumps/skeletons-virtual.txt +++ b/docs/source/_static/symboldumps/skeletons-virtual.txt @@ -34,6 +34,7 @@ peekbool (uword|long address) -> bool peekf (uword|long address) -> float peekl (uword|long address) -> long peekw (uword|long address) -> uword +peekp (pointer|uword|long address) -> pointer poke (uword|long address, ubyte|byte value) pokebool (uword|long address, bool value) pokebowl (uword|long address, bool value) @@ -41,6 +42,7 @@ pokef (uword|long address, float value) pokel (uword|long address, long value) pokemon (uword address, ubyte value) -> ubyte pokew (uword|long address, uword|word value) +pokep (pointer|uword|long address, pointer value) pop () -> ubyte popf () -> float popl () -> long diff --git a/docs/source/conf.py b/docs/source/conf.py index acda705f3..7e5aa141f 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -126,6 +126,7 @@ exclude_patterns = [] # The name of the Pygments (syntax highlighting) style to use. pygments_style = "sphinx" # highlight_language = 'none' +highlight_language = 'prog8' # -- Options for HTML output ------------------------------------------------- diff --git a/docs/source/libraries.rst b/docs/source/libraries.rst index 9939aa6e7..7df6e7182 100644 --- a/docs/source/libraries.rst +++ b/docs/source/libraries.rst @@ -103,7 +103,7 @@ CPU Stack Low-level function that is seldomly used in user code. Don't assume anything about the order in which the bytes are pushed - popw will make sense of them again. -:index:`pushp` (value) +:index:`pushp` (value) **experimental, may change or be removed** pushes a pointer value on the CPU hardware stack. On 2-byte pointer targets this is the same as pushw, on 32-bit pointer targets it acts as pushl. Low-level function that is seldomly used in user code. @@ -127,7 +127,7 @@ CPU Stack pops a 16-bit word value off the CPU hardware stack that was pushed before by pushw, and returns it. Low-level function that is seldomly used in user code. -:index:`popp` () +:index:`popp` () **experimental, may change or be removed** pops a pointer value off the CPU hardware stack that was pushed before by pushp, and returns it. On 2-byte pointer targets this is the same as popw, on 32-bit pointer targets it acts as popl. Low-level function that is seldomly used in user code. @@ -226,6 +226,10 @@ Miscellaneous Caution: when using peekw to get words out of an array pointer, make sure the array is *not* a split word array (peekw requires the LSB and MSB of the word value to be consecutive in memory). +:index:`peekp` (address) **experimental, may change or be removed** + reads a pointer value at the given address in memory. + On 16-bit targets this reads 2 bytes (like peekw), on 32-bit targets this reads 4 bytes (like peekl). + :index:`peekl` (address) reads the signed long value at the given address in memory. Long is read as usual little-endian lsb/msb byte order. @@ -248,6 +252,10 @@ Miscellaneous :index:`pokef` (address, value) writes the float value at the given address in memory. On CBM machines, this writes 5 bytes. +:index:`pokep` (address, value) **experimental, may change or be removed** + writes the pointer value at the given address in memory. + On 16-bit targets this writes 2 bytes (like pokew), on 32-bit targets this writes 4 bytes (like pokel). + :index:`pokemon` (address, value) Like poke(), but also returns the previous value in the given address. Also doesn't have anything to do with a certain video game. diff --git a/docs/source/prog8_lexer.py b/docs/source/prog8_lexer.py index 313100703..fb26e3163 100644 --- a/docs/source/prog8_lexer.py +++ b/docs/source/prog8_lexer.py @@ -16,6 +16,7 @@ class Prog8Lexer(RegexLexer): (r"\d+\.\d+(?:[eE][+-]?\d+)?", Number.Float), (r"\d+", Number.Integer), (r"\$[0-9a-fA-F_]+", Number.Hex), + (r"\$", Operator), (r"%[01_]+", Number.Bin), (r"\btrue\b|\bfalse\b", Keyword.Constant), (r"\b(?:if|else|then|when)\b", Keyword), @@ -29,11 +30,15 @@ class Prog8Lexer(RegexLexer): (r"\b(?:and|or|xor|not|as)\b", Operator.Word), (r"%\w+", Name.Decorator), (r"@\w+", Name.Decorator), + (r"@", Operator), + (r"#", Operator), + (r"\\", Operator), (r"\^\^", Keyword.Type), (r"\+\+|--", Operator), (r"(?:<<=|>>=)", Operator), (r"<<|>>", Operator), (r"&&|\|\|", Operator), + (r"=", Operator), (r"[-+*/%&|^~<>!]=?", Operator), (r"[{}()\[\]]", Punctuation), (r":", Punctuation), diff --git a/docs/source/structpointers.rst b/docs/source/structpointers.rst index e594d5b7a..2c728eec2 100644 --- a/docs/source/structpointers.rst +++ b/docs/source/structpointers.rst @@ -262,10 +262,9 @@ However, it is possible to write a dynamic memory handling library yourself (it If you ask such a library to give you a pointer to a piece of memory with size ``sizeof(Enemy)`` you can use that as a dynamic pointer to an Enemy struct. -An example of how a super simple dynamic allocator could look like:: - -.. note:: - The ``pointer`` type is used instead of ``uword`` so that the code also works correctly on targets where memory addresses are wider than 2 bytes (such as the m68k target with 4-byte pointers). +An example of how a super simple dynamic allocator could look like follows. +Noe that the ``pointer`` type is used instead of ``uword`` so that the code also works correctly on targets +where memory addresses are wider than 2 bytes (such as the m68k target with 4-byte pointers):: ^^Node newnode = allocator.alloc(sizeof(Node)) ... diff --git a/docs/source/todo.rst b/docs/source/todo.rst index a52cdd90a..eb689d66c 100644 --- a/docs/source/todo.rst +++ b/docs/source/todo.rst @@ -4,10 +4,6 @@ TODO - need a bunch of type casting/conversion checks that test the handling of the 4-byte/long pointer datatype on the qemu68k target. - some generated label names in the m68k codegen can maybe replaced by local/anonymous labels? -What is this, why are pointer arrays being so difficult here? -// handle DONTCARE pointer arrays on non-6502 targets: convert back to regular array with long elements -// but preserve the struct subtype so field access (struct.field) still works - m68k Codegen: FPU register allocation (68881 only has fp0-fp7) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -19,7 +15,6 @@ Note: this problem does NOT affect regular data/address registers because those Future Things and Ideas ^^^^^^^^^^^^^^^^^^^^^^^ -- use .. code-block:: prog8 in the documentation instead of 'bare' code blocks (there is a prog8 lexer now added for pygments to pick this up) - make enums strongly typed instead of just syntactic sugar for ints (see ideas/enum-strong-type.md for the plan) - add %option private_symbols to make access mode private by default; need (new) 'public' keyword to explicitly mark symbols public. - symboldump: some sort of javadocs generated from the p8 source files (instead of just the function signatures). Use markdown for formatting, not html. diff --git a/examples/m68k/textelite.p8 b/examples/m68k/textelite.p8 index 72bdaf743..ba7b2b571 100644 --- a/examples/m68k/textelite.p8 +++ b/examples/m68k/textelite.p8 @@ -957,12 +957,12 @@ planet { sub getword(ubyte listnum, ubyte wordidx) -> pointer { if sys.SIZEOF_POINTER==4 { ; on 32-bit targets, the array stores flat 4-byte pointers - long wordlist_base = &wordlists - long addr = peekl(wordlist_base + (listnum-$81) * 4) - return peekl(addr + wordidx*4) as pointer + pointer wordlist_base = &wordlists + pointer addr = peekp(wordlist_base + (listnum-$81) * 4) + return peekp(addr + wordidx*4) } else { - uword list = wordlists[listnum-$81] - return peekw(list + wordidx*2) as pointer ; this depends on the word list itself to be @nosplit ! + pointer list = wordlists[listnum-$81] + return peekp(list + wordidx*2) ; this depends on the word list itself to be @nosplit ! } } } diff --git a/syntax-files/Jetbrains-IDEs/Prog8.xml b/syntax-files/Jetbrains-IDEs/Prog8.xml index 018436c97..47766a6d6 100644 --- a/syntax-files/Jetbrains-IDEs/Prog8.xml +++ b/syntax-files/Jetbrains-IDEs/Prog8.xml @@ -14,7 +14,7 @@ - + diff --git a/syntax-files/Kate/prog8.xml b/syntax-files/Kate/prog8.xml index 38c2a298a..528315584 100644 --- a/syntax-files/Kate/prog8.xml +++ b/syntax-files/Kate/prog8.xml @@ -127,11 +127,13 @@ peekf peekl peekw + peekp poke pokebool pokef pokel pokew + pokep pop popf popl diff --git a/syntax-files/NotepadPlusPlus/Prog8.xml b/syntax-files/NotepadPlusPlus/Prog8.xml index 8f93afd84..975145b46 100644 --- a/syntax-files/NotepadPlusPlus/Prog8.xml +++ b/syntax-files/NotepadPlusPlus/Prog8.xml @@ -27,7 +27,7 @@ void const str byte ubyte bool long word uword float pointer zp shared split nosplit requirezp nozp align64 alignpage alignword dirty struct enum %address %asm %ir %asmbinary %asminclude %align %breakpoint %encoding %import %jmptable %memtop %launcher %option %output %zeropage %zpreserved %zpallowed inline sub asmsub extsub clobbers asm if when then else if_cc if_cs if_eq if_mi if_neg if_nz if_pl if_pos if_vc if_vs if_z for in step do while repeat unroll break continue return goto private - alias abs call callfar callfar2 clamp cmp defer divmod len lsb lsw lmh lsl lsr memory mkword min max msb msw offsetof peek peekw peekl peekf peekbool poke pokew pokel pokef pokebool pop popw popl popf popp psg psg2 push pushw pushl pushf pushp rsave rsavex rrestore rrestorex rnd rndw rol rol2 ror ror2 setlsb setmsb sgn sizeof sqrt sqrtw swap + alias abs call callfar callfar2 clamp cmp defer divmod len lsb lsw lmh lsl lsr memory mkword min max msb msw offsetof peek peekw peekp peekl peekf peekbool poke pokew pokep pokel pokef pokebool pop popw popl popf popp psg psg2 push pushw pushl pushf pushp rsave rsavex rrestore rrestorex rnd rndw rol rol2 ror ror2 setlsb setmsb sgn sizeof sqrt sqrtw swap true false not and or xor as to downto |> bmx;cbm;conv;cx16;diskio;floats;graphics;math;memory;palette;psg;psg2;strings;sys;textio;txt;verafx diff --git a/syntax-files/NotepadPlusPlus/Prog8dark.xml b/syntax-files/NotepadPlusPlus/Prog8dark.xml index e18229d37..5e21e2f90 100644 --- a/syntax-files/NotepadPlusPlus/Prog8dark.xml +++ b/syntax-files/NotepadPlusPlus/Prog8dark.xml @@ -27,7 +27,7 @@ void const str byte ubyte bool long word uword float pointer zp shared split nosplit requirezp nozp align64 alignpage alignword dirty struct enum %address %asm %ir %asmbinary %asminclude %align %breakpoint %encoding %import %jmptable %memtop %launcher %option %output %zeropage %zpreserved %zpallowed inline sub asmsub extsub clobbers asm if when else if_cc if_cs if_eq if_mi if_neg if_nz if_pl if_pos if_vc if_vs if_z for in step do while repeat unroll break continue return goto private - alias abs call callfar callfar2 clamp cmp defer divmod len lsb lsw lmh lsl lsr memory mkword min max msb msw offsetof peek peekw peekl peekf peekbool poke pokew pokel pokef pokebool pop popw popl popf popp psg psg2 push pushw pushl pushf pushp rsave rsavex rrestore rrestorex rnd rndw rol rol2 ror ror2 setlsb setmsb sgn sizeof sqrt sqrtw swap + alias abs call callfar callfar2 clamp cmp defer divmod len lsb lsw lmh lsl lsr memory mkword min max msb msw offsetof peek peekw peekp peekl peekf peekbool poke pokew pokep pokel pokef pokebool pop popw popl popf popp psg psg2 push pushw pushl pushf pushp rsave rsavex rrestore rrestorex rnd rndw rol rol2 ror ror2 setlsb setmsb sgn sizeof sqrt sqrtw swap true false not and or xor as to downto |> bmx;cbm;conv;cx16;diskio;floats;graphics;math;memory;palette;psg;psg2;strings;sys;textio;txt;verafx diff --git a/syntax-files/SublimeText/Prog8.sublime-syntax b/syntax-files/SublimeText/Prog8.sublime-syntax index a42f082f2..7d9f92dd6 100644 --- a/syntax-files/SublimeText/Prog8.sublime-syntax +++ b/syntax-files/SublimeText/Prog8.sublime-syntax @@ -156,7 +156,7 @@ contexts: - match: (\b(const)\b) scope: storage.modifier.prog8 support: - - match: (\b(abs|call|callfar|callfar2|clamp|cmp|defer|divmod|len|lsb|lsw|lmh|lsr|memory|mkword|min|max|msb|msw|offsetof|peek|peekw|peekl|peekf|peekbool|poke|pokew|pokel|pokef|pokebool|pop|popw|popl|popf|popp|psg|psg2|push|pushw|pushl|pushf|pushp|rsave|rsavex|rrestore|rrestorex|rol|rol2|ror|ror2|setlsb|setmsb|sgn|sizeof|sqrt|sqrtw|swap)\b) + - match: (\b(abs|call|callfar|callfar2|clamp|cmp|defer|divmod|len|lsb|lsw|lmh|lsr|memory|mkword|min|max|msb|msw|offsetof|peek|peekw|peekp|peekl|peekf|peekbool|poke|pokew|pokep|pokel|pokef|pokebool|pop|popw|popl|popf|popp|psg|psg2|push|pushw|pushl|pushf|pushp|rsave|rsavex|rrestore|rrestorex|rol|rol2|ror|ror2|setlsb|setmsb|sgn|sizeof|sqrt|sqrtw|swap)\b) scope: support.function.prog8 variable: - match: (\b\w+\b) diff --git a/syntax-files/Vim/prog8_builtins.vim b/syntax-files/Vim/prog8_builtins.vim index 9dec706cb..26e8414cd 100644 --- a/syntax-files/Vim/prog8_builtins.vim +++ b/syntax-files/Vim/prog8_builtins.vim @@ -11,7 +11,7 @@ syn keyword prog8BuiltInFunc sgn sqrtw syn keyword prog8BuiltInFunc len " Miscellaneous functions -syn keyword prog8BuiltInFunc cmp divmod lsb msb lmh lsw msw mkword min max peek peekw peekl peekf peekbool poke pokew pokel pokef pokebool push pushw pushl pushf pushp pop popw popl popf popp rsave rsavex rrestore rrestorex +syn keyword prog8BuiltInFunc cmp divmod lsb msb lmh lsw msw mkword min max peek peekw peekp peekl peekf peekbool poke pokew pokep pokel pokef pokebool push pushw pushl pushf pushp pop popw popl popf popp rsave rsavex rrestore rrestorex syn keyword prog8BuiltInFunc rol rol2 ror ror2 sizeof offsetof setlsb setmsb swap syn keyword prog8BuiltInFunc memory call callfar callfar2 clamp defer alias diff --git a/syntax-files/nano/prog8.nanorc b/syntax-files/nano/prog8.nanorc index 23aa51d42..b7434141d 100644 --- a/syntax-files/nano/prog8.nanorc +++ b/syntax-files/nano/prog8.nanorc @@ -61,7 +61,7 @@ color magenta "%[Aa][Sm][Mm]" color magenta "^[[:space:]]*%[[:alpha:]]+" # Built-in functions -color white "\<(abs|call|callfar|callfar2|clamp|cmp|defer|divmod|len|lsb|lsw|lmh|lsr|memory|mkword|min|max|msb|msw|offsetof|peek|peekw|peekl|peekf|peekbool|poke|pokew|pokel|pokef|pokebool|pop|popw|popl|popf|popp|psg|psg2|push|pushw|pushl|pushf|pushp|rsave|rsavex|rrestore|rrestorex|rol|rol2|ror|ror2|setlsb|setmsb|sgn|sizeof|sqrt|sqrtw|swap)\>" +color white "\<(abs|call|callfar|callfar2|clamp|cmp|defer|divmod|len|lsb|lsw|lmh|lsr|memory|mkword|min|max|msb|msw|offsetof|peek|peekw|peekp|peekl|peekf|peekbool|poke|pokew|pokep|pokel|pokef|pokebool|pop|popw|popl|popf|popp|psg|psg2|push|pushw|pushl|pushf|pushp|rsave|rsavex|rrestore|rrestorex|rol|rol2|ror|ror2|setlsb|setmsb|sgn|sizeof|sqrt|sqrtw|swap)\>" # Strings color brightblue ""([^"]|\\")*""