Exemplo n.º 1
0
 protected override void StartToken(char nextCh)
 {
     if (_newlinePending)
     {
         Newline();
     }
     if (Les2Lexer.IsIdContChar(_lastCh) && Les2Lexer.IsIdContChar(nextCh))
     {
         _out.Write(' ');
     }
     else if (Les2Lexer.IsOpContChar(_lastCh) && Les2Lexer.IsOpContChar(nextCh))
     {
         _out.Write(' ');
     }
     else if (_lastCh == '-' && (nextCh >= '0' && nextCh <= '9'))             // - 2 is different from -2 (-(2) vs integer literal)
     {
         _out.Write(' ');
     }
 }
Exemplo n.º 2
0
        protected override void OnNodeChanged(char nextCh)
        {
            var lastCh = LastCharWritten;

            if (Les2Lexer.IsIdContChar(lastCh) && Les2Lexer.IsIdContChar(nextCh))
            {
                StringBuilder.Append(' ');
            }
            else if (Les2Lexer.IsOpContChar(lastCh) && Les2Lexer.IsOpContChar(nextCh))
            {
                StringBuilder.Append(' ');
            }
            else if (JustWroteSymbolOrSpecialId && Les2Lexer.IsSpecialIdChar(nextCh))
            {
                StringBuilder.Append(' ');
            }

            JustWroteSymbolOrSpecialId = false;
        }