using System; using System.Linq; using System.Collections.Generic; using System.Text; using System.Windows; using System.Text.RegularExpressions; namespace DBToolControls { public class SyntaxProvider { private static List delimiters = new List() { ' ', '\r', '\n', '\t', '(', ')', ';', ',', '.' }; public static ICollection Delimiters { get { return delimiters; } } public static string DelimitersAsRegExPattern { get { StringBuilder sb = new StringBuilder("(\\r\\n", 32); foreach (char c in delimiters) sb.AppendFormat("|{0}", Regex.Escape(c.ToString())); return sb.Append(")").ToString(); } } private List syntaxes = new List(); // Constructor public SyntaxProvider() { syntaxes = new List(); } // Mehods public void AddSyntax(Syntax item) { syntaxes.Add(item); } public Dictionary GetFormattingFor(string wordToFormat) { foreach (Syntax sy in syntaxes) if (sy.Contains(wordToFormat)) return sy.PropertyValues; return null; } } }