Skip to content

Commit 2a63077

Browse files
authored
style: correct typos
1 parent faf97b8 commit 2a63077

File tree

7 files changed

+14
-14
lines changed

7 files changed

+14
-14
lines changed

docs/section-3-creating-parsers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1078,7 +1078,7 @@ If you put terminal keywords in the `externals` array, for example `externals: $
10781078

10791079
If in the `externals` array use literal keywords then lexing works in two steps, the external scanner will be called first and if it sets a resulting token and returns `true` then the token considered as recognized and Tree-sitter moves to a next token. But the external scanner may return `false` and in this case Tree-sitter fallbacks to the internal lexing mechanism.
10801080

1081-
In case of some keywords defined in the `externals` array in a rule referencing form like `$.if_keyword` and there is no additional definition of that rule in the grammar rules, e.g., `if_keyword: $ => 'if'` then fallback to the internal lexer isn't possible because Tree-sitter doesn't know the actual keyword and it's fully the external scanner resposibilty to recognize such tokens.
1081+
In case of some keywords defined in the `externals` array in a rule referencing form like `$.if_keyword` and there is no additional definition of that rule in the grammar rules, e.g., `if_keyword: $ => 'if'` then fallback to the internal lexer isn't possible because Tree-sitter doesn't know the actual keyword and it's fully the external scanner responsibilty to recognize such tokens.
10821082

10831083
External scanners are a common cause of infinite loops.
10841084
Be very careful when emitting zero-width tokens from your external scanner, and if you consume characters in a loop be sure use the `eof` function to check whether you are at the end of the file.

lib/binding_rust/bindings.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ extern "C" {
545545
pub fn ts_tree_cursor_goto_next_sibling(self_: *mut TSTreeCursor) -> bool;
546546
}
547547
extern "C" {
548-
#[doc = " Move the cursor to the previous sibling of its current node.\n\n This returns `true` if the cursor successfully moved, and returns `false` if\n there was no previous sibling node.\n\n Note, that this function may be slower than\n [`ts_tree_cursor_goto_next_sibling`] due to how node positions are stored. In\n the worst case, this will need to iterate through all the children upto the\n previous sibling node to recalculate its position."]
548+
#[doc = " Move the cursor to the previous sibling of its current node.\n\n This returns `true` if the cursor successfully moved, and returns `false` if\n there was no previous sibling node.\n\n Note, that this function may be slower than\n [`ts_tree_cursor_goto_next_sibling`] due to how node positions are stored. In\n the worst case, this will need to iterate through all the children up to the\n previous sibling node to recalculate its position."]
549549
pub fn ts_tree_cursor_goto_previous_sibling(self_: *mut TSTreeCursor) -> bool;
550550
}
551551
extern "C" {
@@ -681,7 +681,7 @@ extern "C" {
681681
pub fn ts_query_cursor_exec(self_: *mut TSQueryCursor, query: *const TSQuery, node: TSNode);
682682
}
683683
extern "C" {
684-
#[doc = " Start running a gievn query on a given node, with some options."]
684+
#[doc = " Start running a given query on a given node, with some options."]
685685
pub fn ts_query_cursor_exec_with_options(
686686
self_: *mut TSQueryCursor,
687687
query: *const TSQuery,

lib/binding_rust/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ enum TextPredicateCapture {
377377
AnyString(u32, Box<[Box<str>]>, bool),
378378
}
379379

380-
// TODO: Remove this struct at at some point. If `core::str::lossy::Utf8Lossy`
380+
// TODO: Remove this struct at some point. If `core::str::lossy::Utf8Lossy`
381381
// is ever stabilized.
382382
pub struct LossyUtf8<'a> {
383383
bytes: &'a [u8],
@@ -2155,7 +2155,7 @@ impl<'cursor> TreeCursor<'cursor> {
21552155
/// Note, that this function may be slower than
21562156
/// [`goto_next_sibling`](TreeCursor::goto_next_sibling) due to how node
21572157
/// positions are stored. In the worst case, this will need to iterate
2158-
/// through all the children upto the previous sibling node to recalculate
2158+
/// through all the children up to the previous sibling node to recalculate
21592159
/// its position.
21602160
#[doc(alias = "ts_tree_cursor_goto_previous_sibling")]
21612161
pub fn goto_previous_sibling(&mut self) -> bool {
@@ -2445,7 +2445,7 @@ impl Query {
24452445
}
24462446
}
24472447

2448-
// Build a vector to store capture qunatifiers.
2448+
// Build a vector to store capture quantifiers.
24492449
for i in 0..pattern_count {
24502450
let mut capture_quantifiers = Vec::with_capacity(capture_count as usize);
24512451
for j in 0..capture_count {

lib/include/tree_sitter/api.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -815,7 +815,7 @@ bool ts_tree_cursor_goto_next_sibling(TSTreeCursor *self);
815815
*
816816
* Note, that this function may be slower than
817817
* [`ts_tree_cursor_goto_next_sibling`] due to how node positions are stored. In
818-
* the worst case, this will need to iterate through all the children upto the
818+
* the worst case, this will need to iterate through all the children up to the
819819
* previous sibling node to recalculate its position.
820820
*/
821821
bool ts_tree_cursor_goto_previous_sibling(TSTreeCursor *self);
@@ -1044,7 +1044,7 @@ void ts_query_cursor_delete(TSQueryCursor *self);
10441044
void ts_query_cursor_exec(TSQueryCursor *self, const TSQuery *query, TSNode node);
10451045

10461046
/**
1047-
* Start running a gievn query on a given node, with some options.
1047+
* Start running a given query on a given node, with some options.
10481048
*/
10491049
void ts_query_cursor_exec_with_options(
10501050
TSQueryCursor *self,

lib/src/query.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ typedef struct {
123123
} SymbolTable;
124124

125125
/**
126-
* CaptureQuantififers - a data structure holding the quantifiers of pattern captures.
126+
* CaptureQuantifiers - a data structure holding the quantifiers of pattern captures.
127127
*/
128128
typedef Array(uint8_t) CaptureQuantifiers;
129129

lib/src/subtree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,7 @@ Subtree ts_subtree_edit(Subtree self, const TSInputEdit *input_edit, SubtreePool
767767

768768
// Keep editing child nodes until a node is reached that starts after the edit.
769769
// Also, if this node's validity depends on its column position, then continue
770-
// invaliditing child nodes until reaching a line break.
770+
// invalidating child nodes until reaching a line break.
771771
if ((
772772
(child_left.bytes > edit.old_end.bytes) ||
773773
(child_left.bytes == edit.old_end.bytes && child_size.bytes > 0 && i > 0)

tags/src/c_lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ pub struct TSTag {
4040
pub line_end_byte: u32,
4141
pub start_point: TSPoint,
4242
pub end_point: TSPoint,
43-
pub utf16_start_colum: u32,
44-
pub utf16_end_colum: u32,
43+
pub utf16_start_column: u32,
44+
pub utf16_end_column: u32,
4545
pub docs_start_byte: u32,
4646
pub docs_end_byte: u32,
4747
pub syntax_type_id: u32,
@@ -198,8 +198,8 @@ pub unsafe extern "C" fn ts_tagger_tag(
198198
row: tag.span.end.row as u32,
199199
column: tag.span.end.column as u32,
200200
},
201-
utf16_start_colum: tag.utf16_column_range.start as u32,
202-
utf16_end_colum: tag.utf16_column_range.end as u32,
201+
utf16_start_column: tag.utf16_column_range.start as u32,
202+
utf16_end_column: tag.utf16_column_range.end as u32,
203203
docs_start_byte: prev_docs_len as u32,
204204
docs_end_byte: buffer.docs.len() as u32,
205205
syntax_type_id: tag.syntax_type_id,

0 commit comments

Comments
 (0)