Function: define-lex-spp-include-analyzer

define-lex-spp-include-analyzer is a macro defined in lex-spp.el.gz.

Signature

(define-lex-spp-include-analyzer NAME DOC REGEXP TOKIDX &rest VALFORM)

Documentation

Define a lexical analyzer for defining a new INCLUDE lexical token.

Macros defined in the found include will be added to our running table at the time the include statement is found. 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-include is to be created. VALFORM are forms that return the name of the thing being included, and the type of include. The return value should be of the form:
  (NAME . TYPE)
where NAME is the name of the include, and TYPE is the type of the include, where a valid symbol is system, or nil.

Source Code

;; Defined in /usr/src/emacs/lisp/cedet/semantic/lex-spp.el.gz
(defmacro define-lex-spp-include-analyzer (name doc regexp tokidx
						&rest valform)
  "Define a lexical analyzer for defining a new INCLUDE lexical token.
Macros defined in the found include will be added to our running table
at the time the include statement is found.
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-include' is to be created.
VALFORM are forms that return the name of the thing being included, and the
type of include.  The return value should be of the form:
  (NAME . TYPE)
where NAME is the name of the include, and TYPE is the type of the include,
where a valid symbol is `system', or nil."
  (declare (debug (&define name stringp stringp form def-body)))
  (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))
	 ;;(message "(car ,val) -> %S" (car ,val))
	 (semantic-lex-spp-merge-header (car ,val))
	 (semantic-lex-push-token
	  (semantic-lex-token (if (eq (cdr ,val) 'system)
				  'spp-system-include
				'spp-include)
			      ,start ,end
			      (car ,val)))
	 ;; 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))
	 ))))