maziac / hex-hover-converter

MIT License
8 stars 3 forks source link

‘#x’ hex format #5

Closed formicant closed 3 years ago

formicant commented 3 years ago

Please consider supporting the ‘#x’ hex format. E. g.:

    addr EQU #1234 ; = 4660 dec
    ld a, #FF      ; =  255 dec

The ‘#’ character is a valid prefix for hexadecimal numbers in SjASMPlus and some other Z80 assembly dialects. SjASMPlus docs. Numeric constants

maziac commented 3 years ago

Actually the hex conversion is shown, see here: Bildschirmfoto 2021-05-11 um 18 26 55

It shows both interpreting the number as decimal and as hexadecimal.

The reason is that I want to keep the parsing simple to catch as many formats as possible. Therefore I only use the very common $, 0x prefix and the suffix h to recognize a hex number. # is not so common. E.g. in xml a &#8217 interprets the 8217 as decimal value.

I thinks displaying both possibilities is the better option.

nwehrle commented 3 years ago

I really like how you handle #1234, because it means decimal 1234 for my usecase. #$1234 will be interpreted as HEX for my usecase (ca65).