Skip to content

Commit

Permalink
fix: proper function prototypes
Browse files Browse the repository at this point in the history
  • Loading branch information
ObserverOfTime committed Mar 24, 2024
1 parent e6d7fa7 commit be7f3d1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cli/src/generate/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1355,7 +1355,7 @@ impl Generator {

add_line!(
self,
"TS_PUBLIC const TSLanguage *{language_function_name}() {{",
"TS_PUBLIC const TSLanguage *{language_function_name}(void) {{",
);
indent!(self);
add_line!(self, "static const TSLanguage language = {{");
Expand Down
6 changes: 3 additions & 3 deletions docs/section-3-creating-parsers.md
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ Finally, you must define five functions with specific names, based on your langu
#### Create

```c
void * tree_sitter_my_language_external_scanner_create() {
void *tree_sitter_my_language_external_scanner_create(void) {
// ...
}
```
Expand Down Expand Up @@ -891,7 +891,7 @@ For example, assuming you wanted to allocate 100 bytes for your scanner, you'd d

// ...

void* tree_sitter_my_language_external_scanner_create() {
void *tree_sitter_my_language_external_scanner_create(void) {
return ts_calloc(100, 1); // or ts_malloc(100)
}

Expand Down Expand Up @@ -921,7 +921,7 @@ enum TokenType {
// Create the array in your create function
void* tree_sitter_my_language_external_scanner_create() {
void *tree_sitter_my_language_external_scanner_create(void) {
return ts_calloc(1, sizeof(Array(int)));
// or if you want to zero out the memory yourself
Expand Down

0 comments on commit be7f3d1

Please sign in to comment.