Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tree-sitter-c

Package Overview
Dependencies
Maintainers
8
Versions
72
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tree-sitter-c - npm Package Compare versions

Comparing version 0.20.6 to 0.20.7

.github/ISSUE_TEMPLATE/bug_report.yml

2

bindings/rust/README.md

@@ -12,3 +12,3 @@ # tree-sitter-c

tree-sitter = "0.20.10"
tree-sitter-c = "0.20.6"
tree-sitter-c = "0.20.7"
```

@@ -15,0 +15,0 @@

@@ -25,8 +25,8 @@ /**

RELATIONAL: 7,
SIZEOF: 8,
OFFSETOF: 9,
SHIFT: 10,
ADD: 11,
MULTIPLY: 12,
CAST: 13,
OFFSETOF: 8,
SHIFT: 9,
ADD: 10,
MULTIPLY: 11,
CAST: 12,
SIZEOF: 13,
UNARY: 14,

@@ -64,2 +64,3 @@ CALL: 15,

[$._type_specifier, $.macro_type_specifier],
[$._type_specifier, $.sized_type_specifier],
[$.sized_type_specifier],

@@ -153,2 +154,4 @@ [$.attributed_statement],

...preprocIf('_in_field_declaration_list', $ => $._field_declaration_list_item),
...preprocIf('_in_enumerator_list', $ => seq($.enumerator, ',')),
...preprocIf('_in_enumerator_list_no_comma', $ => $.enumerator, -1),

@@ -549,13 +552,39 @@ preproc_arg: _ => token(prec(-1, /\S([^/\n]|\/[^*]|\\\r?\n)*/)),

sized_type_specifier: $ => seq(
repeat1(choice(
'signed',
'unsigned',
'long',
'short',
)),
field('type', optional(choice(
prec.dynamic(-1, $._type_identifier),
$.primitive_type,
))),
sized_type_specifier: $ => choice(
seq(
repeat(choice(
'signed',
'unsigned',
'long',
'short',
)),
field('type', optional(choice(
prec.dynamic(-1, $._type_identifier),
$.primitive_type,
))),
repeat1(choice(
'signed',
'unsigned',
'long',
'short',
)),
),
seq(
repeat1(choice(
'signed',
'unsigned',
'long',
'short',
)),
field('type', optional(choice(
prec.dynamic(-1, $._type_identifier),
$.primitive_type,
))),
repeat(choice(
'signed',
'unsigned',
'long',
'short',
)),
),
),

@@ -598,4 +627,14 @@

'{',
commaSep($.enumerator),
optional(','),
repeat(choice(
seq($.enumerator, ','),
alias($.preproc_if_in_enumerator_list, $.preproc_if),
alias($.preproc_ifdef_in_enumerator_list, $.preproc_ifdef),
)),
optional(seq(
choice(
$.enumerator,
alias($.preproc_if_in_enumerator_list_no_comma, $.preproc_if),
alias($.preproc_ifdef_in_enumerator_list_no_comma, $.preproc_ifdef),
),
)),
'}',

@@ -713,2 +752,4 @@ ),

$.goto_statement,
$.seh_try_statement,
$.seh_leave_statement,
),

@@ -832,2 +873,23 @@

seh_try_statement: $ => seq(
'__try',
field('body', $.compound_statement),
choice($.seh_except_clause, $.seh_finally_clause),
),
seh_except_clause: $ => seq(
'__except',
field('filter', $.parenthesized_expression),
field('body', $.compound_statement),
),
seh_finally_clause: $ => seq(
'__finally',
field('body', $.compound_statement),
),
seh_leave_statement: _ => seq(
'__leave', ';',
),
// Expressions

@@ -1115,6 +1177,17 @@

initializer_pair: $ => seq(
field('designator', repeat1(choice($.subscript_designator, $.field_designator))),
'=',
field('value', choice($._expression, $.initializer_list)),
initializer_pair: $ => choice(
seq(
field('designator', repeat1(choice(
$.subscript_designator,
$.field_designator,
$.subscript_range_designator,
))),
'=',
field('value', choice($._expression, $.initializer_list)),
),
seq(
field('designator', $._field_identifier),
':',
field('value', choice($._expression, $.initializer_list)),
),
),

@@ -1124,2 +1197,4 @@

subscript_range_designator: $ => seq('[', field('start', $._expression), '...', field('end', $._expression), ']'),
field_designator: $ => seq('.', $._field_identifier),

@@ -1160,14 +1235,14 @@

choice('L\'', 'u\'', 'U\'', 'u8\'', '\''),
choice(
repeat1(choice(
$.escape_sequence,
alias(token.immediate(/[^\n']/), $.character),
),
)),
'\'',
),
concatenated_string: $ => seq(
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
),
)),

@@ -1205,3 +1280,4 @@ string_literal: $ => seq(

identifier: _ =>
/(\p{XID_Start}|_|\\u[0-9A-Fa-f]{4}|\\U[0-9A-Fa-f]{8})(\p{XID_Continue}|\\u[0-9A-Fa-f]{4}|\\U[0-9A-Fa-f]{8})*/,
// eslint-disable-next-line max-len
/(\p{XID_Start}|\$|_|\\u[0-9A-Fa-f]{4}|\\U[0-9A-Fa-f]{8})(\p{XID_Continue}|\$|\\u[0-9A-Fa-f]{4}|\\U[0-9A-Fa-f]{8})*/,

@@ -1257,5 +1333,7 @@ _type_identifier: $ => alias(

*
* @param {number} precedence
*
* @return {RuleBuilders<string, string>}
*/
function preprocIf(suffix, content) {
function preprocIf(suffix, content, precedence = 0) {
/**

@@ -1276,3 +1354,3 @@ *

return {
['preproc_if' + suffix]: $ => seq(
['preproc_if' + suffix]: $ => prec(precedence, seq(
preprocessor('if'),

@@ -1284,5 +1362,5 @@ field('condition', $._preproc_expression),

preprocessor('endif'),
),
)),
['preproc_ifdef' + suffix]: $ => seq(
['preproc_ifdef' + suffix]: $ => prec(precedence, seq(
choice(preprocessor('ifdef'), preprocessor('ifndef')),

@@ -1293,10 +1371,10 @@ field('name', $.identifier),

preprocessor('endif'),
),
)),
['preproc_else' + suffix]: $ => seq(
['preproc_else' + suffix]: $ => prec(precedence, seq(
preprocessor('else'),
repeat(content($)),
),
)),
['preproc_elif' + suffix]: $ => seq(
['preproc_elif' + suffix]: $ => prec(precedence, seq(
preprocessor('elif'),

@@ -1307,5 +1385,5 @@ field('condition', $._preproc_expression),

field('alternative', optional(elseBlock($))),
),
)),
['preproc_elifdef' + suffix]: $ => seq(
['preproc_elifdef' + suffix]: $ => prec(precedence, seq(
choice(preprocessor('elifdef'), preprocessor('elifndef')),

@@ -1315,3 +1393,3 @@ field('name', $.identifier),

field('alternative', optional(elseBlock($))),
),
)),
};

@@ -1318,0 +1396,0 @@ }

{
"name": "tree-sitter-c",
"version": "0.20.6",
"version": "0.20.7",
"description": "C grammar for node-tree-sitter",

@@ -8,3 +8,4 @@ "main": "bindings/node",

"parser",
"lexer"
"lexer",
"c"
],

@@ -15,9 +16,12 @@ "repository": {

},
"author": "Max Brunsfeld",
"author": "Max Brunsfeld <maxbrunsfeld@gmail.com>",
"contributors": [
"Amaan Qureshi <amaanq12@gmail.com>"
],
"license": "MIT",
"dependencies": {
"nan": "^2.17.0"
"nan": "^2.18.0"
},
"devDependencies": {
"eslint": "^8.46.0",
"eslint": "^8.56.0",
"eslint-config-google": "^0.14.0",

@@ -24,0 +28,0 @@ "tree-sitter-cli": "^0.20.8"

# tree-sitter-c
[![CI](https://github.com/tree-sitter/tree-sitter-c/actions/workflows/ci.yml/badge.svg)](https://github.com/tree-sitter/tree-sitter-c/actions/workflows/ci.yml)
[![Discord](https://img.shields.io/discord/1063097320771698699?logo=discord)](https://discord.gg/w7nTvsVJhm)
[![Rust Crate](https://img.shields.io/crates/v/tree-sitter-c.svg)](https://crates.io/crates/tree-sitter-c)
[![Node Package](https://img.shields.io/npm/v/tree-sitter-c.svg)](https://www.npmjs.com/package/tree-sitter-c)
C grammar for [tree-sitter](https://github.com/tree-sitter/tree-sitter).
Adapted from [this C99 grammar](http://slps.github.io/zoo/c/iso-9899-tc3.html).

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc