Open travisdowns opened 8 years ago
Hmmm, this is a tricky one. I knew dealing with NASM macros would be messy, which is why I mostly ignored the problem, but I didn't think of this case. Perhaps it should count % as part of a label, just to deal with this common use case?
I think it depends what the current parsing logic is? It seems like in nasm, outside of a macro the % character does terminate a label (and likely results in an error since % isn't a valid character after a label).
So I think you could treat %[number] as part of a label. In the weird case where you weren't in a macro, but you wrote that anyway, that's gonna be a compile error, but I think for formatting purposes, treating it like a label still makes sense (e.g., you should still format stuff best-effort even if it won't compile).
The default for nasm-mode seems to be to format labels fully left-aligned (starting in the first column), like so:
So far, so good. If a label contains a
%
character, however, the indentation changes - the labels are now aligned one tab in, same as assembly instructions, like so:Probably this happens because nasm-mode doesn't detect it as a valid label - but such labels are common, for example, in macro definitions.