-
Notifications
You must be signed in to change notification settings - Fork 1
Fixes #2, closes #3, better scopes #7
base: master
Are you sure you want to change the base?
Conversation
Thanks so much for the contribution! I do have some questions before merging. There seem to be some bugs/regressions related to #2 :
These are choices you've made that I'm wondering about:
This is my first Sublime/Atom style grammar, so I'm sure many of your choices make more sense than mine, but I'd love some insight on how you made the choices! Regarding register highlighting, feel free to open a new issue on that. I do think it would be strange to not tag registers. Actually coloring them should be up to the theme. You changed their class from |
I'm so sorry for my late reply, I finally got around playing Breath of the Wild(it's amazing). I updated the pull request to address your points:
I oversaw that one. I personally prefer only to have label definitions highlighted, having inline labels highlighted is too much color. Most other assembly language grammars don't highlight inline labels. I added code that will do that, just uncomment lines 174 ~ 184. Warning: This will cause problems with label definitions. See next point.
I couldn't reproduce this, but with this new commit it doesn't occur("it works on my machine"😜). If it still happens, upload your test code as a gist and tell me which syntax theme you use so I can try and reproduce this(see also point two on my scope explanation below). BIG CATCH: If you decide to use inline label highlighting as mentioned in the point above, mind that this will again falsely highlight illegal labels. I haven't found a good way to make this work yet.
I fixed that, you find the new label code in lines 143 ~ 157. I personally don't think colored colons will improve readability, but that is a design choice I leave to you. If you want the single colored labels, replace the lines 143 ~ 157 with lines 158 ~ 171.
I prefer to do it this way for two reasons: One, I like to have assembler directives and actual CPU opcodes separated/highlighted differently. Many assembler directives do not actually produce code; commands like Two, while writing my own first assembly grammar, I was stuck for an hour with a certain regex that refused to light up. The problem wasn't the regex itself, it was the fact that not all syntax themes highlight all scopes. Simply switching the syntax theme in Atom "fixed" my problem. I found that with most syntax themes the scopes I used as replacement are more likely to be highlighted that not(if I remember correctly, it was the Another way to look at the first point is that assembler directives are specific to the assembler you use. If you were to port it to use with another assembler/toolchain, you would probably have to modify those commands and directives, while the rest of your code with CPU opcodes might only change slightly. I hope this helps. Just ask if you need some clarifications |
I managed to fix #2 and add operator support(#3). I also changed the scopes a bit. I tried to emulate the scoping style we use in language-65asm, a package for 6502/65816 assembly.
I would further recommend removing the highlighting for the registers. When writing machine code for architecture with only a few registers(think 6502, 6809, etc.) I find the highlighted registers overwhelming; while it is okay for register-heavy architectures like ARM, MIPS, etc. I think for Gameboy development it is simply too much - but that is a personal opinion.