Example #1
0
        private void AddParsingRule(string regex, VoidFunc <Match> parseAction)
        {
            bool substituted;

            do
            {
                substituted = false;
                foreach (string substitution in m_regexSubstitutions.Keys)
                {
                    string newRegex = regex.Replace(substitution, m_regexSubstitutions[substitution]);
                    if (newRegex != regex)
                    {
                        substituted = true;
                    }

                    regex = newRegex;
                }
            } while (substituted);

            ParseRule rule = new ParseRule(regex, parseAction);

            this.m_parseRules.Add(rule);
        }
Example #2
0
        private void AddParsingRule(string regex, VoidFunc<Match> parseAction)
        {
            bool substituted;

            do {
                substituted = false;
                foreach (string substitution in m_regexSubstitutions.Keys) {
                    string newRegex = regex.Replace(substitution, m_regexSubstitutions[substitution]);
                    if (newRegex != regex) {
                        substituted = true;
                    }

                    regex = newRegex;
                }
            } while (substituted);

            ParseRule rule = new ParseRule(regex, parseAction);
            this.m_parseRules.Add(rule);
        }