Skip to content

Commit 68615a3

Browse files
committed
Fix punctuation and doc style in treesit.c
* src/treesit.c (Ftreesit_parser_included_ranges) (Ftreesit_query_capture, treesit_traverse_sibling_helper) (treesit_traverse_match_predicate): Fix punctiation and documentation style in comments and docstrings.
1 parent 00adee8 commit 68615a3

File tree

1 file changed

+17
-18
lines changed

1 file changed

+17
-18
lines changed

src/treesit.c

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ init_treesit_functions (void)
404404
buffer's parser list. The discussion can be found in bug#59693. */
405405

406406

407-
/*** Initialization */
407+
/*** Initialization */
408408

409409
static Lisp_Object Vtreesit_str_libtree_sitter;
410410
static Lisp_Object Vtreesit_str_tree_sitter;
@@ -431,7 +431,7 @@ static Lisp_Object Vtreesit_str_pred;
431431
functions. Remember to update docstrings when changing this value.
432432
433433
If we think of programs and AST, it is very rare for any program to
434-
have a very deep AST. For example, you would need 1000+ levels of
434+
have a very deep AST. For example, you would need 1000+ levels of
435435
nested if-statements, or a struct somehow nested for 1000+ levels.
436436
It's hard for me to imagine any hand-written or machine generated
437437
program to be like that. So I think 1000 is already generous. If
@@ -485,10 +485,9 @@ treesit_initialize (void)
485485
}
486486

487487

488-
/*** Loading language library */
488+
/*** Loading language library */
489489

490-
/* Translates a symbol treesit-<lang> to a C name
491-
treesit_<lang>. */
490+
/* Translate a symbol treesit-<lang> to a C name treesit_<lang>. */
492491
static void
493492
treesit_symbol_to_c_name (char *symbol_name)
494493
{
@@ -758,7 +757,7 @@ Return nil if a grammar library for LANGUAGE is not available. */)
758757
}
759758

760759

761-
/*** Parsing functions */
760+
/*** Parsing functions */
762761

763762
static void
764763
treesit_check_parser (Lisp_Object obj)
@@ -873,7 +872,7 @@ treesit_record_change (ptrdiff_t start_byte, ptrdiff_t old_end_byte,
873872
}
874873
}
875874

876-
/* Comment (ref:visible-beg-null) The purpose of visible_beg/end is to
875+
/* Comment (ref:visible-beg-null) The purpose of visible_beg/end is to
877876
keep track of "which part of the buffer does the tree-sitter tree
878877
see", in order to update the tree correctly. Visible_beg/end have
879878
two purposes: they "clip" buffer changes within them, and they
@@ -1150,7 +1149,7 @@ treesit_read_buffer (void *parser, uint32_t byte_index,
11501149
}
11511150

11521151

1153-
/*** Functions for parser and node object */
1152+
/*** Functions for parser and node object */
11541153

11551154
/* Wrap the parser in a Lisp_Object to be used in the Lisp
11561155
machine. */
@@ -1566,7 +1565,7 @@ treesit_parser_live_p (Lisp_Object parser)
15661565
}
15671566

15681567

1569-
/*** Parser API */
1568+
/*** Parser API */
15701569

15711570
DEFUN ("treesit-parser-root-node",
15721571
Ftreesit_parser_root_node, Streesit_parser_root_node,
@@ -1739,7 +1738,7 @@ See also `treesit-parser-set-included-ranges'. */)
17391738

17401739
/* When the parser doesn't have a range set and we call
17411740
ts_parser_included_ranges on it, it doesn't return an empty list,
1742-
but rather return DEFAULT_RANGE. (A single range where start_byte
1741+
but rather return DEFAULT_RANGE. (A single range where start_byte
17431742
= 0, end_byte = UINT32_MAX). So we need to track whether the
17441743
parser is ranged ourselves. */
17451744
if (NILP (XTS_PARSER (parser)->last_set_ranges))
@@ -1842,8 +1841,8 @@ treesit_check_node (Lisp_Object obj)
18421841
xsignal1 (Qtreesit_node_buffer_killed, obj);
18431842
}
18441843

1845-
/* Checks that OBJ is a positive integer and it is within the visible
1846-
portion of BUF. */
1844+
/* Check that OBJ is a positive integer and it is within the visible
1845+
portion of BUF. */
18471846
static void
18481847
treesit_check_position (Lisp_Object obj, struct buffer *buf)
18491848
{
@@ -2360,7 +2359,7 @@ produced by tree-sitter. */)
23602359
}
23612360

23622361

2363-
/*** Query functions */
2362+
/*** Query functions */
23642363

23652364
/* Convert a Lisp string to its printed representation in the tree-sitter
23662365
query syntax. */
@@ -2998,7 +2997,7 @@ the query. */)
29982997
test for predicates. If predicates pass, then all good, if
29992998
predicates don't pass, revert the result back to the result
30002999
before this loop (PREV_RESULT). (Predicates control the entire
3001-
match.) This way we don't need to create a list of captures in
3000+
match.) This way we don't need to create a list of captures in
30023001
every for loop and nconc it to RESULT every time. That is indeed
30033002
the initial implementation in which Yoav found nconc being the
30043003
bottleneck (98.4% of the running time spent on nconc). */
@@ -3076,7 +3075,7 @@ the query. */)
30763075
}
30773076

30783077

3079-
/*** Navigation */
3078+
/*** Navigation */
30803079

30813080
static inline void
30823081
treesit_assume_true (bool val)
@@ -3193,7 +3192,7 @@ treesit_traverse_sibling_helper (TSTreeCursor *cursor,
31933192
if (ts_node_eq (first_child, start))
31943193
return false;
31953194

3196-
/* PROBE is always DELTA siblings ahead of CURSOR. */
3195+
/* PROBE is always DELTA siblings ahead of CURSOR. */
31973196
TSTreeCursor probe = ts_tree_cursor_copy (cursor);
31983197
/* This is position of PROBE minus position of CURSOR. */
31993198
ptrdiff_t delta = 0;
@@ -3477,7 +3476,7 @@ treesit_traverse_match_predicate (TSTreeCursor *cursor, Lisp_Object pred,
34773476
return true;
34783477
}
34793478
}
3480-
/* Returning false is better than UB. */
3479+
/* Returning false is better than UB. */
34813480
return false;
34823481
}
34833482

@@ -3990,7 +3989,7 @@ DEFUN ("treesit-available-p", Ftreesit_available_p,
39903989
}
39913990

39923991

3993-
/*** Initialization */
3992+
/*** Initialization */
39943993

39953994
/* Initialize the tree-sitter routines. */
39963995
void

0 commit comments

Comments
 (0)