Function: semantic-c-do-lex-ifdef

semantic-c-do-lex-ifdef is a byte-compiled function defined in c.el.gz.

Signature

(semantic-c-do-lex-ifdef)

Documentation

Handle lexical CPP if statements.

Source Code

;; Defined in /usr/src/emacs/lisp/cedet/semantic/bovine/c.el.gz
(defun semantic-c-do-lex-ifdef ()
  "Handle lexical CPP if statements."
  (let* ((sym (buffer-substring-no-properties
	       (match-beginning 2) (match-end 2)))
	 (ift (buffer-substring-no-properties
	       (match-beginning 1) (match-end 1)))
	 (ifdef (string= ift "ifdef"))
	 (ifndef (string= ift "ifndef"))
	 )
    (if (or (and ifdef (not (semantic-lex-spp-symbol-p sym)))
	    (and ifndef (semantic-lex-spp-symbol-p sym)))
	;; The if indicates to skip this preprocessor section.
	(let ((pt nil))
	  ;; (message "%s %s yes" ift sym)
	  (beginning-of-line)
	  (setq pt (point))
	  ;; This skips only a section of a conditional.  Once that section
	  ;; is opened, encountering any new #else or related conditional
	  ;; should be skipped.
	  (semantic-c-skip-conditional-section)
	  (setq semantic-lex-end-point (point))
	  (semantic-push-parser-warning (format "Skip #%s %s" ift sym)
					pt (point))
	  ;;	  (semantic-lex-push-token
	  ;;	   (semantic-lex-token 'c-preprocessor-skip pt (point)))
	  nil)
      ;; Else, don't ignore it, but do handle the internals.
      ;;(message "%s %s no" ift sym)
      (end-of-line)
      (setq semantic-lex-end-point (point))
      nil)))