Function: semantic-lex-make-type-table
semantic-lex-make-type-table is a byte-compiled function defined in
lex.el.gz.
Signature
(semantic-lex-make-type-table SPECS &optional PROPSPECS)
Documentation
Convert type SPECS into an obarray and return it.
SPECS must be a list of (TYPE . TOKENS) elements, where:
TYPE is the name of the type symbol to define.
TOKENS is a list of (TOKSYM . MATCHER) elements, where:
TOKSYM is any lexical token symbol.
MATCHER is a string or regexp a text must match to be a such
lexical token.
If optional argument PROPSPECS is non-nil, then interpret it, and apply those properties. PROPSPECS must be a list of (TYPE PROPERTY VALUE).
Source Code
;; Defined in /usr/src/emacs/lisp/cedet/semantic/lex.el.gz
(defun semantic-lex-make-type-table (specs &optional propspecs)
"Convert type SPECS into an obarray and return it.
SPECS must be a list of (TYPE . TOKENS) elements, where:
TYPE is the name of the type symbol to define.
TOKENS is a list of (TOKSYM . MATCHER) elements, where:
TOKSYM is any lexical token symbol.
MATCHER is a string or regexp a text must match to be a such
lexical token.
If optional argument PROPSPECS is non-nil, then interpret it, and
apply those properties.
PROPSPECS must be a list of (TYPE PROPERTY VALUE)."
;; Create the symbol hash table
(let* ((semantic-lex-types-obarray (make-vector 13 0))
spec type tokens token alist default)
;; fill it with stuff
(while specs
(setq spec (car specs)
specs (cdr specs)
type (car spec)
tokens (cdr spec)
default nil
alist nil)
(while tokens
(setq token (car tokens)
tokens (cdr tokens))
(if (cdr token)
(setq alist (cons token alist))
(setq token (car token))
(if default
(message
"*Warning* default value of <%s> tokens changed to %S, was %S"
type token default))
(setq default token)))
;; Ensure the default matching spec is the first one.
(semantic-lex-type-set type (cons default (nreverse alist))))
;; Install useful default types & properties
(semantic-lex-preset-default-types)
;; Apply all properties
(while propspecs
(setq spec (car propspecs)
propspecs (cdr propspecs))
;; Create the type if necessary.
(semantic-lex-type-put (car spec) (nth 1 spec) (nth 2 spec) t))
semantic-lex-types-obarray))