TheLX5 / AsarSyntaxHighlight-VSCode

Asar syntax highlight for Visual Studio Code
7 stars 4 forks source link

Different scopes for addresses and hex values #10

Open Underrout opened 4 years ago

Underrout commented 4 years ago

Are there any plans for differentiating between addresses ($80) and literal hex values (#$80) when it comes to their usage with opcodes? I know this is probably sort of difficult since in LDA $80 $80 would be an address but in db $80 or if !def == $80 it is actually just a hex value. I just personally find it a lot easier to understand code at a glance when the $80 in LDA $80 and the #$80 in LDA #$80 are highlighted in different colors and would love this feature if it's at all feasible.

TheLX5 commented 4 years ago

Sounds like something that could be implemented. I'll run some tests to determine if it's actually possible to do and post the results here.

Underrout commented 4 years ago

Thanks, it's worth noting that defines complicate this further since !def = $80 could be a literal or an address and it seems fairly impossible to figure out which it is without leaving the syntactic layer.

TheLX5 commented 4 years ago

Yeah, I thought about it and it's hard, if not impossible, to determine with regex alone, not to mention that TextMate only works per line and matching several lines is pretty much a guaranteed headache.

I think I'll just detect if they're after an operator or asar directive to treat them as values. That should cover most cases.

Underrout commented 4 years ago

Yeah I think that's probably the most reasonable solution.

TheLX5 commented 4 years ago

Good enough, I guess.

I'll push the changes once I'm done with other minor stuff that popped up with other changes I made.

Underrout commented 4 years ago

Ty ty, looks nice!

TheLX5 commented 4 years ago

Addressed in https://github.com/TheLX5/AsarSyntaxHighlight-VSCode/commit/2c3370e3b0658336d8ee05868afd27518e34cf3c

I will leave the issue open until the proper release of version 0.0.2 in case there's something wrong with the implementation of this feature.

TheLX5 commented 3 years ago

Doesn't seem to be broken.... but SPC700 and GSU mnemonics might not work fine due to how the initial implementation works and looks like it'd be too annoying to add.