Skip to content

Commit 9ccfd64

Browse files
authored
Merge pull request tree-sitter#2190 from tree-sitter/fix-docs
chore(docs): fix misprint repetitions and remove dangling spaces
2 parents 2869cdc + 1f051d3 commit 9ccfd64

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

docs/section-3-creating-parsers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ npm install --save nan
4646
npm install --save-dev tree-sitter-cli
4747
```
4848

49-
The last command will install the CLI into the `node_modules` folder in your working directory. An executable program called `tree-sitter` will be created inside of `node_modules/.bin/`. You may want to follow the Node.js convention of adding that folder to your your `PATH` so that you can easily run this program when working in this directory.
49+
The last command will install the CLI into the `node_modules` folder in your working directory. An executable program called `tree-sitter` will be created inside of `node_modules/.bin/`. You may want to follow the Node.js convention of adding that folder to your `PATH` so that you can easily run this program when working in this directory.
5050

5151
```sh
5252
# In your shell profile script

docs/section-5-implementation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ The `tree-sitter` CLI's most important feature is the `generate` subcommand. Thi
2121

2222
### Parsing a Grammar
2323

24-
First, Tree-sitter must must evaluate the JavaScript code in `grammar.js` and convert the grammar to a JSON format. It does this by shelling out to `node`. The format of the grammars is formally specified by the JSON schema in [grammar-schema.json](https://github.com/tree-sitter/tree-sitter/blob/master/cli/src/generate/grammar-schema.json). The parsing is implemented in [parse_grammar.rs](https://github.com/tree-sitter/tree-sitter/blob/master/cli/src/generate/parse_grammar.rs).
24+
First, Tree-sitter must evaluate the JavaScript code in `grammar.js` and convert the grammar to a JSON format. It does this by shelling out to `node`. The format of the grammars is formally specified by the JSON schema in [grammar-schema.json](https://github.com/tree-sitter/tree-sitter/blob/master/cli/src/generate/grammar-schema.json). The parsing is implemented in [parse_grammar.rs](https://github.com/tree-sitter/tree-sitter/blob/master/cli/src/generate/parse_grammar.rs).
2525

2626
### Grammar Rules
2727

lib/binding_web/README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ WebAssembly bindings to the [Tree-sitter](https://github.com/tree-sitter/tree-si
55

66
### Setup
77

8-
You can download the the `tree-sitter.js` and `tree-sitter.wasm` files from [the latest GitHub release](https://github.com/tree-sitter/tree-sitter/releases/latest) and load them using a standalone script:
8+
You can download the `tree-sitter.js` and `tree-sitter.wasm` files from [the latest GitHub release](https://github.com/tree-sitter/tree-sitter/releases/latest) and load them using a standalone script:
99

1010
```html
1111
<script src="/the/path/to/tree-sitter.js"/>
@@ -116,7 +116,7 @@ First install `tree-sitter-cli` and the tree-sitter language for which to genera
116116
npm install --save-dev tree-sitter-cli tree-sitter-javascript
117117
```
118118

119-
Then just use tree-sitter cli tool to generate the `.wasm`.
119+
Then just use tree-sitter cli tool to generate the `.wasm`.
120120

121121
```sh
122122
npx tree-sitter build-wasm node_modules/tree-sitter-javascript
@@ -147,13 +147,13 @@ const Parser = require('web-tree-sitter');
147147

148148
##### Loading the .wasm file
149149

150-
`web-tree-sitter` needs to load the `tree-sitter.wasm` file. By default, it assumes that this file is available in the
150+
`web-tree-sitter` needs to load the `tree-sitter.wasm` file. By default, it assumes that this file is available in the
151151
same path as the JavaScript code. Therefore, if the code is being served from `http://localhost:3000/bundle.js`, then
152152
the wasm file should be at `http://localhost:3000/tree-sitter.wasm`.
153153

154-
For server side frameworks like NextJS, this can be tricky as pages are often served from a path such as
154+
For server side frameworks like NextJS, this can be tricky as pages are often served from a path such as
155155
`http://localhost:3000/_next/static/chunks/pages/index.js`. The loader will therefore look for the wasm file at
156-
`http://localhost:3000/_next/static/chunks/pages/tree-sitter.wasm`. The solution is to pass a `locateFile` function in
156+
`http://localhost:3000/_next/static/chunks/pages/tree-sitter.wasm`. The solution is to pass a `locateFile` function in
157157
the `moduleOptions` argument to `Parser.init()`:
158158

159159
```javascript
@@ -164,15 +164,15 @@ await Parser.init({
164164
});
165165
```
166166

167-
`locateFile` takes in two parameters, `scriptName`, i.e. the wasm file name, and `scriptDirectory`, i.e. the directory
167+
`locateFile` takes in two parameters, `scriptName`, i.e. the wasm file name, and `scriptDirectory`, i.e. the directory
168168
where the loader expects the script to be. It returns the path where the loader will look for the wasm file. In the NextJS
169169
case, we want to return just the `scriptName` so that the loader will look at `http://localhost:3000/tree-sitter.wasm`
170170
and not `http://localhost:3000/_next/static/chunks/pages/tree-sitter.wasm`.
171171

172172
##### `Can't resolve 'fs' in 'node_modules/web-tree-sitter'`
173173

174-
Most bundlers will notice that the `tree-sitter.js` file is attempting to import `fs`, i.e. node's file system library.
175-
Since this doesn't exist in the browser, the bundlers will get confused. For webpack you can fix this by adding the
174+
Most bundlers will notice that the `tree-sitter.js` file is attempting to import `fs`, i.e. node's file system library.
175+
Since this doesn't exist in the browser, the bundlers will get confused. For webpack you can fix this by adding the
176176
following to your webpack config:
177177

178178
```javascript

0 commit comments

Comments
 (0)