Ejemplo n.º 1
0
 internal void AddFlag <T>(Flag <T> flag)
 {
     foreach (var name in flag.Name.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries))
     {
         Formal.Add(name.Trim(), flag);
     }
 }
Ejemplo n.º 2
0
    public Formal AddFormal(InputElement id, MessageWriter msg)
    {
        Formal f = new Formal(id, locals);

        f.Add(id, msg);
        signature.Add(f);
        return(f);
    }
Ejemplo n.º 3
0
 /// <summary>
 /// Pass a user-implemented IFlag directly to the FlagSet
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="flag"></param>
 /// <returns></returns>
 public T Var <T>(T flag) where T : IFlag
 {
     if (Formal != null && Formal.ContainsKey(flag.Name))
     {
         var msg = Name == "" ? $"flag redefined: {flag.Name}" : $"{Name} flag redefined: {flag.Name}";
         Output().WriteLine(msg);
         throw new InvalidOperationException(msg);
     }
     if (Formal == null)
     {
         Formal = new Dictionary <string, IFlag>();
     }
     Formal.Add(flag.Name, flag);
     return(flag);
 }