Fixing "Parse-Too-Complex"

If Source Insight encounters too many problems trying to parse a file, the symbol window at the left side of the source window will say "Parse Too Complex" instead of listing the symbols in the file.

The Parse-too-complex can often be handled by using the Edit Condition dialog, or defining Source Insight preprocessor macros (token macros).

The Parse-too-complex usually happens in the following situations.

#ifdef Statements Confuse the Parser

In this situation, you have some #ifdefs that confuse the parser, especially when it splits the declaration of some symbol. This can be handled by using the Edit Condition command to define the state of the #if or #ifdef condition variable. See: Edit Condition. 

For example:

#ifdef ABC

typedef struct FOO_V1 {

#else

typedef struct FOO_V2 {

#endif

int x;

} FOO;

In the above example, the declaration of the typedef-struct is split up with #ifdef-#else-#endif. Source Insight tries to parse this by ignoring the preprocessor statements because the conditional value ABC is not defined using Edit Condition. Source Insight ends up interpreted the code like this:

typedef struct FOO_V1 {

typedef struct FOO_V2 {

int x;

} FOO;

This is obviously not valid code, and therefore Source Insight cannot parse it. However, if you use Edit Condi­tion to define the value of ABC then Source Insight will parse the code.

Declaring Things Using a Preprocessor Macro

In this situation, you are using a preprocessor macro to declare things. An example of this might be some­thing like this:

#define MyArray(name) char *name[]

MyArray(foo) =

{

   "abc",

   "xyz",

   ...

};

In this case, Source Insight thinks MyArray(foo) is a function, so it skips ahead and eventually gets confused.

This can be fixed usually by defining a token macro in the c.tom file located in your Documents\Source Insight 4.0 folder. See: Preprocessor Token Macros. To fix this example, you need to define a token macro for MyArray.

Replacing Keywords, Operators, or Delimiters with Preprocessor Macros

In this situation, a preprocessor macro contains syntax keywords or braces.

#define DeclareMyFunction(name) void name() {

 

DeclareMyFunction(foo)

..body of function

}

This fails to parse because Source Insight does not expand the macro and fails to see the function name or the opening brace. Again, this can be fixed by defining a token macro in the c.tom file located in your Docu­ments\Source Insight 4.0 folder. See: Preprocessor Token Macros. To fix this example, you need to define a token macro for DeclareMyFunction.