by Kzinti » Jul 13, 2003 @ 4:44am
The holy standard specifies that parsing should eat as many characters as possible when generating tokens. "<" is parsed as a "<" token. ">>" is parsed as a ">>" token.
Later on, the sementic analyser will differentiate "<" used in a template syntax from an operator "<". It can do so using the context.
When the sementic analyser see ">>" it is already too late. ">>" will then be interpreted as an operator as there is no other possibility. The sementic phase is not allowed to split the token into ">" + ">".
Any compiler that doesn't work that way is not standard compliant. It is a really known "problem", just live with it.