Highlighting Syntax in mcedit for assembly

311 views Asked by At

I want a code to be highlighted like this

jmp label ;comments

I want only label to be highlighted. I've tried something like this

context exclusive jmp\t \n brightmagenta

But in this case ";comments" turned brightmagenta as well which is not what I want. For the comments there is another exclusive context. I've tried also

keyword jmp\t\[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz@\] brightmagenta

But in this case jmp is brightmagenta also.

How can I implement this? I want only label to be affected by highlighting while comments are highlighted in the same manner everywhere(in the attached picture comments for jnz is brightmagenta and in the line after brown) and all the jumps are not affected by highlighting, hence I don't need to add them (and all other commands, variable, constants etc.) manually to the syntax file. enter image description here

Closely related question, since every assembly programmer uses invoke macro is it possible to highlight just the function like in screenshot below? Function was written as keyword in syntax file however I don't want all the functions to the syntax fileenter image description here

2

There are 2 answers

1
Jester On

I am by no means an expert but played around a little and I found a working solution that sets the default to highlighted and turns it off for the unneeded parts as follows:

context default brightmagenta
keyword whole jmp base
context ; \n base

It does seem to do what you asked but you might have other constraints that you did not mention.

0
Анатолий Корибут On

I think I've found the solution for jumps

#for those who use tabs
context exclusive j\[mpnzelc\]\t \n brightmagenta
keyword wholeright ;* brown 
#for those who use spaces
context exclusive j\[mpnzelc\]\s \n brightmagenta
keyword wholeright ;* brown

Still struggling for invoke implementation