{
if (STRINGP (pred))
return true;
- /* We want to allow cl-labels-defined functions, so we allow
- symbols. */
- else if (FUNCTIONP (pred) || SYMBOLP (pred))
+ else if (FUNCTIONP (pred))
return true;
else if (CONSP (pred))
{
}
return true;
}
- /* We allow the function to be a symbol to support cl-label. */
- else if (STRINGP (car) && (FUNCTIONP (cdr) || SYMBOLP (cdr)))
+ else if (STRINGP (car) && FUNCTIONP (cdr))
return true;
}
*signal_data = list2 (build_string ("Invalid predicate, see TODO for "
const char *type = ts_node_type (node);
return fast_c_string_match (pred, type, strlen (type)) >= 0;
}
- /* We want to allow cl-labels-defined functions, so we allow
- symbols. */
- else if (FUNCTIONP (pred) || SYMBOLP (pred))
+ else if (FUNCTIONP (pred))
{
Lisp_Object lisp_node = make_treesit_node (parser, node);
return !NILP (CALLN (Ffuncall, pred, lisp_node));
}
return false;
}
- /* We want to allow cl-labels-defined functions, so we allow
- symbols. */
- else if (STRINGP (car) && (FUNCTIONP (cdr) || SYMBOLP (cdr)))
+ else if (STRINGP (car) && FUNCTIONP (cdr))
{
/* A bit of code duplication here, but should be fine. */
const char *type = ts_node_type (node);
- if (!(fast_c_string_match (pred, type, strlen (type)) >= 0))
+ if (!(fast_c_string_match (car, type, strlen (type)) >= 0))
return false;
Lisp_Object lisp_node = make_treesit_node (parser, node);
- if (NILP (CALLN (Ffuncall, pred, lisp_node)))
+ if (NILP (CALLN (Ffuncall, cdr, lisp_node)))
return false;
return true;
while cursor
do (should (equal (treesit-node-text cursor) text)))
;; Test (regexp . function)
- (cl-labels ((is-odd (string)
- (and (eq 1 (length string))
- (cl-oddp (string-to-number string)))))
+ (let ((is-odd (lambda (node)
+ (let ((string (treesit-node-text node)))
+ (and (eq 1 (length string))
+ (cl-oddp (string-to-number string)))))))
(cl-loop for cursor = (treesit-node-child array 0)
- then (treesit-search-forward cursor '("number" . is-odd)
+ then (treesit-search-forward cursor `("number" . ,is-odd)
nil t)
for text in '("[" "1" "3" "5" "7" "9")
while cursor