semantic-flex

semantic-flex is a compiled Lisp function in `lex.el'.

(semantic-flex START END &optional DEPTH LENGTH)

Using the syntax table, do something roughly equivalent to flex.
Semantically check between START and END. Optional argument DEPTH
indicates at what level to scan over entire lists.
The return value is a token stream. Each element is a list, such of
the form (symbol start-expression . end-expression) where SYMBOL
denotes the token type.
See `semantic-flex-tokens' variable for details on token types.
END does not mark the end of the text scanned, only the end of the
beginning of text scanned. Thus, if a string extends past END, the
end of the return token will be larger than END. To truly restrict
scanning, use `narrow-to-region'.
The last argument, LENGTH specifies that `semantic-flex' should only
return LENGTH tokens.