Parsing Considerations and Parsing Problems

The language parsing in Source Insight is somewhere between a strict grammar parser, and a simple pattern matcher. This is good because the parser is error-tolerant and works well on code that can be incomplete or have some syntax errors. However, there are some points to keep in mind:

Parsing Limitations

Because regular C/C++ preprocessing is not performed by Source Insight's parsers, some coding styles affect parsing correctness in Source Insight.

Having #ifdef blocks break up an individual declaration will confuse Source Insight. If it cannot be avoided, and Source Insight doesn't parse the code correctly, you will need to define the condition value using Edit Condition, so that Source Insight will disable the inactive block of code causing the confusion. See: Conditional Parsing.

For example:

void MyFunc

#ifdef XYZ

   (int param1, int param2)

#else

   (long param1, long param2)

#endif

{

   ...

}

 

Replacing standard language keywords or combinations with #define'd substitutions will confuse Source Insight. If you cannot avoid this, then you will need to define Token Macros to support them. See: Preprocessor Token Macros.

For example:

#define ourpublic public

class D : ourpublic B { … }

This causes a problem because Source Insight doesn't know that the keyword ourpublic really means pub­lic.