tree-sitter-c
Advanced tools
Comparing version 0.20.7 to 0.20.8
@@ -12,3 +12,3 @@ # tree-sitter-c | ||
tree-sitter = "0.20.10" | ||
tree-sitter-c = "0.20.7" | ||
tree-sitter-c = "0.20.8" | ||
``` | ||
@@ -15,0 +15,0 @@ |
@@ -70,2 +70,3 @@ /** | ||
[$.parameter_list, $._old_style_parameter_list], | ||
[$.function_declarator, $._function_declaration_declarator], | ||
], | ||
@@ -248,9 +249,11 @@ | ||
$._declaration_specifiers, | ||
$._declaration_declarator, | ||
commaSep1(field('declarator', choice( | ||
seq( | ||
$._declaration_declarator, | ||
optional($.gnu_asm_expression), | ||
), | ||
$.init_declarator, | ||
))), | ||
';', | ||
), | ||
_declaration_declarator: $ => commaSep1(field('declarator', choice( | ||
seq($._declarator, optional($.gnu_asm_expression)), | ||
$.init_declarator, | ||
))), | ||
@@ -362,2 +365,11 @@ type_definition: $ => seq( | ||
_declaration_declarator: $ => choice( | ||
$.attributed_declarator, | ||
$.pointer_declarator, | ||
alias($._function_declaration_declarator, $.function_declarator), | ||
$.array_declarator, | ||
$.parenthesized_declarator, | ||
$.identifier, | ||
), | ||
_field_declarator: $ => choice( | ||
@@ -456,4 +468,17 @@ alias($.attributed_field_declarator, $.attributed_declarator), | ||
optional($.gnu_asm_expression), | ||
repeat(choice( | ||
$.attribute_specifier, | ||
$.identifier, | ||
alias($.preproc_call_expression, $.call_expression), | ||
)), | ||
)), | ||
_function_declaration_declarator: $ => prec.right(1, | ||
seq( | ||
field('declarator', $._declarator), | ||
field('parameters', $.parameter_list), | ||
optional($.gnu_asm_expression), | ||
repeat($.attribute_specifier), | ||
)), | ||
function_field_declarator: $ => prec(1, seq( | ||
@@ -631,2 +656,3 @@ field('declarator', $._field_declarator), | ||
alias($.preproc_ifdef_in_enumerator_list, $.preproc_ifdef), | ||
seq($.preproc_call, ','), | ||
)), | ||
@@ -638,2 +664,3 @@ optional(seq( | ||
alias($.preproc_ifdef_in_enumerator_list_no_comma, $.preproc_ifdef), | ||
$.preproc_call, | ||
), | ||
@@ -918,7 +945,6 @@ )), | ||
$.number_literal, | ||
$.string_literal, | ||
$._string, | ||
$.true, | ||
$.false, | ||
$.null, | ||
$.concatenated_string, | ||
$.char_literal, | ||
@@ -929,2 +955,7 @@ $.parenthesized_expression, | ||
_string: $ => prec.left(choice( | ||
$.string_literal, | ||
$.concatenated_string, | ||
)), | ||
comma_expression: $ => seq( | ||
@@ -1079,3 +1110,3 @@ field('left', $._expression), | ||
'(', | ||
field('assembly_code', choice($.string_literal, $.concatenated_string)), | ||
field('assembly_code', $._string), | ||
optional(seq( | ||
@@ -1242,6 +1273,11 @@ field('output_operands', $.gnu_asm_output_operand_list), | ||
// Must concatenate at least 2 nodes, one of which must be a string_literal. | ||
// Identifier is added to parse macros that are strings, like PRIu64. | ||
concatenated_string: $ => prec.right(seq( | ||
choice($.identifier, $.string_literal), | ||
$.string_literal, | ||
repeat(choice($.string_literal, $.identifier)), // Identifier is added to parse macros that are strings, like PRIu64 | ||
choice( | ||
seq($.identifier, $.string_literal), | ||
seq($.string_literal, $.string_literal), | ||
seq($.string_literal, $.identifier), | ||
), | ||
repeat(choice($.string_literal, $.identifier)), | ||
)), | ||
@@ -1351,2 +1387,13 @@ | ||
/** | ||
* | ||
* @param {GrammarSymbols<string>} $ | ||
* | ||
* @return {AliasRule | SymbolRule<string>} | ||
* | ||
*/ | ||
function elifBlock($) { | ||
return suffix ? alias($['preproc_elifdef' + suffix], $.preproc_elifdef) : $.preproc_elifdef; | ||
} | ||
return { | ||
@@ -1366,3 +1413,3 @@ ['preproc_if' + suffix]: $ => prec(precedence, seq( | ||
repeat(content($)), | ||
field('alternative', optional(choice(elseBlock($), $.preproc_elifdef))), | ||
field('alternative', optional(choice(elseBlock($), elifBlock($)))), | ||
preprocessor('endif'), | ||
@@ -1369,0 +1416,0 @@ )), |
{ | ||
"name": "tree-sitter-c", | ||
"version": "0.20.7", | ||
"version": "0.20.8", | ||
"description": "C grammar for node-tree-sitter", | ||
@@ -5,0 +5,0 @@ "main": "bindings/node", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4944964
15243