Function: define-lex-simple-regex-analyzer
define-lex-simple-regex-analyzer is a macro defined in lex.el.gz.
Signature
(define-lex-simple-regex-analyzer NAME DOC REGEXP TOKSYM &optional INDEX &rest FORMS)
Documentation
Create a lexical analyzer with NAME and DOC that match REGEXP.
TOKSYM is the symbol to use when creating a semantic lexical token.
INDEX is the index into the match that defines the bounds of the token.
Index should be a plain integer, and not specified in the macro as an
expression.
FORMS are evaluated upon a successful match BEFORE the new token is
created. It is valid to ignore FORMS.
See define-lex-analyzer for more about analyzers.
Source Code
;; Defined in /usr/src/emacs/lisp/cedet/semantic/lex.el.gz
(defmacro define-lex-simple-regex-analyzer (name doc regexp toksym
&optional index
&rest forms)
"Create a lexical analyzer with NAME and DOC that match REGEXP.
TOKSYM is the symbol to use when creating a semantic lexical token.
INDEX is the index into the match that defines the bounds of the token.
Index should be a plain integer, and not specified in the macro as an
expression.
FORMS are evaluated upon a successful match BEFORE the new token is
created. It is valid to ignore FORMS.
See `define-lex-analyzer' for more about analyzers."
(declare (debug
(&define name stringp form symbolp [ &optional form ] def-body))
(indent 1))
`(define-lex-analyzer ,name
,doc
(looking-at ,regexp)
,@forms
(semantic-lex-push-token
(semantic-lex-token ,toksym
(match-beginning ,(or index 0))
(match-end ,(or index 0))))
))