Skip to content

Commit

Permalink
Factor out cdef definition block
Browse files Browse the repository at this point in the history
  • Loading branch information
chrhansk committed Nov 9, 2024
1 parent b7ca3ac commit ce931be
Show file tree
Hide file tree
Showing 5 changed files with 12,061 additions and 12,018 deletions.
19 changes: 11 additions & 8 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,17 +164,20 @@ module.exports = grammar(Python, {
$.cvar_def,
$.cdef_type_declaration,
$.extern_block,
seq(
repeat($.storageclass),
optional(choice($.identifier, $.keyword_identifier)),
":",
$._indent,
repeat1(choice($.cvar_def, $.ctypedef_statement, $.cdef_type_declaration, $.extern_block)),
$._dedent,
),
$.cdef_definition_block,
),
),

cdef_definition_block: $ =>
seq(
repeat($.storageclass),
optional(choice($.identifier, $.keyword_identifier)),
":",
$._indent,
repeat1(choice($.cvar_def, $.ctypedef_statement, $.cdef_type_declaration, $.extern_block)),
$._dedent,
),

cvar_def: $ =>
seq(
repeat($.storageclass),
Expand Down
122 changes: 63 additions & 59 deletions src/grammar.json

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

29 changes: 28 additions & 1 deletion src/node-types.json

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

Loading

0 comments on commit ce931be

Please sign in to comment.