Exemplo n.º 1
0
 /// <summary>Initialize the decomp rule</summary>
 internal Decomp(string pattern, bool mem, ReasembList reasemb)
 {
     this.pattern    = pattern;
     this.mem        = mem;
     this.reasemb    = reasemb;
     this.currReasmb = 100;
 }
Exemplo n.º 2
0
 /// <summary>Process a line of script input.</summary>
 /// <remarks>Process a line of script input.</remarks>
 private void Collect(string s)
 {
     string[] lines = new string[4];
     if (EString.Match(s, "*reasmb: *", lines))
     {
         if (lastReasemb == null)
         {
             ConsoleSurrogate.WriteLine("Error: no last reasemb");
             return;
         }
         lastReasemb.Add(lines[1]);
     }
     else
     {
         if (EString.Match(s, "*decomp: *", lines))
         {
             if (lastDecomp == null)
             {
                 ConsoleSurrogate.WriteLine("Error: no last decomp");
                 return;
             }
             lastReasemb = new ReasembList();
             string temp = lines[1];
             if (EString.Match(temp, "$ *", lines))
             {
                 lastDecomp.Add(lines[0], true, lastReasemb);
             }
             else
             {
                 lastDecomp.Add(temp, false, lastReasemb);
             }
         }
         else
         {
             if (EString.Match(s, "*key: * #*", lines))
             {
                 lastDecomp  = new DecompList();
                 lastReasemb = null;
                 int n = 0;
                 if (lines[2].Length != 0)
                 {
                     try
                     {
                         n = int.Parse(lines[2]);
                     }
                     catch (FormatException)
                     {
                         ConsoleSurrogate.WriteLine("Number is wrong in key: " + lines[2]);
                     }
                 }
                 keys.Add(lines[1], n, lastDecomp);
             }
             else
             {
                 if (EString.Match(s, "*key: *", lines))
                 {
                     lastDecomp  = new DecompList();
                     lastReasemb = null;
                     keys.Add(lines[1], 0, lastDecomp);
                 }
                 else
                 {
                     if (EString.Match(s, "*synon: * *", lines))
                     {
                         var words = new WordList();
                         words.Add(lines[1]);
                         s = lines[2];
                         while (EString.Match(s, "* *", lines))
                         {
                             words.Add(lines[0]);
                             s = lines[1];
                         }
                         words.Add(s);
                         syns.Add(words);
                     }
                     else
                     {
                         if (EString.Match(s, "*pre: * *", lines))
                         {
                             pre.Add(lines[1], lines[2]);
                         }
                         else
                         {
                             if (EString.Match(s, "*post: * *", lines))
                             {
                                 post.Add(lines[1], lines[2]);
                             }
                             else
                             {
                                 if (EString.Match(s, "*initial: *", lines))
                                 {
                                     initial = lines[1];
                                 }
                                 else
                                 {
                                     if (EString.Match(s, "*final: *", lines))
                                     {
                                         finl = lines[1];
                                     }
                                     else
                                     {
                                         if (EString.Match(s, "*quit: *", lines))
                                         {
                                             quit.Add(" " + lines[1] + " ");
                                         }
                                         else
                                         {
                                             ConsoleSurrogate.WriteLine("Unrecognized input: " + s);
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
Exemplo n.º 3
0
 /// <summary>Add another decomp rule to the list.</summary>
 /// <remarks>Add another decomp rule to the list.</remarks>
 public virtual void Add(string word, bool mem, ReasembList reasmb)
 {
     Add(new Decomp(word, mem, reasmb));
 }