From bbde8cd9c5f30b3a8d95758de6fa6ad5d5ec3606 Mon Sep 17 00:00:00 2001 From: Amaan Qureshi Date: Sun, 18 Feb 2024 06:54:02 -0500 Subject: [PATCH] chore: update tree-sitter-c --- grammar.js | 14 ++++++++++++++ package.json | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/grammar.js b/grammar.js index abbc054..4430b9f 100644 --- a/grammar.js +++ b/grammar.js @@ -224,6 +224,20 @@ module.exports = grammar(C, { field('body', choice(e.content, $.try_statement))), }), + declaration: $ => seq( + $._declaration_specifiers, + commaSep1(field('declarator', choice( + seq( + // C uses _declaration_declarator here for some nice macro parsing in function declarators, + // but this causes a world of pain for C++ so we'll just stick to the normal _declarator here. + $._declarator, + optional($.gnu_asm_expression), + ), + $.init_declarator, + ))), + ';', + ), + virtual_specifier: _ => choice( 'final', // the only legal value here for classes 'override', // legal for functions in addition to final, plus permutations. diff --git a/package.json b/package.json index 50ef5fe..24c8f52 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "devDependencies": { "eslint": "^8.56.0", "eslint-config-google": "^0.14.0", - "tree-sitter-c": "^0.20.7", + "tree-sitter-c": "^0.20.8", "tree-sitter-cli": "^0.20.8", "node-gyp": "^10.0.1" },