Function: semantic-lex-cpp-define

semantic-lex-cpp-define is a byte-compiled function defined in c.el.gz.

Signature

(semantic-lex-cpp-define)

Documentation

A #define of a symbol with some value.

Record the symbol in the semantic preprocessor. Return the defined symbol as a special spp lex token.

Source Code

;; Defined in /usr/src/emacs/lisp/cedet/semantic/bovine/c.el.gz
(define-lex-spp-macro-declaration-analyzer semantic-lex-cpp-define
  "A #define of a symbol with some value.
Record the symbol in the semantic preprocessor.
Return the defined symbol as a special spp lex token."
  "^\\s-*#\\s-*define\\s-+\\(\\(\\sw\\|\\s_\\)+\\)" 1
  (goto-char (match-end 0))
  (skip-chars-forward " \t")
  (if (eolp)
      nil
    (let* (;; (name (buffer-substring-no-properties
	   ;;        (match-beginning 1) (match-end 1)))
	   (beginning-of-define (match-end 1))
	   (with-args (save-excursion
			(goto-char (match-end 0))
			(looking-at "(")))
	   (semantic-lex-spp-replacements-enabled nil)
	   ;; Temporarily override the lexer to include
	   ;; special items needed inside a macro
	   (semantic-lex-analyzer #'semantic-cpp-lexer)
	   (raw-stream
	    (semantic-lex-spp-stream-for-macro (save-excursion
						 (c-end-of-macro)
						 ;; HACK - If there's a C comment after
						 ;; the macro, do not parse it.
						 (if (looking-back "/\\*.*" beginning-of-define)
						     (progn
						       (goto-char (match-beginning 0))
						       (point))
						   (point)))))
	   )

      ;; Only do argument checking if the paren was immediately after
      ;; the macro name.
      (if with-args
	  (semantic-lex-spp-first-token-arg-list (car raw-stream)))

      ;; Magical spp variable for end point.
      (setq semantic-lex-end-point (point))

      ;; Handled nested macro streams.
      (semantic-lex-spp-merge-streams raw-stream)
      )))