Function: parseclj--take-token

parseclj--take-token is a byte-compiled function defined in parseclj-parser.el.

Signature

(parseclj--take-token STACK VALUE-P TOKEN-TYPES)

Documentation

Scan STACK until a token of a certain type is found.

Returns nil if a value is encountered before a matching token is found. Return everything up to the token in reversed order (meaning the token comes first in the result).

STACK is the current parse stack to scan.

VALUE-P a predicate to distinguish reduced values from non-values (tokens and whitespace).

TOKEN-TYPES are the token types to look for.

Source Code

;; Defined in ~/.emacs.d/elpa/parseclj-20261002.1230/parseclj-parser.el
(defun parseclj--take-token (stack value-p token-types)
  "Scan STACK until a token of a certain type is found.
Returns nil if a value is encountered before a matching token is found.
Return everything up to the token in reversed order (meaning the token
comes first in the result).

STACK is the current parse stack to scan.

VALUE-P a predicate to distinguish reduced values from non-values (tokens
and whitespace).

TOKEN-TYPES are the token types to look for."
  (let ((result nil))
    (cl-block nil
      (while stack
        (cond
         ((member (parseclj-lex-token-type (car stack)) token-types)
          (cl-return (cons (car stack) result)))
         ((funcall value-p (car stack))
          (cl-return nil))
         ((parseclj-lex-token-p (car stack))
          (cl-return nil))
         (t
          (push (pop stack) result)))))))