syntax: asm: highlight C-like comments (#3696)

Different assemblers have different syntaxes for comments: ";", "#",
"!", "|", "@", "*" and finally C-like comments "//" and "/* ... */".

Micro currently highlights only ";". This is causing various problems
with broken highlighting with other types of comments (i.e. those not
recognized by micro as comments), when the text in those comments
contains special characters, causing wrong highlighting of text after
them.

On the other hand, highlighting comments like "#", "|" etc would cause
conflicts with other syntax elements, e.g. constants in ARM assembly,
preprocessor directives, arithmetic expressions etc.

So let's highlight at least C-like comments. They are quite commonly
used and they are not so likely to cause conflicts with other syntax
elements.
This commit is contained in:
Dmytro Maluka 2025-03-15 14:29:45 +01:00 committed by GitHub
parent fa317456e9
commit 0b75031ac5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -4,7 +4,7 @@ detect:
filename: "\\.(S|s|asm)$"
rules:
# This file is made for NASM assembly
# This file is made mainly for NASM assembly
## Instructions
# x86
@ -108,3 +108,16 @@ rules:
rules:
- todo: "(TODO|XXX|FIXME):?"
## C-like comments (supported by some assemblers)
- comment:
start: "//"
end: "$"
rules:
- todo: "(TODO|XXX|FIXME):?"
- comment:
start: "/\\*"
end: "\\*/"
rules:
- todo: "(TODO|XXX|FIXME):?"