Skip to content

Commit

Permalink
Update the readme
Browse files Browse the repository at this point in the history
  • Loading branch information
irh committed Mar 4, 2024
1 parent 1df79ba commit 0088846
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
# tree-sitter-koto

[Tree-sitter](https://tree-sitter.github.io) parser for [Koto](https://koto.dev).
[Tree-sitter][tree-sitter] parser for [Koto][koto].

## Development

The [justfile][just] contains some commands that are
useful during development, in particular `just test` which will generate the
tree-sitter parser from [`grammar.js`](./grammar.js) and then run the tests
contained in [`test/corpus`](./test/corpus).

`just watch test` will re-run `just test` when files are updated.

Arguments can be passed to `just watch test`,
e.g. `just watch test --debug -f identifiers` will generate the parser with
debug logging enabled, and then run only the `identifiers` test.

[`src/scanner.c`](./src/scanner.c) contains the [external scanner][scanner] used
by the grammar, handling some of the more complex aspects of parsing Koto code.
Debug logging for the scanner can be enabled via a preprocesser definition at the
top of the file.

[koto]: https://koto.dev
[just]: https://github.com/casey/just
[tree-sitter]: https://tree-sitter.github.io
[scanner]: https://tree-sitter.github.io/tree-sitter/creating-parsers#external-scanners
1 change: 1 addition & 0 deletions src/scanner.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <stdio.h>
#include <string.h>

// Enable debug logging by setting the following line to `#if 0`
#if 1
#define printf(...)
#endif
Expand Down

0 comments on commit 0088846

Please sign in to comment.