Token Macro Files

The token macros are listed in a file with a .tom extension. The global token macro file resides in the Source Insight program directory. The project-specific token macro file, if any, is stored in project’s data directory. The project token macro file is combined with the global file, with the project macros taking precedence.

Token Macro Syntax

A token macro file consists of token macros, one per line. The format of a token macro is:

macroname <no text here means macro is a no-op>
macroname substituted text here
macroname(parameter list) substituted text with 
parameter names
macroname(parameter) text##parameter // concatenates 
; comments begin with a semicolon 

Some examples of token macros:

MyStructure(sname) struct sname
BuildName(name1, name2) name1##name2

Each built-in language parser has a corresponding token macro file. The name of the token macro file for each language is summarized below:

Table 4.2: Token Macro Files for Different Languages


File Name

C and C++

C.tom – a default copy ships with Source Insight.





Resource Files


x86 Assembly Language




Editing Token Macros

If you want to change the token macros, simply open the token macro file, make your changes, and save the file. Source Insight will recognize that the token macros have changed for the appropriate language. Open files are automatically re-parsed.

When you edit a token macro file, you must save it to disk before Source Insight will re-parse your open files. However, Source Insight will not automatically re-parse your whole project. You should make all your changes to the token macro file first, then use the Rebuild Project command to re-parse your whole project. Until your project is re-parsed, the symbol information stored in Source Insight’s symbol database will not reflect the changes you made to your token macros.

Project Specific Token Macros

Each project can have its own set of token macro files. Source Insight does not create them automatically, but you can yourself. A project token macro file is saved in the project's data directory. When Source Insight parses a source file, it combines the project token macros with the global set saved in the Source Insight program directory. The project token macros take precedence over the global ones. By adding project specific token macros, you can tailor the token macro expansion for each project individually.