internal string NextNamePart() { SkipWhiteSpace(); int start = pos; for (; pos < typeName.Length; pos++) { char c = typeName[pos]; if (c == '\\') { pos++; Check(pos < typeName.Length && SpecialChars.IndexOf(typeName[pos]) != -1); } else if (SpecialChars.IndexOf(c) != -1) { break; } } Check(pos - start != 0); if (start == 0 && pos == typeName.Length) { return(typeName); } else { return(typeName.Substring(start, pos - start)); } }
void AddProperty() { int start = _index; int level = 0; // include leading dots in the path (for XLinq) while (_index < _n && _path[_index] == '.') { ++_index; } while (_index < _n && (level > 0 || SpecialChars.IndexOf(_path[_index]) < 0)) { if (_path[_index] == '(') { ++level; } else if (_path[_index] == ')') { --level; } ++_index; } if (level > 0) { SetError(SRID.UnmatchedParen, _path.Substring(start)); return; } if (level < 0) { SetError(SRID.UnmatchedParen, _path.Substring(0, _index)); return; } string name = _path.Substring(start, _index - start).Trim(); SourceValueInfo info = (name.Length > 0) ? new SourceValueInfo(SourceValueType.Property, _drillIn, name) : new SourceValueInfo(SourceValueType.Direct, _drillIn, (string)null); _al.Add(info); StartNewLevel(); }
private void AnalyseString(T text, TextAnalyzeMode mode) { // character strings const string SpecialChars = @"""!?%&/()=?@<>|?.;:-_#'*+~껙 "; const string Numbers = "0123456789"; // Adding the entries according to mode switch (mode) { case TextAnalyzeMode.AllCharacters: foreach (char v in text.ToString()) { Add((T)Convert.ChangeType(v, text.GetType(), null)); } break; case TextAnalyzeMode.LettersOnly: foreach (var v in text.ToString()) { if ((SpecialChars.IndexOf(v) == -1) & (Numbers.IndexOf(v) == -1)) { Add((T)Convert.ChangeType(v, text.GetType(), null)); } } break; case TextAnalyzeMode.NoNumerals: foreach (var v in text.ToString()) { if (Numbers.IndexOf(v) == -1) { Add((T)Convert.ChangeType(v, text.GetType(), null)); } } break; case TextAnalyzeMode.NoSpecialCharacters: foreach (var v in text.ToString()) { if (SpecialChars.IndexOf(v) == -1) { Add((T)Convert.ChangeType(v, text.GetType(), null)); } } break; case TextAnalyzeMode.NumeralsOnly: foreach (var v in text.ToString()) { if (Numbers.IndexOf(v) != -1) { Add((T)Convert.ChangeType(v, text.GetType(), null)); } } break; case TextAnalyzeMode.SpecialCharactersOnly: foreach (var v in text.ToString()) { if (SpecialChars.IndexOf(v) != -1) { Add((T)Convert.ChangeType(v, text.GetType(), null)); } } break; } }