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

Always pick GAS Lexer for .S files #316

Closed

Conversation

fstachura
Copy link
Collaborator

Not the best heuristic, but better than always picking the SLexer class

https://pygments.org/docs/lexers/#pygments.lexers.r.SLexer

Currently, Elixir does not index any R language files

http/web.py Show resolved Hide resolved
Currently, Pygments often picks SLexer for .S files. It's a lexer for
files related to the R language.

https://pygments.org/docs/lexers/#pygments.lexers.r.SLexer

```
>>> import pygments.lexers
>>> pygments.lexers.guess_lexer_for_filename('arch/x86/boot/header.S',
        open('arch/x86/boot/header.S').read())
<pygments.lexers.SLexer>
```

This commits makes sure Elixir prefers the GAS lexer for .S files
instead of SLexer.
It's not the best heuristic, but better than picking the SLexer class
sometimes.
Currently, Elixir does not index any R language projects. In the future,
it would be better to specify per-project information about what
languages are used.
@tleb
Copy link
Member

tleb commented Aug 20, 2024

It still does not handle # comments properly (using /linux/v6.10.6/source/arch/x86/boot/header.S as example). Old rendering:

image

New rendering:

image

I guess we can't do much more than pick the best Pygments lexer for the job. Many other things look more reasonable. It is merged as 43b4f72!

@tleb tleb closed this Aug 20, 2024
@fstachura
Copy link
Collaborator Author

@tleb

It still does not handle # comments properly

Do you mean that some words in comments are marked as identifiers? It's the same problem that's in #306

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.

2 participants