Skip to content

Commit 0b75031

Browse files
authored
syntax: asm: highlight C-like comments (micro-editor#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.
1 parent fa31745 commit 0b75031

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

runtime/syntax/asm.yaml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ detect:
44
filename: "\\.(S|s|asm)$"
55

66
rules:
7-
# This file is made for NASM assembly
7+
# This file is made mainly for NASM assembly
88

99
## Instructions
1010
# x86
@@ -108,3 +108,16 @@ rules:
108108
rules:
109109
- todo: "(TODO|XXX|FIXME):?"
110110

111+
## C-like comments (supported by some assemblers)
112+
113+
- comment:
114+
start: "//"
115+
end: "$"
116+
rules:
117+
- todo: "(TODO|XXX|FIXME):?"
118+
119+
- comment:
120+
start: "/\\*"
121+
end: "\\*/"
122+
rules:
123+
- todo: "(TODO|XXX|FIXME):?"

0 commit comments

Comments
 (0)