-
Notifications
You must be signed in to change notification settings - Fork 744
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
BPF Lexer #1191
BPF Lexer #1191
Conversation
Thanks for the contribution, @pchaigno! Will review in the next couple of days and let you know if there are any comments :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In addition to the specific comment about /./m
, would you be able to change the rule declarations that are of the form rule /...
with rule %r/…
? That just prevents any ambiguity errors being raised by Rubocop.
Will do. Is that the convention for all lexers now? Should other lexers be changed? |
The BPF bytecode is used in Linux (in its current syntax since v3.15) to extend the kernel at runtime. Clang includes a backend to compile from C. The particular syntax supported with this commit is that of LLVM's disassembler, which as far as I can see, is the most common syntax used to display BPF bytecode snippets. I haven't specified filenames or mimetypes because there isn't a clear consensus yet. Most of the time, BPF snippets are directly posted as examples in larger texts (blog posts, emails, etc.). When that is not the case, they sometimes have a .b extension, other times an Assembly extension. I'm adding support for BPF in Rouge to be able to use in Jekyll-based blogs. You can ping me if reviews are needed for future improvements. Signed-off-by: Paul Chaignon <paul.chaignon@orange.com>
I pushed a rebased commit with the changes. Is that what you had in mind? |
@pchaigno wrote:
Yeah, it's a slow process but we're on the middle of transitioning all the lexers. Unfortunately, it sucks for the PRs that are outstanding because they were almost all submitted before that decision was made. Thanks for updating yours!
Looks great! Will merge in now :) |
Thanks! |
Thanks @pchaigno :) You've helped make Rouge a better library! We're operating on a two-week cadence for releases at the moment so this should be released as part of v3.5.0 next Tuesday. |
The BPF bytecode is used in Linux (in its current syntax since v3.15) to extend the kernel at runtime. Clang includes a backend to compile from C. The particular syntax supported with this commit is that of LLVM's disassembler, which as far as I can see, is the most common syntax used to display BPF bytecode snippets.
I haven't specified filenames or mimetypes because there isn't a clear consensus yet. Most of the time, BPF snippets are directly posted as examples in larger texts (blog posts, emails, etc.). When that is not the case, they sometimes have a
.b
extension, other times an Assembly extension.The demo files is from one of my own BPF programs, compiled from C. The sample files contains the demo file concatenated with a sample file from LLVM's repository.
I'm adding support for BPF in Rouge to be able to use it in Jekyll-based blogs. You can ping me if reviews are needed for future improvements.
Here's a preview of the result: