CharHashSet

Namespace: Irony
We found 10 examples in language CSharp for this search. You will see 60 fragments of code.

    public static string JoinStrings(string separator, IEnumerable<string> values) {
      StringList list = new StringList();
      list.AddRange(values);
      string[] arr = new string[list.Count];
      list.CopyTo(arr, 0);
      return string.Join(separator, arr);
    }
    public new void Add(char ch) {
      if (_caseSensitive)
        base.Add(ch);
      else {
        base.Add(char.ToLowerInvariant(ch));
        base.Add(char.ToUpperInvariant(ch));
      }

    }
    public override string ToString() {
      return ToString(" ");
    }
    public void AddRange(params string[] items) {
      base.UnionWith(items); 
    }
    public string ToString(string separator) {
      return Strings.JoinStrings(separator, this);
    }
    public override string ToString() {
      return ToString(" ");
    }


    public static string JoinStrings(string separator, IEnumerable<string> values) {
      StringList list = new StringList();
      list.AddRange(values);
      string[] arr = new string[list.Count];
      list.CopyTo(arr, 0);
      return string.Join(separator, arr);
    }
    public new void Add(char ch) {
      if (_caseSensitive)
        base.Add(ch);
      else {
        base.Add(ch.ToString().ToLowerInvariant()[0]);
        base.Add(ch.ToString().ToUpperInvariant()[0]);
      }

    }
    public override string ToString() {
      return ToString(" ");
    }
    public void AddRange(params string[] items) {
      base.UnionWith(items); 
    }
    public string ToString(string separator) {
      return Strings.JoinStrings(separator, this);
    }
    public override string ToString() {
      return ToString(" ");
    }


    public static string JoinStrings(string separator, IEnumerable<string> values) {
      StringList list = new StringList();
      list.AddRange(values);
      string[] arr = new string[list.Count];
      list.CopyTo(arr, 0);
      return string.Join(separator, arr);
    }
    public new void Add(char ch) {
      if (_caseSensitive)
        base.Add(ch);
      else {
        base.Add(char.ToLowerInvariant(ch));
        base.Add(char.ToUpperInvariant(ch));
      }

    }
    public override string ToString() {
      return ToString(" ");
    }
    public void AddRange(params string[] items) {
      base.UnionWith(items); 
    }
    public string ToString(string separator) {
      return Strings.JoinStrings(separator, this);
    }
    public override string ToString() {
      return ToString(" ");
    }


    public static string JoinStrings(string separator, IEnumerable<string> values) {
      StringList list = new StringList();
      list.AddRange(values);
      string[] arr = new string[list.Count];
      list.CopyTo(arr, 0);
      return string.Join(separator, arr);
    }
    public new void Add(char ch) {
      if (_caseSensitive)
        base.Add(ch);
      else {
        base.Add(char.ToLowerInvariant(ch));
        base.Add(char.ToUpperInvariant(ch));
      }

    }
    public override string ToString() {
      return ToString(" ");
    }
    public void AddRange(params string[] items) {
      base.UnionWith(items); 
    }
    public string ToString(string separator) {
      return Strings.JoinStrings(separator, this);
    }
    public override string ToString() {
      return ToString(" ");
    }


    public static string JoinStrings(string separator, IEnumerable<string> values) {
      StringList list = new StringList();
      list.AddRange(values);
      string[] arr = new string[list.Count];
      list.CopyTo(arr, 0);
      return string.Join(separator, arr);
    }
    public new void Add(char ch) {
      if (_caseSensitive)
        base.Add(ch);
      else {
        base.Add(char.ToLowerInvariant(ch));
        base.Add(char.ToUpperInvariant(ch));
      }

    }
    public override string ToString() {
      return ToString(" ");
    }
    public void AddRange(params string[] items) {
      base.UnionWith(items); 
    }
    public string ToString(string separator) {
      return Strings.JoinStrings(separator, this);
    }
    public override string ToString() {
      return ToString(" ");
    }


    public static string JoinStrings(string separator, IEnumerable<string> values) {
      StringList list = new StringList();
      list.AddRange(values);
      string[] arr = new string[list.Count];
      list.CopyTo(arr, 0);
      return string.Join(separator, arr);
    }
    public new void Add(char ch) {
      if (_caseSensitive)
        base.Add(ch);
      else {
        base.Add(char.ToLowerInvariant(ch));
        base.Add(char.ToUpperInvariant(ch));
      }

    }
    public override string ToString() {
      return ToString(" ");
    }
    public void AddRange(params string[] items) {
      base.UnionWith(items); 
    }
    public string ToString(string separator) {
      return Strings.JoinStrings(separator, this);
    }
    public override string ToString() {
      return ToString(" ");
    }


    public void AddPrefix(string prefix, IdOptions options) {
      base.AddPrefixFlag(prefix, (short)options);
    }
    #endregion

    #region overrides
    public override void Init(GrammarData grammarData) {
      base.Init(grammarData);
      _allCharsSet = new CharHashSet(Grammar.CaseSensitive);
      _allCharsSet.UnionWith(AllChars.ToCharArray());

      //Adjust case restriction. We adjust only first chars; if first char is ok, we will scan the rest without restriction 
      // and then check casing for entire identifier
      switch(CaseRestriction) {
        case CaseRestriction.AllLower:
        case CaseRestriction.FirstLower:
          _allFirstCharsSet = new CharHashSet(true);
          _allFirstCharsSet.UnionWith(AllFirstChars.ToLowerInvariant().ToCharArray());
          break;
        case CaseRestriction.AllUpper:
        case CaseRestriction.FirstUpper:
          _allFirstCharsSet = new CharHashSet(true);
          _allFirstCharsSet.UnionWith(AllFirstChars.ToUpperInvariant().ToCharArray());
          break;
        default: //None
          _allFirstCharsSet = new CharHashSet(Grammar.CaseSensitive);
          _allFirstCharsSet.UnionWith(AllFirstChars.ToCharArray());
          break; 
      }
      //if there are "first" chars defined by categories, add the terminal to FallbackTerminals
      if (this.StartCharCategories.Count > 0)
        grammarData.NoPrefixTerminals.Add(this);
      if (this.EditorInfo == null) 
        this.EditorInfo = new TokenEditorInfo(TokenType.Identifier, TokenColor.Identifier, TokenTriggers.None);
    }

    //TODO: put into account non-Ascii aplhabets specified by means of Unicode categories!
    public override IList<string> GetFirsts() {
      var list = new StringList();
      list.AddRange(Prefixes);
      foreach (char ch in _allFirstCharsSet)
        list.Add(ch.ToString());
      if ((Options & IdOptions.CanStartWithEscape) != 0)
        list.Add(this.EscapeChar.ToString());
      return list;
    }

    protected override void InitDetails(ParsingContext context, CompoundTokenDetails details) {
      base.InitDetails(context, details);
      details.Flags = (short)Options;
    }

    //Override to assign IsKeyword flag to keyword tokens
    protected override Token CreateToken(ParsingContext context, ISourceStream source, CompoundTokenDetails details) {
      Token token = base.CreateToken(context, source, details);
      if (details.IsSet((short)IdOptions.IsNotKeyword))
        return token;
      //check if it is keyword
      CheckReservedWord(token);
      return token; 
    }
    private void CheckReservedWord(Token token) {
      KeyTerm keyTerm;
      if (Grammar.KeyTerms.TryGetValue(token.Text, out keyTerm)) {
        token.KeyTerm = keyTerm;
        //if it is reserved word, then overwrite terminal
        if (keyTerm.Flags.IsSet(TermFlags.IsReservedWord))
          token.SetTerminal(keyTerm); 
      }
    }


    public static string JoinStrings(string separator, IEnumerable<string> values) {
      StringList list = new StringList();
      list.AddRange(values);
      string[] arr = new string[list.Count];
      list.CopyTo(arr, 0);
      return string.Join(separator, arr);
    }
    public new void Add(char ch) {
      if (_caseSensitive)
        base.Add(ch);
      else {
        base.Add(char.ToLowerInvariant(ch));
        base.Add(char.ToUpperInvariant(ch));
      }

    }
    public override string ToString() {
      return ToString(" ");
    }
    public void AddRange(params string[] items) {
      base.UnionWith(items); 
    }
    public string ToString(string separator) {
      return Strings.JoinStrings(separator, this);
    }
    public override string ToString() {
      return ToString(" ");
    }


    public static string JoinStrings(string separator, IEnumerable<string> values) {
      StringList list = new StringList();
      list.AddRange(values);
      string[] arr = new string[list.Count];
      list.CopyTo(arr, 0);
      return string.Join(separator, arr);
    }
    public new void Add(char ch) {
      if (_caseSensitive)
        base.Add(ch);
      else {
        base.Add(ch.ToString().ToLowerInvariant()[0]);
        base.Add(ch.ToString().ToUpperInvariant()[0]);
      }

    }
    public override string ToString() {
      return ToString(" ");
    }
    public void AddRange(params string[] items) {
      base.UnionWith(items); 
    }
    public string ToString(string separator) {
      return Strings.JoinStrings(separator, this);
    }
    public override string ToString() {
      return ToString(" ");
    }


    public static string JoinStrings(string separator, IEnumerable<string> values) {
      StringList list = new StringList();
      list.AddRange(values);
      string[] arr = new string[list.Count];
      list.CopyTo(arr, 0);
      return string.Join(separator, arr);
    }
    public new void Add(char ch) {
      if (_caseSensitive)
        base.Add(ch);
      else {
        base.Add(char.ToLowerInvariant(ch));
        base.Add(char.ToUpperInvariant(ch));
      }

    }
    public override string ToString() {
      return ToString(" ");
    }
    public void AddRange(params string[] items) {
      base.UnionWith(items); 
    }
    public string ToString(string separator) {
      return Strings.JoinStrings(separator, this);
    }
    public override string ToString() {
      return ToString(" ");
    }

Irony.CharHashSet : ICollection

Constructors :

public CharHashSet(Boolean caseSensitive = True)

Methods :

public Void Add(Char ch = )
public Void Clear()
public Boolean Contains(Char item = )
public Boolean Remove(Char item = )
public Int32 get_Count()
public Enumerator<Char> GetEnumerator()
public Void GetObjectData(SerializationInfo info = , StreamingContext context = )
public Void OnDeserialization(Object sender = )
public Boolean Add(Char item = )
public Boolean TryGetValue(Char equalValue = , Char& actualValue = )
public Void UnionWith(IEnumerable<Char> other = )
public Void IntersectWith(IEnumerable<Char> other = )
public Void ExceptWith(IEnumerable<Char> other = )
public Void SymmetricExceptWith(IEnumerable<Char> other = )
public Boolean IsSubsetOf(IEnumerable<Char> other = )
public Boolean IsProperSubsetOf(IEnumerable<Char> other = )
public Boolean IsSupersetOf(IEnumerable<Char> other = )
public Boolean IsProperSupersetOf(IEnumerable<Char> other = )
public Boolean Overlaps(IEnumerable<Char> other = )
public Boolean SetEquals(IEnumerable<Char> other = )
public Void CopyTo(Char[] array = )
public Void CopyTo(Char[] array = , Int32 arrayIndex = )
public Void CopyTo(Char[] array = , Int32 arrayIndex = , Int32 count = )
public Int32 RemoveWhere(Predicate<Char> match = )
public IEqualityComparer<Char> get_Comparer()
public Int32 EnsureCapacity(Int32 capacity = )
public Void TrimExcess()
public Type GetType()
public String ToString()
public Boolean Equals(Object obj = )
public Int32 GetHashCode()