Skip to content

Commit

Permalink
Add support for C3 0.6.7 syntax.
Browse files Browse the repository at this point in the history
  • Loading branch information
cbuttner committed Jan 30, 2025
1 parent 10a78fb commit dabb1c5
Show file tree
Hide file tree
Showing 7 changed files with 135,256 additions and 116,342 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# tree-sitter-c3 Changelog

## 0.2.4

### Changes

- Added experimental `[?]` and `<[ ]>` syntax for C3 0.6.7

## 0.2.3

### Changes
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# tree-sitter-c3
This is a complete implementation of the current C3 grammar for tree-sitter, usable for syntax highlighting, indentation, folding, code analysis, header/doc generation, and more.

The latest version supports C3 0.6.5 and is not compatible with C3 < 0.6.4.
The latest version supports C3 0.6.7 and is not compatible with C3 < 0.6.4.

### Playground
Check out the tree-sitter-c3 playground here: https://c3lang.github.io/tree-sitter-c3/
Expand Down
Binary file modified docs/playground/tree-sitter-c3.wasm
Binary file not shown.
11 changes: 9 additions & 2 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,10 @@ module.exports = grammar({
$._expr,
$.type,
)),
generic_arguments: $ => seq('(<', $._generic_arg_list, '>)'),
generic_arguments: $ => choice(
seq('(<', $._generic_arg_list, '>)'),
seq('<[', $._generic_arg_list, ']>'), // >= 0.6.7 (experimental)
),

// Helpers
// -------------------------
Expand Down Expand Up @@ -336,7 +339,10 @@ module.exports = grammar({
// Module
// -------------------------
_module_param: $ => choice($.const_ident, $.type_ident),
generic_module_parameters: $ => seq('(<', commaSep1($._module_param), '>)'),
generic_module_parameters: $ => choice(
seq('(<', commaSep1($._module_param), '>)'),
seq('<[', commaSep1($._module_param), ']>'),
),
module: $ => seq(
'module',
field('path', $.path_ident),
Expand Down Expand Up @@ -1463,6 +1469,7 @@ module.exports = grammar({
seq('[', $._expr, ']'),
seq('[', ']'),
seq('[', '*', ']'),
seq('[', '?', ']'), // >= 0.6.7 (experimental)
seq('[<', $._expr, '>]'),
seq('[<', '*', '>]'),
),
Expand Down
144 changes: 113 additions & 31 deletions src/grammar.json

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

8 changes: 8 additions & 0 deletions 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 dabb1c5

Please sign in to comment.