Exemple #1
0
 public virtual void Copy(Key k)
 {
     key    = k.GetKey();
     rank   = k.Rank();
     decomp = k.Decomp();
 }
Exemple #2
0
 /// <summary>Another initialization for gotoKey.</summary>
 /// <remarks>Another initialization for gotoKey.</remarks>
 internal Key()
 {
     key    = null;
     rank   = 0;
     decomp = null;
 }
 /// <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))
                     {
                         WordList 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);
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
Exemple #4
0
 /// <summary>Initialize the key.</summary>
 /// <remarks>Initialize the key.</remarks>
 internal Key(string key, int rank, DecompList decomp)
 {
     this.key    = key;
     this.rank   = rank;
     this.decomp = decomp;
 }
Exemple #5
0
 /// <summary>Add a new key.</summary>
 /// <remarks>Add a new key.</remarks>
 public virtual void Add(string key, int rank, DecompList decomp)
 {
     Add(new Key(key, rank, decomp));
 }