Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for ARM constant notation in GAS lexer #1530

Merged
merged 1 commit into from
Sep 6, 2020

Conversation

btashton
Copy link
Contributor

@btashton btashton commented Sep 2, 2020

GNU supports ARM syntax which uses notation like #1 for constants.
Currently this is handled like a comment which is incorrect.

Take the case of:
ldr r0, [r1, #0]

Right now the #0] would be treated like a comment and looks very poor.
image

After this change:
image

Was referenced as part of issue #627

GNU supports ARM syntax which uses notation like pygments#1 for constants.
Currently this is handled like a comment which is incorrect.

Take the case of:
ldr     r0, [r1, #0]

Right now the #0] would be treated like a comment and looks
very poor.

Was referenced in issue pygments#627

Signed-off-by: Brennan Ashton <bashton@brennanashton.com>
@birkenfeld
Copy link
Member

Hm, the lexer is explicitly for "AT&T" syntax, which doesn't apply to ARM assembly. I'm not against making it more tolerant, but for example register names won't be highlighted specially either...

BTW, on ARM apparently @ introduces a comment.

@btashton
Copy link
Contributor Author

btashton commented Sep 5, 2020

I'm open to try to find some time to further adapt it. Or if you think a better direction would make more sense. It is GAS syntax, which is ATT plus GNU extensions which make it look close to the ARM syntax, so I felt it was appropriate.

The # can have three different meanings... I think I fully capture at least the common immediate notation, but it does not handle relocation.

https://sourceware.org/binutils/docs-2.22/as/ARM_002dChars.html#ARM_002dChars

@birkenfeld
Copy link
Member

Let's merge this now, the lexers can be improved further later. CI failure is unrelated.

@birkenfeld birkenfeld merged commit 3ebcdc8 into pygments:master Sep 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants