Variable: semantic-lex-cpp-define
semantic-lex-cpp-define is a variable defined in c.el.gz.
Value
Large value
((looking-at "^\\s-*#\\s-*define\\s-+\\(\\(\\sw\\|\\s_\\)+\\)")
(let
((start
(match-beginning 1))
(end
(match-end 1))
(startpnt semantic-lex-end-point)
(val
(save-match-data
(goto-char
(match-end 0))
(skip-chars-forward " ")
(if
(eolp)
nil
(let*
((beginning-of-define
(match-end 1))
(with-args
(save-excursion
(goto-char
(match-end 0))
(looking-at "(")))
(semantic-lex-spp-replacements-enabled nil)
(semantic-lex-analyzer #'semantic-cpp-lexer)
(raw-stream
(semantic-lex-spp-stream-for-macro
(save-excursion
(c-end-of-macro)
(if
(looking-back "/\\*.*" beginning-of-define)
(progn
(goto-char
(match-beginning 0))
(point))
(point))))))
(if with-args
(semantic-lex-spp-first-token-arg-list
(car raw-stream)))
(setq semantic-lex-end-point
(point))
(semantic-lex-spp-merge-streams raw-stream)))))
(endpnt semantic-lex-end-point))
(semantic-lex-spp-symbol-set
(buffer-substring-no-properties start end)
val)
(semantic-lex-push-token
(semantic-lex-token 'spp-macro-def start end))
(when
(and
(/= startpnt endpnt)
(/= endpnt semantic-lex-end-point))
(setq semantic-lex-end-point endpnt))))
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)
)))