13xforever / x86-assembly-textmate-bundle

A bundle for TextMate/Sublime Text providing syntax highlighting for x86 assembly code.
MIT License
82 stars 24 forks source link

Allow uppercase instructions #6

Closed jonasc closed 7 years ago

jonasc commented 7 years ago

I would like to be able to have uppercase instructions such as CMP and not only cmp. Is there a simple way to extend this definition to have this?

13xforever commented 7 years ago

You'll have to fork it and turn on case-insensetive matching on specific groups of grammar that you want to be matched.

13xforever commented 6 years ago

This is fixed for ST3, and will be fixed for ST2/VSCode/Atom in the v3 update that will happen soon™. Sorry about that, I only noticed when was looking at nasm source code.

Rourke101 commented 5 years ago

Sorry - I just installed the plugin and I am not getting the right syntax from MOV EAX using Packages/x86 and x86_64 Assembly/x86_64 Assembly.tmbundle/Syntaxes/x86_64 Assembly.tmLanguage.

However, I do get it right when using Packages/x86 and x86_64 Assembly/x86_64 Assembly.tmbundle/Syntaxes/Nasm Assembly.sublime-syntax

Is there any specific difference between them or can I safely use the Nasm version for Masm code?

13xforever commented 5 years ago

.sublime-syntax was a complete rewrite from scratch, following close to NASM specification. Of course you can use it for other assemblers as well, but some specifics won't be highlighted (such as section conventions, macros, etc)

Old .tmLanguage version wasn't updated for a long time (except for adding newer instructions). There's a plan to update it to be much closer to the new .sublime-syntax, but there are no tools to convert the grammar, and the capabilities for highlighter are much more limited, so it all boils down to manual re-writing from scratch as well, and it takes a long time, and a lot of effort to do.

Rourke101 commented 5 years ago

Thanks. I did a test and found it fairly OK for MASM but I am having highlighting issues with disassembly code such as:

015F:004045D3  B801000000          MOV     EAX,00000001
CODE:004F5EDA 131C E8 15 E8 F0 FF                         call    sub_4046F4      
00E0AD76 | 84 C0                    | test al,al

The addresses are not detected and are displayed in horrible colours.....

13xforever commented 5 years ago

That is by design, as it's not part of the assembly and is breaking the NASM-specific syntax highlighter. For general assembly tokenization, old highlighter would suit better as it doesn't even try to follow any specific syntax. It was long overdue for updates and fixes I did for nasm rewrite, but unfortunately I don't have much free time right now, and what I have I spend on other projects.

Rourke101 commented 5 years ago

I see. Thanks for your comments!