IsIdentContChar() public static method

public static IsIdentContChar ( char c ) : bool
c char
return bool
Esempio n. 1
0
 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(' ');
     }
 }
Esempio n. 2
0
        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(' ');
            }
        }