;ELC ;;; Compiled ;;; in Emacs version 28.0.50 ;;; with all optimizations. (byte-code "\300\301!\210\300\302!\210\303\304\305\306\307\302%\207" [require scheme tree-sitter custom-declare-group tree-sitter-query nil "Tree-sitter playground." :group] 6) (defvar tree-sitter-query-mode-hook nil) (byte-code "\300\301N\204\f\302\300\301\303#\210\304\305!\204\302\305\306\307#\210\300\207" [tree-sitter-query-mode-hook variable-documentation put "Hook run after entering tsc-query-builder mode.\nNo problems result if this variable is not bound.\n`add-hook' automatically binds it. (This is true for all hook variables.)" boundp tree-sitter-query-mode-map definition-name tree-sitter-query-mode] 4) (defvar tree-sitter-query-mode-map (make-sparse-keymap)) (byte-code "\300\301N\204\302\300\301\303\304!#\210\302\305\306\307#\207" [tree-sitter-query-mode-map variable-documentation put purecopy "Keymap for `tree-sitter-query-mode'." tree-sitter-query-mode derived-mode-parent prog-mode] 5) #@280 Major mode for building tree-sitter queries and testing them live. In addition to any hooks its parent mode `prog-mode' might have run, this mode runs the hook `tree-sitter-query-mode-hook', as the final or penultimate step during initialization. \{tree-sitter-query-mode-map} (defalias 'tree-sitter-query-mode #[0 "\306\300!\210\307\310 \210\311\312\310\313N\203\314\311\313\310\313N#\210\315 !\204'\316 \317 \"\210\320 !\210\321\f!\210 )\322\323!\207" [delay-mode-hooks major-mode mode-name tree-sitter-query-mode-map scheme-mode-syntax-table scheme-mode-abbrev-table make-local-variable t prog-mode tree-sitter-query-mode "tsc-query-builder" mode-class put keymap-parent set-keymap-parent current-local-map use-local-map set-syntax-table run-mode-hooks tree-sitter-query-mode-hook local-abbrev-table] 5 (#$ . 1004) nil]) #@29 Name of the builder buffer. (defconst tree-sitter-query-builder-buffer-name "*tree-sitter-query-builder*" (#$ . 1844)) #@43 Target buffer to run the queries against. (defvar tree-sitter-query--target-buffer nil (#$ . 1969)) (custom-declare-face 'tree-sitter-query-match '((t :foreground "#000" :background "#00bfff" :weight bold)) "Face for highlight captures in matches." :group 'tree-sitter-query) #@56 Highlight CAPTURE in the current buffer. (fn CAPTURE) (defalias 'tree-sitter-query--highlight-capture #[257 "\211\242\243\300!\211\242\243\301\"\302!\303\304\305#\210\303\306\307#\210\211\310\230?\205/\303\311#\207" [tsc-node-position-range make-overlay symbol-name overlay-put evaporate t face tree-sitter-query-match "" help-echo] 16 (#$ . 2251)]) #@67 Evaluate query PATTERNS against the target buffer. (fn PATTERNS) (defalias 'tree-sitter-query--eval-query #[257 "rq\210\214~\210\303 \210\3041-\3051\306 \"00\20280\307\310@\311NA@#\210\312\262\2028\307\313@\311N\"\210\312\262\211\205?\314\n!\211\205H\315\316#\211\205_\211G\317U\203[\307\320!\266\203\202a\321\322\"\266\203*\207" [tree-sitter-query--target-buffer tree-sitter-language tree-sitter-tree remove-overlays (tsc-query-invalid) (tsc-query-invalid-node-type tsc-query-invalid-field tsc-query-invalid-capture) tsc-make-query message "%s: %s" error-message nil "%s" tsc-root-node tsc-query-captures tsc--buffer-substring-no-properties 0 "No captures found" mapc tree-sitter-query--highlight-capture] 7 (#$ . 2624)]) #@93 Run query patterns against the target buffer and update highlighted texts. (fn &rest ARGS) (defalias 'tree-sitter-query--after-change #[128 "r\301!q\210\302 \3031\304!0\202\305\306\"\210\307\262\262)\207" [tree-sitter-query-builder-buffer-name get-buffer buffer-string (debug error) tree-sitter-query--eval-query message "Error: %S" nil] 6 (#$ . 3374)]) #@45 Remove all overlays from the target buffer. (defalias 'tree-sitter-query--clean-target-buffer #[0 "rq\210\301 \210)\302\211\207" [tree-sitter-query--target-buffer remove-overlays nil] 2 (#$ . 3744)]) #@146 Provide means for developers to write and test tree-sitter queries. The buffer on focus when the command is called is set as the target buffer. (defalias 'tree-sitter-query-builder #[0 "p\303!\304!=\203\305\306!\210rq\210 \204\301 \210\307\310\311\312\313$\210)\211\2045\314\315\"\2045\305\316!\210rq\210\317 \210\320 \210\307\321\311\312\313$\210\307\322\323\312\313$\210)\324\304!!\207" [tree-sitter-query-builder-buffer-name tree-sitter-mode tree-sitter-query--target-buffer get-buffer-create get-buffer-window user-error "This buffer cannot be use as target buffer" add-hook tree-sitter-after-change-functions tree-sitter-query--after-change nil :local display-buffer-in-side-window ((side . bottom) (window-height . 10)) "Not enough space available for query builder window" erase-buffer tree-sitter-query-mode after-change-functions kill-buffer-hook tree-sitter-query--clean-target-buffer select-window] 8 (#$ . 3953) nil]) (provide 'tree-sitter-query)