Function: hif-canonicalize

hif-canonicalize is a byte-compiled function defined in hideif.el.gz.

Signature

(hif-canonicalize REGEXP)

Documentation

Return a Lisp expression for its condition by scanning current buffer.

Do this when cursor is at the beginning of regexp (i.e. #ifX).

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/hideif.el.gz
(defun hif-canonicalize (regexp)
  "Return a Lisp expression for its condition by scanning current buffer.
Do this when cursor is at the beginning of `regexp' (i.e. #ifX)."
  (let ((case-fold-search nil))
    (save-excursion
      (if (re-search-forward regexp)
          (if (= ?\( (char-before)) ;; "#if(" found
              (goto-char (1- (point)))))
      (let* ((curr-regexp (match-string 0))
             (defined (string-match hif-ifxdef-regexp curr-regexp))
             (negate (and defined
                          (string= (match-string 2 curr-regexp) "n")))
             (hif-simple-token-only nil) ; Dynamic binding for `hif-tokenize'
             (tokens (hif-tokenize (point)
                                   (progn (hif-end-of-line) (point)))))
        (if defined
            (setq tokens (list 'hif-defined tokens)))
        (if negate
            (setq tokens (list 'hif-not tokens)))
        (hif-parse-exp tokens)))))