Skip to content

Commit

Permalink
Merge pull request #2 from PgBiel/tree-sitter-c3-0.2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
AineeJames authored Jan 29, 2025
2 parents 127ec44 + 35df0f3 commit 3d45864
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 3 deletions.
2 changes: 1 addition & 1 deletion extension.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ language = "C3"

[grammars.c3]
repository = "https://github.com/c3lang/tree-sitter-c3"
commit = "790a0326833cd647e00d8dec01268aa1ec2e3bdb"
commit = "10a78fbf8d3095369d32bc99840487396d899899"
4 changes: 4 additions & 0 deletions languages/c3/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,8 @@ brackets = [
"string",
"comment",
] },
{ start = "<*", end = " *>", close = true, newline = true, not_in = [
"string",
"comment",
] }
]
13 changes: 11 additions & 2 deletions languages/c3/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
(initializer_list (arg (param_path (param_path_element (ident) @variable.member))))
;; 2) Parameter
(parameter name: (_) @variable.parameter)
(call_invocation (arg (param_path (param_path_element [(ident) (ct_ident)] @variable.parameter))))
(call_invocation (call_arg (ident) @variable.parameter))
(enum_param_declaration (ident) @variable.parameter)
;; 3) Declaration
(global_declaration (ident) @variable.declaration)
Expand Down Expand Up @@ -320,4 +320,13 @@
(block_comment)
] @comment

(doc_comment) @comment.documentation
(doc_comment) @comment.doc
(doc_comment_text) @comment.doc
(doc_comment_contract name: (_) @emphasis.strong
(#any-of? @emphasis.strong
"@param"
"@return"
"@deprecated"
"@require"
"@ensure"
"@pure"))
15 changes: 15 additions & 0 deletions test.c3
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,21 @@ fn String Person.as_str(Person* self) @dynamic
return str.copy_str();
}

<*
Factorial.
@pure
@param i
@require i >= 0
@ensure return >= 1
*>
fn int fact(int i = 0) {
if (i == 0) {
return 1;
} else {
return i * fact(i: i - 1);
}
}

fn void main()
{
Person p = {
Expand Down

0 comments on commit 3d45864

Please sign in to comment.