help static checking. */
typedef struct { void const *fwdptr; } lispfwd;
\f
-/* Interned state of a symbol. */
-
-enum symbol_interned
-{
- SYMBOL_UNINTERNED, /* not interned anywhere */
- SYMBOL_INTERNED, /* interned but not in initial obarray */
- SYMBOL_INTERNED_IN_INITIAL_OBARRAY /* interned in initial obarray */
-};
-
enum symbol_redirect
{
- SYMBOL_PLAINVAL = 4,
- SYMBOL_VARALIAS = 1,
- SYMBOL_LOCALIZED = 2,
- SYMBOL_FORWARDED = 3
+ SYMBOL_PLAINVAL, /* plain var, value is in the `value' field */
+ SYMBOL_VARALIAS, /* var alias, value is really in the `alias' symbol */
+ SYMBOL_LOCALIZED, /* localized var, value is in the `blv' object */
+ SYMBOL_FORWARDED /* forwarding var, value is in `forward' */
};
enum symbol_trapped_write
{
bool_bf gcmarkbit : 1;
- /* Indicates where the value can be found:
- 0 : it's a plain var, the value is in the `value' field.
- 1 : it's a varalias, the value is really in the `alias' symbol.
- 2 : it's a localized var, the value is in the `blv' object.
- 3 : it's a forwarding variable, the value is in `forward'. */
- ENUM_BF (symbol_redirect) redirect : 3;
+ /* Indicates where the value can be found. */
+ ENUM_BF (symbol_redirect) redirect : 2;
- /* 0 : normal case, just set the value
- 1 : constant, cannot set, e.g. nil, t, :keywords.
- 2 : trap the write, call watcher functions. */
ENUM_BF (symbol_trapped_write) trapped_write : 2;
- /* Interned state of the symbol. */
- ENUM_BF (symbol_interned) interned : 2;
-
/* True means that this variable has been explicitly declared
special (with `defvar' etc), and shouldn't be lexically bound. */
bool_bf declared_special : 1;
/* Handles predicate (#pred FN ARG...). Return true if FN returns
non-nil; return false otherwise. The arity of FN must match the
- number of ARGs */
+ number of ARGs. If everything goes fine, don't touch SIGNAL_DATA;
+ if error occurs, set it to a suitable signal data. */
static bool
- treesit_predicate_pred (Lisp_Object args, struct capture_range captures)
+ treesit_predicate_pred (Lisp_Object args, struct capture_range captures,
+ Lisp_Object *signal_data)
{
- if (XFIXNUM (Flength (args)) < 2)
- xsignal2 (Qtreesit_query_error,
- build_pure_c_string ("Predicate `pred' requires "
- "at least two arguments, "
- "but was only given"),
- Flength (args));
+ if (list_length (args) < 2)
+ {
+ *signal_data = list2 (build_string ("Predicate `pred' requires "
+ "at least two arguments, "
+ "but only got"),
+ Flength (args));
+ return false;
+ }
- Lisp_Object fn = Fintern (XCAR (args), Qnil);
+ Lisp_Object fn = Fintern (XCAR (args), Qnil, Qnil);
Lisp_Object nodes = Qnil;
Lisp_Object tail = XCDR (args);
FOR_EACH_TAIL (tail)