@group
;; Find the node at point in a C parser's syntax tree.
(treesit-node-at (point) 'c)
- @result{} #<treesit-node (primitive_type) in *scratch*>
+ @result{} #<treesit-node (primitive_type) in 23-27>
@end group
@end example
@end defun
@group
;; Get the child that has "body" as its field name.
(treesit-child-by-field-name node "body")
- @result{} #<treesit-node (compound_statement) in *scratch*>
+ @result{} #<treesit-node (compound_statement) in 45-89>
@end group
@end example
@end defun
case PVEC_TS_PARSER:
print_c_string ("#<treesit-parser for ", printcharfun);
Lisp_Object language = XTS_PARSER (obj)->language_symbol;
+ /* No need to print the buffer because it's not that useful: we
+ usually know which buffer a parser belongs to. */
print_string (Fsymbol_name (language), printcharfun);
- print_c_string (" in ", printcharfun);
- print_object (XTS_PARSER (obj)->buffer, printcharfun, escapeflag);
printchar ('>', printcharfun);
break;
case PVEC_TS_NODE:
print_string (Ftreesit_node_type (obj), printcharfun);
print_c_string (delim2, printcharfun);
print_c_string (" in ", printcharfun);
- print_object (XTS_PARSER (XTS_NODE (obj)->parser)->buffer,
- printcharfun, escapeflag);
+ print_object (Ftreesit_node_start (obj), printcharfun, escapeflag);
+ printchar ('-', printcharfun);
+ print_object (Ftreesit_node_end (obj), printcharfun, escapeflag);
printchar ('>', printcharfun);
break;
case PVEC_TS_COMPILED_QUERY: