public static InvalidName ( string name ) : |
||
name | string | |
return |
/// <devdoc> /// Parses given name and checks it validity /// </devdoc> internal static string ParseName(char[] text, int start, int pos) { char esc = '\0'; string charsToEscape = ""; int saveStart = start; int savePos = pos; if (text[start] == '`') { Debug.Assert(text[checked ((int)pos - 1)] == '`', "Invalid identifyer bracketing, pos = " + pos.ToString(CultureInfo.InvariantCulture) + ", end = " + text[checked ((int)pos - 1)].ToString(CultureInfo.InvariantCulture)); start = checked ((int)start + 1); pos = checked ((int)pos - 1); esc = '\\'; charsToEscape = "`"; } else if (text[start] == '[') { Debug.Assert(text[checked ((int)pos - 1)] == ']', "Invalid identifyer bracketing of name " + new string(text, start, pos - start) + " pos = " + pos.ToString(CultureInfo.InvariantCulture) + ", end = " + text[checked ((int)pos - 1)].ToString(CultureInfo.InvariantCulture)); start = checked ((int)start + 1); pos = checked ((int)pos - 1); esc = '\\'; charsToEscape = "]\\"; } if (esc != '\0') { // scan the name in search for the ESC int posEcho = start; for (int i = start; i < pos; i++) { if (text[i] == esc) { if (i + 1 < pos && charsToEscape.IndexOf(text[i + 1]) >= 0) { i++; } } text[posEcho] = text[i]; posEcho++; } pos = posEcho; } if (pos == start) { throw ExprException.InvalidName(new string(text, saveStart, savePos - saveStart)); } return(new string(text, start, pos - start)); }
/// <summary> /// Parses given name and checks it validity /// </summary> internal static string ParseName(char[] text, int start, int pos) { char esc = '\0'; string charsToEscape = string.Empty; int saveStart = start; int savePos = pos; if (text[start] == '`') { start = checked ((start + 1)); pos = checked ((pos - 1)); esc = '\\'; charsToEscape = "`"; } else if (text[start] == '[') { start = checked ((start + 1)); pos = checked ((pos - 1)); esc = '\\'; charsToEscape = "]\\"; } if (esc != '\0') { // scan the name in search for the ESC int posEcho = start; for (int i = start; i < pos; i++) { if (text[i] == esc) { if (i + 1 < pos && charsToEscape.Contains(text[i + 1])) { i++; } } text[posEcho] = text[i]; posEcho++; } pos = posEcho; } if (pos == start) { throw ExprException.InvalidName(new string(text, saveStart, savePos - saveStart)); } return(new string(text, start, pos - start)); }
internal static string ParseName(char[] text, int start, int pos) { char ch = '\0'; string str = ""; int startIndex = start; int num4 = pos; if (text[start] == '`') { start++; pos--; ch = '\\'; str = "`"; } else if (text[start] == '[') { start++; pos--; ch = '\\'; str = @"]\"; } if (ch != '\0') { int index = start; for (int i = start; i < pos; i++) { if (((text[i] == ch) && ((i + 1) < pos)) && (str.IndexOf(text[i + 1]) >= 0)) { i++; } text[index] = text[i]; index++; } pos = index; } if (pos == start) { throw ExprException.InvalidName(new string(text, startIndex, num4 - startIndex)); } return(new string(text, start, pos - start)); }