Skip to content

Commit be514ee

Browse files
author
sogaiu
committed
Update what and why docs again
1 parent abe937c commit be514ee

File tree

1 file changed

+24
-20
lines changed

1 file changed

+24
-20
lines changed

doc/what-and-why.md

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ not meant to reflect relative importance.
2828
* `package.json` - this file is needed by a
2929
[component](https://github.com/cursorless-dev/vscode-parse-tree/) of
3030
[Cursorless](https://www.cursorless.org/). It uses our grammar via
31-
yarn and `package.json` seems to be essential [1].
31+
yarn and `package.json` seems to be essential.
3232

3333
* `queries` - this directory and the simple file it contains are
3434
provided on request from
@@ -38,7 +38,7 @@ not meant to reflect relative importance.
3838

3939
* `README.md` - this file contains the repository's README content.
4040

41-
* `src` - this directory contains source files that are generated [2]
41+
* `src` - this directory contains source files that are generated [1]
4242
from `grammar.js`. The files are typically used to generate a
4343
dynamic library / shared object that can be used by the tree-sitter
4444
library to handle Clojure / ClojureScript source code. Although the
@@ -68,29 +68,33 @@ They should be straight-forward to generate as long as one has a
6868
suitable `tree-sitter` cli and the `grammar.js` file mentioned above.
6969

7070
Binding code used to be created by the `generate` subcommand, but this
71-
may have changed. According to [this
72-
documentation](https://tree-sitter.github.io/tree-sitter/cli/init.html#the-bindings-field),
73-
it is the `init` subcommand that will generate them based on values
74-
specified in `tree-sitter.json`. Probably it's better to consult the
75-
official documentation and/or ask around about what the latest
76-
procedure is though.
71+
appears to have [changed from version 0.24.0 of the `tree-sitter`
72+
cli](https://github.com/tree-sitter/tree-sitter/releases/tag/v0.24.0):
7773

78-
## Footnotes
74+
> Move generation of grammar files to an init command ([#3694](https://github.com/tree-sitter/tree-sitter/pull/3694))
75+
76+
Note that "grammar files" here seems to refer to "bindings" files.
77+
78+
Further evidence in support of this change is [this
79+
documentation](https://tree-sitter.github.io/tree-sitter/cli/init.html#binding-files):
7980

80-
[1] The file `package.json` may also be required if it's important to
81-
use some of the capabilities of the `tree-sitter` cli such as the
82-
`tags` and `highlight` subcommands (which we don't typically use).
81+
> When you run tree-sitter init, the CLI will also generate a number
82+
> of files in your repository that allow for your parser to be used
83+
> from different language.
8384
84-
It's not necessary for all subcommands though (e.g. neither the
85-
`generate` nor `test` subcommands seem to require it). Its presence
86-
also doesn't signify necessary use of `npm`.
85+
Which languages bindings files are generated for is affected by [the
86+
`bindings` field in
87+
`tree-sitter.json`](https://tree-sitter.github.io/tree-sitter/cli/init.html#the-bindings-field).
88+
(It appears that omitting the field means "don't generate any
89+
bindings".)
8790

88-
Possibly contrary to what might be indicated elsewhere, `npm` is
89-
not necessary for certain core parts of tree-sitter grammar
90-
development. However, at the moment, an appropriate version of `node`
91-
_is_ required for the `generate` subcommand to work.
91+
Probably it's better to consult the official documentation and/or ask
92+
around about what the latest procedure is rather than rely on these
93+
brief notes though.
94+
95+
## Footnotes
9296

93-
[2] If the grammar uses an external scanner, `src` may contain
97+
[1] If the grammar uses an external scanner, `src` may contain
9498
non-generated files such as `scanner.c`, `scanner.cc`, etc. In the
9599
current case, no external scanner is used and the `src` directory
96100
content is entirely generated.

0 commit comments

Comments
 (0)