Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Text.RegularExpressions;
- using System.Collections.Generic;
- namespace MH
- {
- static class Operands
- {
- public static List<Operator> operands = new List<Operator>();
- private static Regex mainRegex = new Regex(@"[\s*](\w+)[\s*;]="); //original only this one
- private static Regex newMainRegex = new Regex(@"[\s*](\w+)[\s*;]=");
- public static void Add(string text)
- {
- string buf;
- bool isNotFind;
- int j;
- MatchCollection mcol = mainRegex.Matches(text);
- for (int i = 0; i < mcol.Count; i++)
- {
- buf = mcol[i].Value.Trim(new char[] { ' ', '=' });
- j = 0;
- isNotFind = true;
- while ((j < operands.Count) && isNotFind)
- {
- if (buf == operands[j].value)
- isNotFind = false;
- j++;
- }
- if (isNotFind)
- {
- operands.Add(new Operator(buf, @"[\( *\+{2}\-{2}]" + @buf + @"[*;\+{ 2}\-{ 2}\)\.]"));
- operands[operands.Count - 1].count = (ushort)operands[operands.Count - 1].regex.Matches(text).Count;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement