MERLIN-PRO ASSEMBLER SYNTAX HIGHLIGHTING



  • I am making a (retro 8-bit) Merlin-Pro assembler syntax highlighting language and I want to change the color of the words (not fixed keywords but randomly chosen labels) that been first in the line and only them.

    For example:


    MY FIRST PROGRAM


    LOOP EQU $8000
    COUT EQU $FC58

    I want LOOP and COUT to be printed in different color and only these words. (randomly chosen words, not fixed keywords)

    How to do it?

    P.S. If there is a space betwee



  • The UDL (User Defined Language) lexer is not set up for highlighting random words, or even words that match a certain regular expression.

    If you want any unrecognized word to be a certain color, pick that certain color as the default color for your UDL, and make sure that all known words (like the EQU listed above) are in one of the keyword lists.

    You might want to study this other Topic in the forum, where @Claudia-Frank shared PythonScript code which will do customized highlighting; it was shown with an example of highlighting Python differently than the normal Python lexer does… but you might be able to make it do what you want. (Note: once you get to the post where Claudia shows the screenshot and the PythonScript code, the relevant content of that thread is complete; it kind of went off on a tangent after that. :-) ) I’m sure if you @-mention @Claudia-Frank here or in that thread, she’ll be happy to answer questions you might have on how to make it work for your use case (assuming it’s possible; I’ve never used that code).


Log in to reply