style: correct typos

This commit is contained in:
Will Lillis 2024-12-23 02:11:09 -05:00 committed by GitHub
parent faf97b896a
commit 2a63077cac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 14 additions and 14 deletions

View file

@ -1078,7 +1078,7 @@ If you put terminal keywords in the `externals` array, for example `externals: $
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. 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.
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. 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.
External scanners are a common cause of infinite loops. External scanners are a common cause of infinite loops.
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. 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.

View file

@ -545,7 +545,7 @@ extern "C" {
pub fn ts_tree_cursor_goto_next_sibling(self_: *mut TSTreeCursor) -> bool; pub fn ts_tree_cursor_goto_next_sibling(self_: *mut TSTreeCursor) -> bool;
} }
extern "C" { extern "C" {
#[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."] #[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."]
pub fn ts_tree_cursor_goto_previous_sibling(self_: *mut TSTreeCursor) -> bool; pub fn ts_tree_cursor_goto_previous_sibling(self_: *mut TSTreeCursor) -> bool;
} }
extern "C" { extern "C" {
@ -681,7 +681,7 @@ extern "C" {
pub fn ts_query_cursor_exec(self_: *mut TSQueryCursor, query: *const TSQuery, node: TSNode); pub fn ts_query_cursor_exec(self_: *mut TSQueryCursor, query: *const TSQuery, node: TSNode);
} }
extern "C" { extern "C" {
#[doc = " Start running a gievn query on a given node, with some options."] #[doc = " Start running a given query on a given node, with some options."]
pub fn ts_query_cursor_exec_with_options( pub fn ts_query_cursor_exec_with_options(
self_: *mut TSQueryCursor, self_: *mut TSQueryCursor,
query: *const TSQuery, query: *const TSQuery,

View file

@ -377,7 +377,7 @@ enum TextPredicateCapture {
AnyString(u32, Box<[Box<str>]>, bool), AnyString(u32, Box<[Box<str>]>, bool),
} }
// TODO: Remove this struct at at some point. If `core::str::lossy::Utf8Lossy` // TODO: Remove this struct at some point. If `core::str::lossy::Utf8Lossy`
// is ever stabilized. // is ever stabilized.
pub struct LossyUtf8<'a> { pub struct LossyUtf8<'a> {
bytes: &'a [u8], bytes: &'a [u8],
@ -2155,7 +2155,7 @@ impl<'cursor> TreeCursor<'cursor> {
/// Note, that this function may be slower than /// Note, that this function may be slower than
/// [`goto_next_sibling`](TreeCursor::goto_next_sibling) due to how node /// [`goto_next_sibling`](TreeCursor::goto_next_sibling) due to how node
/// positions are stored. In the worst case, this will need to iterate /// positions are stored. In the worst case, this will need to iterate
/// through all the children upto the previous sibling node to recalculate /// through all the children up to the previous sibling node to recalculate
/// its position. /// its position.
#[doc(alias = "ts_tree_cursor_goto_previous_sibling")] #[doc(alias = "ts_tree_cursor_goto_previous_sibling")]
pub fn goto_previous_sibling(&mut self) -> bool { pub fn goto_previous_sibling(&mut self) -> bool {
@ -2445,7 +2445,7 @@ impl Query {
} }
} }
// Build a vector to store capture qunatifiers. // Build a vector to store capture quantifiers.
for i in 0..pattern_count { for i in 0..pattern_count {
let mut capture_quantifiers = Vec::with_capacity(capture_count as usize); let mut capture_quantifiers = Vec::with_capacity(capture_count as usize);
for j in 0..capture_count { for j in 0..capture_count {

View file

@ -815,7 +815,7 @@ bool ts_tree_cursor_goto_next_sibling(TSTreeCursor *self);
* *
* Note, that this function may be slower than * Note, that this function may be slower than
* [`ts_tree_cursor_goto_next_sibling`] due to how node positions are stored. In * [`ts_tree_cursor_goto_next_sibling`] due to how node positions are stored. In
* the worst case, this will need to iterate through all the children upto the * the worst case, this will need to iterate through all the children up to the
* previous sibling node to recalculate its position. * previous sibling node to recalculate its position.
*/ */
bool ts_tree_cursor_goto_previous_sibling(TSTreeCursor *self); bool ts_tree_cursor_goto_previous_sibling(TSTreeCursor *self);
@ -1044,7 +1044,7 @@ void ts_query_cursor_delete(TSQueryCursor *self);
void ts_query_cursor_exec(TSQueryCursor *self, const TSQuery *query, TSNode node); void ts_query_cursor_exec(TSQueryCursor *self, const TSQuery *query, TSNode node);
/** /**
* Start running a gievn query on a given node, with some options. * Start running a given query on a given node, with some options.
*/ */
void ts_query_cursor_exec_with_options( void ts_query_cursor_exec_with_options(
TSQueryCursor *self, TSQueryCursor *self,

View file

@ -123,7 +123,7 @@ typedef struct {
} SymbolTable; } SymbolTable;
/** /**
* CaptureQuantififers - a data structure holding the quantifiers of pattern captures. * CaptureQuantifiers - a data structure holding the quantifiers of pattern captures.
*/ */
typedef Array(uint8_t) CaptureQuantifiers; typedef Array(uint8_t) CaptureQuantifiers;

View file

@ -767,7 +767,7 @@ Subtree ts_subtree_edit(Subtree self, const TSInputEdit *input_edit, SubtreePool
// Keep editing child nodes until a node is reached that starts after the edit. // Keep editing child nodes until a node is reached that starts after the edit.
// Also, if this node's validity depends on its column position, then continue // Also, if this node's validity depends on its column position, then continue
// invaliditing child nodes until reaching a line break. // invalidating child nodes until reaching a line break.
if (( if ((
(child_left.bytes > edit.old_end.bytes) || (child_left.bytes > edit.old_end.bytes) ||
(child_left.bytes == edit.old_end.bytes && child_size.bytes > 0 && i > 0) (child_left.bytes == edit.old_end.bytes && child_size.bytes > 0 && i > 0)

View file

@ -40,8 +40,8 @@ pub struct TSTag {
pub line_end_byte: u32, pub line_end_byte: u32,
pub start_point: TSPoint, pub start_point: TSPoint,
pub end_point: TSPoint, pub end_point: TSPoint,
pub utf16_start_colum: u32, pub utf16_start_column: u32,
pub utf16_end_colum: u32, pub utf16_end_column: u32,
pub docs_start_byte: u32, pub docs_start_byte: u32,
pub docs_end_byte: u32, pub docs_end_byte: u32,
pub syntax_type_id: u32, pub syntax_type_id: u32,
@ -198,8 +198,8 @@ pub unsafe extern "C" fn ts_tagger_tag(
row: tag.span.end.row as u32, row: tag.span.end.row as u32,
column: tag.span.end.column as u32, column: tag.span.end.column as u32,
}, },
utf16_start_colum: tag.utf16_column_range.start as u32, utf16_start_column: tag.utf16_column_range.start as u32,
utf16_end_colum: tag.utf16_column_range.end as u32, utf16_end_column: tag.utf16_column_range.end as u32,
docs_start_byte: prev_docs_len as u32, docs_start_byte: prev_docs_len as u32,
docs_end_byte: buffer.docs.len() as u32, docs_end_byte: buffer.docs.len() as u32,
syntax_type_id: tag.syntax_type_id, syntax_type_id: tag.syntax_type_id,