Next: , Previous: , Up: Components   [Contents][Index]


3.4 Clang C Tokenizer

The Clang C Tokenizer component offers the ability to construct a sequence of tokens that represent a software object.

3.4.1 API Support

The sel/cp/clang-tokens:clang-tokens method takes a sel:software object and an optional list of roots indicating the elements that should be tokenized. It returns a list of symbols representing all the tokens under each of the roots.

The Clang C tokenizer uses the following conventions:

Token KindRepresented By
identifierinterned string “identifier”.
special character
(operator, parenthesis, brace, etc) 
the interned string of the special character, e.g., (intern "+").
primitive typethe interned string for that type, e.g., (intern "int").
keywordthe interned string for that keyword, e.g., (intern "if").
macrosthe interned string “macro” (macros are generally not expanded in the AST).
literalscharacter, float, imaginary, integer, and string literals are represented by the following interned strings, respectively: “char-literal”, “float-literal”, “i-literal”, “int-literal”, “string-literal”.