Function: define-lex-spp-macro-declaration-analyzer
define-lex-spp-macro-declaration-analyzer is a macro defined in
lex-spp.el.gz.
Signature
(define-lex-spp-macro-declaration-analyzer NAME DOC REGEXP TOKIDX &rest VALFORM)
Documentation
Define a lexical analyzer for defining new MACROS.
NAME is the name of the analyzer.
DOC is the documentation for the analyzer.
REGEXP is a regular expression for the analyzer to match.
See define-lex-regex-analyzer for more on regexp.
TOKIDX is an index into REGEXP for which a new lexical token
of type spp-macro-def is to be created.
VALFORM are forms that return the value to be saved for this macro, or nil.
When implementing a macro, you can use semantic-lex-spp-stream-for-macro
to convert text into a lexical stream for storage in the macro.
Source Code
;; Defined in /usr/src/emacs/lisp/cedet/semantic/lex-spp.el.gz
(defmacro define-lex-spp-macro-declaration-analyzer (name doc regexp tokidx
&rest valform)
"Define a lexical analyzer for defining new MACROS.
NAME is the name of the analyzer.
DOC is the documentation for the analyzer.
REGEXP is a regular expression for the analyzer to match.
See `define-lex-regex-analyzer' for more on regexp.
TOKIDX is an index into REGEXP for which a new lexical token
of type `spp-macro-def' is to be created.
VALFORM are forms that return the value to be saved for this macro, or nil.
When implementing a macro, you can use `semantic-lex-spp-stream-for-macro'
to convert text into a lexical stream for storage in the macro."
(declare (debug (&define name stringp stringp form def-body))
(indent 1))
(let ((start (make-symbol "start"))
(end (make-symbol "end"))
(val (make-symbol "val"))
(startpnt (make-symbol "startpnt"))
(endpnt (make-symbol "endpnt")))
`(define-lex-regex-analyzer ,name
,doc
,regexp
(let ((,start (match-beginning ,tokidx))
(,end (match-end ,tokidx))
(,startpnt semantic-lex-end-point)
(,val (save-match-data ,@valform))
(,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))
;; Preserve setting of the end point from the calling macro.
(when (and (/= ,startpnt ,endpnt)
(/= ,endpnt semantic-lex-end-point))
(setq semantic-lex-end-point ,endpnt))
))))