Skip to content

Commit

Permalink
Merge pull request #5 from cloudlinux/add-linux-kernel-annotations-to…
Browse files Browse the repository at this point in the history
…-the-extras

Add linux kernel annotations to the extras
  • Loading branch information
telepenin authored Sep 10, 2024
2 parents 34562a6 + dff97fd commit 3f92258
Show file tree
Hide file tree
Showing 3 changed files with 161,799 additions and 115,775 deletions.
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

0 comments on commit 3f92258

Please sign in to comment.