HealsCodes / vim-gas

Advanced syntax highlighting for GNU As
BSD 3-Clause "New" or "Revised" License
143 stars 21 forks source link

Add ARM syntax #4

Closed willprice closed 8 years ago

willprice commented 9 years ago

Hi,

Now I don't suggest you pull this, however it would be useful if you would like to integrate ARM syntax into your addon, you could provide some feedback on my work so far, so I can continue to implement this feature.

Cheers,

P.S nice work on the x86 highlighting!

HealsCodes commented 9 years ago

Hi, sorry for my late reply.. your work so far looks really good!

Especially so since you did a fine job integrating it into the existing opcode selection feature. Keep going and I'll be glad to merge the PR once you think you are ready :)

Cheers,

willprice commented 9 years ago

I don't particularly like all the hard coded instructions with suffixes, is it not possible to generate these dynamically? This would make it easier to add additional instruction sets and suffixes.

Cheers

HealsCodes commented 9 years ago

Am 22.02.2015 um 14:49 schrieb Will Price notifications@github.com:

I don't particularly like all the hard coded instructions with suffixes, is it not possible to generate these dynamically? This would make it easier to add additional instruction sets and suffixes.

Since a syntax definition in itself is only a vim script I don’t see why that shouldn’t be possible. I wasn’t all that adept in vim script when I wrote the original syntax and since then I just couldn’t bump myself to try to simplify things.. (What with never changing a running system and so on..)

If you have suggestions in this direction I’d gladly hear them.

Reply to this email directly or view it on GitHub https://github.com/Shirk/vim-gas/pull/4#issuecomment-75436211.

willprice commented 9 years ago

Yeah... it's a pretty odd language!

I've just had a play around and I've got this:

function! Suffixes(word, suffixes)
  let words = []
  for suffix in a:suffixes
    call add(words, a:word . suffix)
  endfor
  return words
endfunction

I just wanted to ask prior to investigating in case you had already tried and come up against some unavoidable obstacles.

Stripping the syntax down to just instructions + suffixes would make the syntax file much shorter, and easier to mod. I propose I try and implement the ARM stuff this way, and then if that goes well, we can work on refactoring the old code to use the new style?

Thoughts?

HealsCodes commented 9 years ago

Yeah, sounds good to me :)

willprice commented 9 years ago

In ARM GAS # is used for immediate operands e.g. add r0, #1, any idea how to toggle between highlighting it in ARM and x86? Perhaps the syntax file needs to have some sort of variable that can be embedded into the modeline to tell it which syntax it's expecting?

HealsCodes commented 9 years ago

I agree on the part of having a variable the user can :let but the stock modeline doesn't support other commands than :set and even that is limited (for good reason).

However there are scripts like this one: let-modeline.vim which add that functionality.

So you could add a switch which the user can :let per buffer or in their .vimrc and the README for the syntax could point them to a script like the above on how to do it automatically via modeline.

dpc commented 8 years ago

Hi, I'm interested in ARM support. Is this going to get merged? Maybe an separate fork would be a better idea.

willprice commented 8 years ago

Hey @dpc, My fork is certainly incomplete (I'll see whether I have any unpushed changes), it's probably a good starting point, I don't think you'd be gaining much from a separate fork that isn't going to be merged back into this script although it has been a while since I last looked at this, maybe @Shirk has a different opinion?

I didn't find the changes in syntax that ARM GAS has compared to vanilla GAS too problematic, I think there was some fairly straight forward way of working around them

HealsCodes commented 8 years ago

While I’m sadly not into ARM assembly I’m still open for PRs to add support.

willprice commented 8 years ago

@dpc, just checked my local clone, no more changes, wysiwyg!

dpc commented 8 years ago

@Shirk : Isn't this a PR? :)

I've used @willprice fork and it does seem to work.

HealsCodes commented 8 years ago

Indeed.. Blame the uniform github mail notifications :)