Antlr4.Codegen.Target.CSharpTarget.EncodeIntAsCharEscape C# (CSharp) Method

EncodeIntAsCharEscape() public method

public EncodeIntAsCharEscape ( int v ) : string
v int
return string
        public override string EncodeIntAsCharEscape(int v)
        {
            if (v < char.MinValue || v > char.MaxValue)
            {
                throw new ArgumentException(string.Format("Cannot encode the specified value: {0}", v));
            }

            if (v >= 0 && v < targetCharValueEscape.Length && targetCharValueEscape[v] != null)
            {
                return targetCharValueEscape[v];
            }

            if (v >= 0x20 && v < 127 && (v < '0' || v > '9') && (v < 'a' || v > 'f') && (v < 'A' || v > 'F'))
            {
                return new string((char)v, 1);
            }

            return string.Format("\\x{0:X}", v);
        }