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 linux kernel annotations to the extras #5

Merged
merged 3 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ module.exports = grammar({
extras: $ => [
/\s|\\\r?\n/,
$.comment,
$._linux_kernel_annotations,
],

inline: $ => [
Expand All @@ -83,6 +84,44 @@ module.exports = grammar({
rules: {
translation_unit: $ => repeat($._top_level_item),

_linux_kernel_annotations: $ => token(choice(
'__init',
'__exit',
'__initdata',
'__exitdata',
'__initconst',
'__initconstdata',
'__devinit',
'__devexit',
'__devinitdata',
'__devexitdata',
'__init_refok',
'__exit_refok',
'__ref',
'__refdata',
'__section',
'__used',
'__unused',
'__aligned',
'__packed',
'__always_inline',
'__noinline',
'__deprecated',
'__noreturn',
'__cold',
'__ro_after_init',
'__must_check',
'__always_unused',
'__maybe_unused',
'__user',
'__kernel',
'__force',
'__iomem',
'__rcu',
'__percpu',
'__init_once'
)),

// Top level items are block items with the exception of the expression statement
_top_level_item: $ => choice(
$.function_definition,
Expand Down
152 changes: 152 additions & 0 deletions src/grammar.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading