AK.ValidityChecker.ThrowSyntaxErrorAt C# (CSharp) Method

ThrowSyntaxErrorAt() private static method

private static ThrowSyntaxErrorAt ( string expression, int index ) : void
expression string
index int
return void
        private static void ThrowSyntaxErrorAt(string expression, int index)
        {
            int i = index;
            int l = expression.Length;
            int from = System.Math.Max(0,i-3);
            int to = System.Math.Min(l,i+4);
            int len = to-from;
            string str = "Syntax error: ";
            if (from>0) {
                str+="...";
            }
            str += expression.Substring(from,len);
            if (to<l) {
                str+="...";
            }
            throw new ESSyntaxErrorException(str);
        }