The PPOverridingLexer is used to adapt an external lexer "PPLexer.g" to the parser generated from pp.xtext. To maintain sanity, the PPLexer.g is written in terms of keywords named KW_ where the parser is using KEYWORD_ and where numbers change when new terminals/keywords are added (with a manual tricky synchronization task as a result). As long as the terminals/kewords in PPLexer.g are the same as those in pp.xtext it is sufficient to simply transpose them into range. All KW_ tokens will be after the (common) set of RULE_ tokens. The lexer starts with token 4 (<4 are special token numbers), and thus the first token is KW_INHERITS, which from time to time is given some KEYWORD_nn name (it was KEYWORD_66 for a long time), which is then mapped to the token number 4. When new keywords are introduced in the grammar, a check is required to ensure that that the set of tokens is the same, and if "inherits" is the first (have number 4). If a terminal/keyword is missing (or one added) this simple transposition will fail miserably, so it is important to check.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.