define-lex-analyzer

define-lex-analyzer is a Lisp macro in `lex.el'.

(define-lex-analyzer NAME DOC CONDITION &rest FORMS)

Create a single lexical analyzer NAME with DOC.
When an analyzer is called, the current buffer and point are
positioned in a buffer at the location to be analyzed.
CONDITION is an expression which returns t if FORMS should be run.
Within the bounds of CONDITION and FORMS, the use of backquote
can be used to evaluate expressions at compile time.
While forms are running, the following variables will be locally bound:
`semantic-lex-analysis-bounds' - The bounds of the current analysis.
of the form (START . END)
`semantic-lex-maximum-depth' - The maximum depth of semantic-list
for the current analysis.
`semantic-lex-current-depth' - The current depth of `semantic-list' that has
been descended.
`semantic-lex-end-point' - End Point after match.
Analyzers should set this to a buffer location if their
match string does not represent the end of the matched text.
`semantic-lex-token-stream' - The token list being collected.
Add new lexical tokens to this list.
Proper action in FORMS is to move the value of `semantic-lex-end-point' to
after the location of the analyzed entry, and to add any discovered tokens
at the beginning of `semantic-lex-token-stream'.
This can be done by using `semantic-lex-push-token'.