Antlr4.Misc.CharSupport.GetANTLRCharLiteralForChar C# (CSharp) Метод

GetANTLRCharLiteralForChar() публичный статический Метод

public static GetANTLRCharLiteralForChar ( int c ) : string
c int
Результат string
        public static string GetANTLRCharLiteralForChar(int c)
        {
            if (c < Lexer.MinCharValue)
            {
                return "'<INVALID>'";
            }
            if (c < ANTLRLiteralCharValueEscape.Length && ANTLRLiteralCharValueEscape[c] != null)
            {
                return '\'' + ANTLRLiteralCharValueEscape[c] + '\'';
            }
            if (c >= 0x20 && c <= 0x7f)
            {
                if (c == '\\')
                {
                    return "'\\\\'";
                }
                if (c == '\'')
                {
                    return "'\\''";
                }
                return '\'' + ((char)c).ToString() + '\'';
            }
            // turn on the bit above max "\uFFFF" value so that we pad with zeros
            // then only take last 4 digits
            string hex = c.ToString("x4");
            string unicodeStr = "'\\u" + hex + "'";
            return unicodeStr;
        }