protected override void StartToken(char nextCh) { if (_newlinePending) { Newline(); } if ((EcsValidators.IsIdentContChar(_lastCh) || _lastCh == '#') && (EcsValidators.IsIdentContChar(nextCh) || nextCh == '@')) { _out.Write(' '); } else if ((_lastCh == '#' && nextCh == '#') || (_lastCh == '+' && nextCh == '+') || (_lastCh == '-' && nextCh == '-') || (_lastCh == '.' && (nextCh == '.' || char.IsDigit(nextCh))) || (_lastCh == '/' && nextCh == '*')) { _out.Write(' '); } }
protected override void OnNodeChanged(char nextCh) { var _lastCh = IsAtStartOfLine ? '\n' : LastCharWritten; if ((EcsValidators.IsIdentContChar(_lastCh) || _lastCh == '#') && (EcsValidators.IsIdentContChar(nextCh) || nextCh == '@')) { Write(' '); } else if ((_lastCh == '#' && nextCh == '#') || (_lastCh == '+' && nextCh == '+') || (_lastCh == '-' && nextCh == '-') || (_lastCh == '.' && (nextCh == '.' || char.IsDigit(nextCh))) || (_lastCh == '/' && nextCh == '*')) { Write(' '); } // EC# allows operator punctuation in identifiers after @' (or @0 to @9), // e.g. @'Foo= is an identifier. So we must not print an expression like // @'Foo . Bar as @'Foo.Bar which would be a single identifier. else if (_punctuationIdentifierEndIndex == StringBuilder.Length && _lastCh != '`' && nextCh > ' ' && nextCh != '(' && nextCh != '[' && nextCh != ')' && nextCh != ']' && nextCh != ';' && nextCh != ',') { Write(' '); } }