antlr/antlr3 — pull request #115 by nickolas-pohilets (2013-06-05 08:35:11+00:00)
Title: Fixed generating of uncompilable C++ code if semantic predicate is invoked from DFA

In Java DFA's are generated as inner classes and method DFAnn::specialStateTransition() may access private members of outer class.
C++ target implements this similarly, but in C++ this approach does not work for two reasons:
1. Generated DFA classes are unrelated to generated recognizer class and do not have access to its private members. They should be declared as inner classes or friends.
2. Unlike Java, in C++ inner classes must use explicit pointer to instance of outer class. Existing implementation provides m_ctx field that can be used for this purpose, but it is not available inside rule methods.

Provided patch solves this problem:
1. Special state transition functions are implemented as private methods of the generated recognizer class, so all recognizer members are freely accessible through implicit 'this' pointer.
2. Method DFAnn::specialStateTransition() just delegates all the work to the one of the mentioned above methods.
3. Generated DFA classes are declared as friends for generated recognizer class.

Also, few other minor problems were fixed by the way.