| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
* src/treesit.c (make_treesit_parser): Remove field.
(Ftreesit_parser_parent_node):
(Ftreesit_parser_set_parent_node): Remove
* src/treesit.h (Lisp_TS_Parser): Remove field.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/treesit.c (Ftreesit_query_capture)
(Ftreesit_parser_embed_level, Ftreesit_parser_set_embed_level)
(Ftreesit_parser_set_parent_node):
* lisp/treesit.el (treesit-query-range)
(treesit-query-range-by-language, treesit-range-settings)
(treesit-range-rules, treesit--parser-at-level)
(treesit--update-ranges-non-local, treesit--update-ranges-local)
(treesit--update-range-1): Fix wording and typos in doc strings.
* doc/lispref/parsing.texi (Pattern Matching): Fix wording.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add parser properties embed-level and parent-node. They'll be
help us implement arbitrarily nested embeded parser, and
navigation across embedded and host parsers, respectively.
* src/treesit.c:
(Ftreesit_parser_embed_level):
(Ftreesit_parser_set_embed_level):
(Ftreesit_parser_parent_node):
(Ftreesit_parser_set_parent_node): New functions.
|
|
|
|
| |
Run "TZ=UTC0 admin/update-copyright".
|
|\
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
d509a356997 Fix regression in widget-move (bug#72995)
ef0276de82b ; * lisp/cus-edit.el (setopt): Doc fix. (Bug#73098)
b115c2d5eba ; * lisp/minibuffer.el (completion-pcm--merge-completions...
3cda1fdc3b7 Correctly include fixed strings before a prefix wildcard ...
57d93d0259a ; * lisp/treesit.el (treesit-major-mode-setup): Doc fix.
ad289f364e5 ; Improve documentation of 'easy-menu-define'
3cad7cc8dc8 Set treesit-primary-parser for c and elixir ts mode
2f243fb91d6 ; Minor doc fix in treesit.el
6a6d7925c9d Fix range handling so it works for multibyte buffer (bug#...
76faf7e6091 Revert "Read more on each call to treesit's buffer reader"
c70bd0e3fe9 Fix tree-sitter indent preset prev-adaptive-prefix
272df33fb8b ; * CONTRIBUTE: Minor copyedits.
8e1187e336f Improve NEWS entries
ca3932121a8 Don't fail uniquify-tests in non-version-controlled sourc...
79f68597aba ; * etc/ORG-NEWS: Fix typo.
d66b70f3607 * doc/misc/auth.texi: Minor copy edits.
2c6b7b2da9f ; * admin/MAINTAINERS: Remove some entries for Artur Mala...
11e7ae3964e Fix bug#72254
# Conflicts:
# etc/NEWS
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Here by multibyte buffer I mean buffer that includes non-ASCII
characters.
The problem is illustrated by this comment, which I copied from the
source:
======================================================================
(ref:bytepos-range-pitfall) Suppose we have the following buffer
content ([ ] is a unibyte char, [ ] is a multibyte char):
[a][b][c][d][e][ f ]
and the following ranges (denoted by braces):
[a][b][c][d][e][ f ]
{ }{ }
So far so good, now user deletes a unibyte char at the beginning:
[b][c][d][e][ f ]
{ }{ }
Oops, now our range cuts into the multibyte char, bad!
======================================================================
* src/treesit.c (treesit_debug_print_parser_list): Minor fix.
(treesit_sync_visible_region): Change the way we fixup ranges, instead
of using the bytepos ranges from tree-sitter, we use the cached lisp
charpos ranges.
(treesit_make_ts_ranges): New function.
(Ftreesit_parser_set_included_ranges): Refactor out the new function
treesit_make_ts_ranges.
(Ftreesit_parser_included_ranges): Rather than getting the ranges from
tree-sitter, just return the cached lisp ranges.
* src/treesit.h (Lisp_TS_Parser): Add some comment.
* test/src/treesit-tests.el (treesit-range-fixup-after-edit): New test.
|
| | |
|
|\|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
ee3e3a63111 ; Update version number of exec/configure.ac
c5925b6ba5f Fix heex-ts-mode indentation following previews elixir-mo...
c3383be5f04 ; * admin/make-tarball.txt: Improve last change.
8ddb54117f1 ; * admin/make-tarball.txt: Remove now unnecessary config...
7e194d33f90 * lisp/ldefs-boot.el: Update.
9019536ea66 Fix use of Uniscribe font driver in MinGW build
5c55c860db7 Avoid crashes in redisplay in batch-mode testing
ba2190e1ae7 ; * etc/NEWS: Fix indentation.
818c0cc9a51 eglot-test-rust-completion-exit-function: Fix failure in ...
f47297782bd ; * doc/lispref/searching.texi (Rx Notation): Simplify rx...
03e56981675 Clarify the semantics of 'string-pixel-width'
9f0603207b1 ; * src/treesit.c: Minor cleanups of recent changes.
e0d3f743957 * src/treesit.c (treesit_debug_print_parser_list): Fix fo...
bed38ded730 ; * src/treesit.c (treesit_debug_print_parser_list): Fix ...
18c6487dbd0 ; * src/treesit.c: Add a prototype so there's no warning ...
bf23382f1f2 Read more on each call to treesit's buffer reader
3435464452b Fix the range handling in treesit.c
3fcec09f754 Add debugging function for treesit.c
0fd259d166c Fix elixir-ts-mode's range query
2329b36b1fb ; project-files-relative-names: Update docstring (bug#72701)
e55e2e1c6ba Make json-serialize always return a unibyte string (bug#7...
89c99891b2b ; * doc/lispref/os.texi (Suspending Emacs): Fix last change.
4f044d0d3df ; Improve documentation of 'suspend-emacs'
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
1. In treesit_sync_visible_region, reduce the ranges for a parser so it
doesn't go beyond the visible range.
2. To avoid possible infinite recursion, add a within_reparse field to
parsers. Previously we were using the need_reparse field to avoid
infinite recursion, but lisp programs in a parser's after change hook
might make some buffer edit which turns need_reparse to true. To avoid
that, we now use an explicit field. If a parser's after change function
makes a buffer edit, lisp program ends up with a desynced parse tree,
but that's better than possible infinite recursion. Also after change
function shouldn't edit the buffer.
3. In treesit_make_ranges, use parser's visible_beg instead of buffer's
BEGV. I mean technically whenever we make ranges, buffer's BEGV should
be equal to parser's visible_beg, but better not take that uncertainty,
also makes the code more readable.
4. In Ftreesit_parser_included_ranges, move visible region sync code
before the body of the function.
* src/treesit.c (treesit_sync_visible_region): Minimally fix ranges so
it doesn't exceed parser's visible range.
(treesit_call_after_change_functions): Update calling sigature to
treesit_make_ranges.
(treesit_ensure_parsed, make_treesit_parser): Use the new field
within_reparse.
(treesit_make_ranges): Use parser's visible_beg instead of buffer's
BEGV.
(Ftreesit_parser_included_ranges): Move visible region check before
function body.
* src/treesit.h (Lisp_TS_Parser): Add new field within_reparse.
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* doc/lispref/parsing.texi (Using Parser): Add notice.
* lisp/treesit.el (treesit-parse-string): Remove function.
* src/treesit.c (make_treesit_parser): Init the new filed.
(treesit_delete_parser): Collect the temp buffer.
(Ftreesit_parse_string): New function.
* src/treesit.h (Lisp_TS_Parser): New field.
|
|/
|
|
|
|
|
|
|
|
|
|
|
| |
Previous commit allows Emacs to dump tree-sitter queries by simply
dumping the query string and language symbol, and left the query object
and cursor object as NULL. This commit makes sure Emacs doesn't crash
when loading the dumped query, by make sure Emacs can handle the case
where the cursor is NULL.
* src/treesit.c (make_treesit_query): Initialize query with null cursor.
(treesit_ensure_query_cursor): New function.
(treesit_initialize_query): Ensure cursor is non-null.
* src/treesit.h (Lisp_TS_Query): Update documentation.
|
|\
| |
| |
| |
| |
| | |
53e9caa23ef ; * doc/emacs/help.texi (Help, Apropos): Improve text and...
00360258cad Fix treesit-parse-string crash (bug#71012)
20af58d3a13 Check for buffer liveness when accessing tree-sitter node...
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* src/treesit.h (treesit_node_buffer_live_p): Declare function.
* src/print.c (print_vectorlike): Print node without position if
buffer is killed.
* src/treesit.c (treesit_node_buffer_live_p): New function.
(treesit_check_node): Add buffer liveness check.
(syms_of_treesit): New error treesit-node-buffer-killed.
|
| |
| |
| |
| |
| |
| | |
This reverts commit 996b9576713f9d63ea7ff7e9630a15cb0a0214eb.
For reason see 760b54de080.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
- Add a new field last_changed_ranges to tree-sitter parser object.
- Add a new function treesit-parser-changed-ranges
* doc/lispref/parsing.texi (Using Parser): Add the function in
tree-sitter manual.
* src/treesit.c (treesit_get_changed_ranges): New function, refactored
out of treesit_call_after_change_functions.
(treesit_call_after_change_functions): Pull out
treesit_get_changed_ranges.
(treesit_ensure_parsed): Save the changed ranges to the parser object.
(make_treesit_parser): Initialize the new parser field
last_changed_ranges.
(Ftreesit_parser_changed_ranges): New function.
(Qtreesit_unparsed_edits): New error.
* src/treesit.h (Lisp_TS_Parser): New field.
|
|\|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
dc4e6b13296 ; Update copyright years in more files
64b37776318 ; Run set-copyright from admin.el
8e1c56ae467 ; Add 2024 to copyright years
# Conflicts:
# doc/misc/modus-themes.org
# doc/misc/texinfo.tex
# etc/NEWS
# etc/refcards/ru-refcard.tex
# etc/themes/modus-operandi-theme.el
# etc/themes/modus-themes.el
# etc/themes/modus-vivendi-theme.el
# lib/alloca.in.h
# lib/binary-io.h
# lib/c-ctype.h
# lib/c-strcasecmp.c
# lib/c-strncasecmp.c
# lib/careadlinkat.c
# lib/cloexec.c
# lib/close-stream.c
# lib/diffseq.h
# lib/dup2.c
# lib/filemode.h
# lib/fpending.c
# lib/fpending.h
# lib/fsusage.c
# lib/getgroups.c
# lib/getloadavg.c
# lib/gettext.h
# lib/gettime.c
# lib/gettimeofday.c
# lib/group-member.c
# lib/malloc.c
# lib/md5-stream.c
# lib/md5.c
# lib/md5.h
# lib/memmem.c
# lib/memrchr.c
# lib/nanosleep.c
# lib/save-cwd.h
# lib/sha1.c
# lib/sig2str.c
# lib/stdlib.in.h
# lib/strtoimax.c
# lib/strtol.c
# lib/strtoll.c
# lib/time_r.c
# lib/xalloc-oversized.h
# lisp/auth-source-pass.el
# lisp/emacs-lisp/lisp-mnt.el
# lisp/emacs-lisp/timer.el
# lisp/info-look.el
# lisp/jit-lock.el
# lisp/loadhist.el
# lisp/mail/rmail.el
# lisp/net/ntlm.el
# lisp/net/webjump.el
# lisp/progmodes/asm-mode.el
# lisp/progmodes/project.el
# lisp/progmodes/sh-script.el
# lisp/textmodes/flyspell.el
# lisp/textmodes/reftex-toc.el
# lisp/textmodes/reftex.el
# lisp/textmodes/tex-mode.el
# lisp/url/url-gw.el
# m4/alloca.m4
# m4/clock_time.m4
# m4/d-type.m4
# m4/dirent_h.m4
# m4/dup2.m4
# m4/euidaccess.m4
# m4/fchmodat.m4
# m4/filemode.m4
# m4/fsusage.m4
# m4/getgroups.m4
# m4/getloadavg.m4
# m4/getrandom.m4
# m4/gettime.m4
# m4/gettimeofday.m4
# m4/gnulib-common.m4
# m4/group-member.m4
# m4/inttypes.m4
# m4/malloc.m4
# m4/manywarnings.m4
# m4/mempcpy.m4
# m4/memrchr.m4
# m4/mkostemp.m4
# m4/mktime.m4
# m4/nproc.m4
# m4/nstrftime.m4
# m4/pathmax.m4
# m4/pipe2.m4
# m4/pselect.m4
# m4/pthread_sigmask.m4
# m4/readlink.m4
# m4/realloc.m4
# m4/sig2str.m4
# m4/ssize_t.m4
# m4/stat-time.m4
# m4/stddef_h.m4
# m4/stdint.m4
# m4/stdio_h.m4
# m4/stdlib_h.m4
# m4/stpcpy.m4
# m4/strnlen.m4
# m4/strtoimax.m4
# m4/strtoll.m4
# m4/time_h.m4
# m4/timegm.m4
# m4/timer_time.m4
# m4/timespec.m4
# m4/unistd_h.m4
# m4/warnings.m4
# nt/configure.bat
# nt/preprep.c
# test/lisp/register-tests.el
|
| | |
|
|\|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
53031528725 Revert "Fix treesit-node-field-name and friends (bug#66674)"
fa0bb88302b ; * src/buffer.c (syms_of_buffer) <default-directory>: Do...
44517037aed ; Fix typo
ccf46acefd2 ; Fix last change.
c86b039dffc ; * etc/DEBUG: Improve advice for debugging native-compil...
9afba605bbc Explain status "r" in `epa-list-keys`
62714221968 ; * lisp/dired.el (dired--make-directory-clickable): Refo...
fcbb0044899 Fix mouse clicks on directory line in Dired
be8a7155b48 Fix 'split-root-window-right' and 'split-root-window-below'
eb19984c4db Mark icalendar.el as maintained by emacs-devel
03dc914fd37 ; Fix footnotes in ELisp Intro manual
ceacf753958 Fix usage of `setq-default' and offer more suggestions
2701da0eee5 Fix python-ts-mode triple quote syntax (bug#67262)
683c7c96871 Increment parser timestamp when narrowing changes (bug#67...
8ae42c825e1 ruby-ts-mode: Fix indentation for string_array closer
9cfa498e0ab treesit-major-mode-setup: Use 'treesit--syntax-propertize...
da2e440462b ruby-ts-mode: Fix an out-of-bounds error with heredoc at eob
6ea507296a7 Correctly refontify changed region in tree-sitter modes (...
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
When narrowing changes, parse reparses, so the timestamp should
definitely increment, just like in ts_record_changes.
Failing to increment this timestamp, outdated nodes would think they
are still up-to-date, and try to print their type name. Printing
their type name involves accessing the old parse tree, which is
already freed during the last reparse.
I also found that we don't increment timestamp when changing parser
ranges and fixed that as well.
* src/treesit.c (treesit_sync_visible_region):
(Ftreesit_parser_set_included_ranges): Increment timestamp.
* src/treesit.h (Lisp_TS_Parser): Add some comments.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* src/treesit.h (Lisp_TS_Parser)
* src/treesit.c (make_treesit_parser): Remove has_range field, add
last_set_ranges field.
(Ftreesit_parser_set_included_ranges): Return early if the new range
is the same as the old one.
(Ftreesit_parser_included_ranges): Change has_range to
last_set_ranges.
|
|/
|
|
|
|
|
|
|
| |
* doc/lispref/parsing.texi (Using Parser): Update manual.
* lisp/treesit.el (treesit-buffer-root-node)
* src/treesit.c (make_treesit_parser)
* src/treesit.c (Ftreesit_parser_create): Add TAG parameter.
(treesit_resolve_node): Create a parser with nil tag.
* src/treesit.h (Lisp_TS_Parser): Add TAG field.
|
|
|
|
|
|
|
|
|
|
|
| |
Now equal uses ts_node_eq to check equality between nodes.
* doc/lispref/parsing.texi:
(Accessing Node Information): Update manual.
* src/fns.c (internal_equal): Handle tree-sitter nodes.
* src/treesit.c (treesit_node_eq): New function.
(Ftreesit_node_eq): Factor out. Update docstring.
* src/treesit.h (treesit_node_eq): Declare new function.
|
| |
|
|
|
|
|
| |
* src/treesit.c
* src/treesit.h: Add (and fix) comments.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
* src/treesit.c (treesit_call_after_change_functions): New function.
(treesit_ensure_parsed): Call treesit_call_after_change_functions
right after re-parse.
(make_treesit_parser): Initialize after_change_functions.
(Ftreesit_parser_notifiers)
(Ftreesit_parser_add_notifier)
(Ftreesit_parser_remove_notifier): New functions.
* src/treesit.h (Lisp_TS_Parser): New field after_change_functions.
|
|
|
|
|
|
|
|
|
|
| |
Track whether a parser has ranges set ourselves. See comment in
Ftreesit_parser_included_ranges for detail.
* src/treesit.c (make_treesit_parser): Initialize has_range.
(Ftreesit_parser_set_included_ranges): Set has_range. Fill docstring.
(Ftreesit_parser_included_ranges): Check has_range.
* src/treesit.h (Lisp_TS_Parser): Add has_range.
|
|
|
|
|
| |
* src/treesit.c (treesit_node_uptodate_p):
* src/treesit.h: Fix coding style.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/treesit.c (treesit_find_override_name)
(treesit_load_language_push_for_each_suffix, treesit_load_language)
(Ftreesit_langauge_available_p, treesit_record_change)
(make_treesit_parser, make_treesit_node, make_treesit_query)
(Ftreesit_parser_create, Ftreesit_parser_delete, Ftreesit_parser_list)
(treesit_check_range_argument, Ftreesit_parser_included_ranges)
(Ftreesit_node_start, Ftreesit_node_end, Ftreesit_node_check)
(Ftreesit_node_child_by_field_name, Ftreesit_pattern_expand)
(Ftreesit_query_expand, treesit_predicates_for_pattern)
(treesit_predicate_capture_name_to_text, treesit_predicate_equal)
(treesit_predicate_match, treesit_eval_predicates)
(Ftreesit_query_capture, treesit_search_dfs, treesit_build_sparse_tree)
(syms_of_treesit): Use FOR_EACH_TAIL (or FOR_EACH_TAIL_SAFE where not
obviously safe), and check list heads and tails correctly; fix coding
style of various constructs, especially:
variable =
mumble (frob (bar), (foo () + bar ()) + (baz () + quux ()))
which should actually be
variable
= mumble (frob (bar), (foo () + bar ()) + (baz () + quux ()))
and
foo =
mumble (frob (bar), 0)
+ (foo () + bar ())
+ (baz () + quux ())
which should actually be
foo = (mumble (frob (bar), 0)
+ (foo () + bar ())
+ (baz () + quux ()))
* src/treesit.h: Make declaration coding style consistent.
|
|
|
|
|
|
|
| |
* src/print.c (print_vectorlike): Check for outdated node.
* src/treesit.c (treesit_check_node): Use the new function.
(treesit_node_uptodate_p): New function.
* src/treesit.h: Declare new function.
|
|
|
|
|
|
| |
* doc/lispref/parsing.texi:
* src/treesit.h:
* test/src/treesit-tests.el: Update copyright years.
|
|
|
|
|
| |
* src/treesit.c:
* src/treesit.h: Fix typos and formatting.
|
|
|
|
|
| |
* src/treesit.c: Rename all ts_* functions and variables to
treesit_*; all references changed. Fix whitespace.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/treesit.c [WINDOWSNT]: Add MS-Windows boilerplate for
dynamically-loaded optional libraries.
(init_treesit_functions) [WINDOWSNT]: New function.
(load_tree_sitter_if_necessary): New function.
(ts_initialize): Call 'load_tree_sitter_if_necessary'.
(ts_delete_parser, ts_delete_query, ts_named_node_p): Wrapper
functions for TS calls from outside treesit.c.
(Ftreesit_parser_root_node, Ftreesit_parser_set_included_ranges)
(Ftreesit_parser_included_ranges, Ftreesit_node_type)
(Ftreesit_node_start, Ftreesit_node_end, Ftreesit_node_string)
(Ftreesit_node_parent, Ftreesit_node_child, Ftreesit_node_check)
(Ftreesit_node_field_name_for_child, Ftreesit_node_child_count)
(Ftreesit_node_next_sibling, Ftreesit_node_prev_sibling)
(Ftreesit_node_first_child_for_pos)
(Ftreesit_node_descendant_for_range, Ftreesit_node_eq)
(Ftreesit_query_compile, Ftreesit_query_capture)
(Ftreesit_search_subtree, Ftreesit_search_forward)
(Ftreesit_induce_sparse_tree): Call 'ts_initialize' before any
other TS functions.
(Ftreesit_available_p): 'treesit-available-p' implemented in C, so
that on WINDOWSNT the library could be loaded dynamically.
* src/treesit.h (ts_delete_parser, ts_delete_query)
(ts_named_node_p): Add prototypes.
* src/print.c (print_vectorlike):
* src/alloc.c (cleanup_vector): Call tree-sitter function via
wrappers defined in treesit.c, not directly, because WINDOWSNT
redefines the TS functions to be called via function pointers.
* src/Makefile.in (base_obj): Add treesit.o
(TREE_SITTER_OBJ): Remove.
* lisp/treesit.el (treesit-available-p): Remove: now implemented
in C.
* lisp/term/w32-win.el (dynamic-library-alist): Add libtree-sitter
DLLs.
* configure.ac (TREE_SITTER): Support the MinGW build.
(TREE_SITTER_OBJ): Remove.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
See comment on struct Lisp_TS_Query for why. Previous commits adding
python and js support for tree-sitter breaks Emacs build if language
definitions aren't available at build time. This commit fixes that.
Now query object don't compile the query upon creation, but stores the
query source and language symbol, and compiles upon first use (in
treesit-query-capture).
I want ts_ensure_query_compiled to return signal symbol and data
rather than signaling itself, because it's a helper function not lisp
function. But because it calls ts_load_language, I had to update
ts_load_language to also use the signal symbol/data interface.
* src/treesit.h (struct Lisp_TS_Query): Add two new field.
* src/treesit.c (ts_load_language): Return signal symbol and data
rather than signaling itself.
(Ftreesit_langauge_available_p)
(Ftreesit_parser_create): Update usage of ts_load_language
(make_ts_query): Now returns a lisp object.
(ts_query_error_to_string): Moved because it's used by
ts_compose_query_signal_data.
(ts_compose_query_signal_data)
(ts_ensure_query_compiled): New functions.
(Ftreesit_query_compile): Delay compiling the query.
(Ftreesit_query_capture): Instead of creating a query object which
compiles the query, now goes two routes: if QUERY is a query object,
make sure it is compiled and use the TSQuery; if QUERY is a cons or
string, compile directly to TSQuery, and free it after use. Creating
a lisp query requires the language symbol, but in this function we
only have TSLanguage.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/treesit.c (ts_record_change): Replace CHECK_TS_PARSER with
ts_check_parser.
(make_ts_parser): Initialize deleted field.
(Ftreesit_parser_delete): Replace CHECK_TS_PARSER with
ts_check_parser. Set deleted field.
(Ftreesit_parser_buffer, Ftreesit_parser_language): Replace
CHECK_TS_PARSER with ts_check_parser.
(ts_check_parser): New function.
(Ftreesit_parser_root_node, Ftreesit_parser_set_included_ranges)
(Ftreesit_parser_included_ranges): Replace CHECK_TS_PARSER with
ts_check_parser.
(Qtreesit_parser_deleted): New symbol.
(Qtreesit_parser_deleted): New error.
* src/treesit.h (Lisp_TS_Parser): New field 'deleted'.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
No intergration/interaction with the new type, just adding it.
* lisp/emacs-lisp/cl-preloaded.el (cl--typeof-types): Add new type.
* src/alloc.c (cleanup_vector): Add gc for the new type.
* src/data.c (Ftype_of): Add switch case for the new type.
(syms_of_data): Add symbols for the new type.
* src/lisp.h (DEFINE_GDB_SYMBOL_BEGIN): Add new type.
* src/treesit.c (Ftreesit_compiled_query_p): New function.
(syms_of_treesit): Add symbol for the new type.
* src/treesit.h (struct Lisp_TS_Query): New struct.
(TS_COMPILED_QUERY_P, XTS_COMPILED_QUERY, CHECK_TS_COMPILED_QUERY):
New macros.
* src/print.c (print_vectorlike): Add printing for the new type.
|
|
* configure.ac (HAVE_TREE_SITTER, TREE_SITTER_OBJ): New variables.
(DYNAMIC_LIB_SUFFIX): new variable, I copied code from MODULES_SUFFIX
so the diff looks this way.
* doc/lispref/elisp.texi (Top): Add tree-sitter manual.
* doc/lispref/modes.texi (Font Lock Mode): mention tree-sitter.
(Parser-based Font Lock): New section.
(Auto-Indentation): Mention tree-sitter.
(Parser-based Indentation): New section.
* doc/lispref/parsing.texi (Parsing Program Source): New chapter.
* lisp/emacs-lisp/cl-preloaded.el (cl--typeof-types): Add
treesit-parser and treesit-node type.
* lisp/treesit.el: New file.
* src/Makefile.in (TREE_SITTER_LIBS, TREE_SITTER_FLAGS,
TREE_SITTER_OBJ): New variables.
* src/alloc.c:
(cleanup_vector): Add cleanup code for treesit-parser and
treesit-node.
* src/casefiddle.c (casify_region): Notify tree-sitter parser of
buffer change.
* src/data.c (Ftype_of): Add treesit-parser and treesit-node type
(Qtreesit_parser, Qtreesit_node): New symbol.
* src/emacs.c (main): Add symbols in treesit.c.
* src/eval.c (define_error): Move the function to here.
* src/insdel.c (insert_1_both, insert_from_string_1, insert_from_gap,
insert_from_buffer_1, replace_range, del_range_2): Notify tree-sitter
parser of buffer change.
* src/json.c (define_error): Move this function out.
* src/lisp.h (DEFINE_GDB_SYMBOL_BEGIN): Add treesit-parser and
treesit-node.
* src/lread.c (Vdynamic_library_suffixes): New variable.
* src/print.c (print_vectorlike): Add code for printing
treesit-parser and treesit-node.
* src/treesit.c: New file.
* src/treesit.h: New file.
* test/src/treesit-tests.el: New file.
|