Esempio n. 1
0
 internal static XbRule ParseRule(string line, string[] text, ref int i, bool for_each)
 {
     if (i + 1 < text.Length)
     {
         XbCondition guard = null;
         string      ctx;
         do
         {
             var newguard = ParseCondition(line);
             ctx   = newguard.GetContext();
             guard = CombineConditions(guard, newguard);
             i++;
             line = text[i].Trim();
         } while (IsCondition(line));
         var act = ParseAction(line, ctx);
         i++;
         if (for_each)
         {
             return(new XrIterativeAction(ctx, guard, act));
         }
         else
         {
             return(new XrGuardedAction(guard, act));
         }
     }
     else
     {
         throw new NotImplementedException("wrong xbib command: " + line);
     }
 }
Esempio n. 2
0
 internal XcNegation(XbCondition cond)
 {
     Inner = cond;
     if (Config.Debug)
     {
         Console.WriteLine($"[DEBUG] XcNegation of {cond} is created");
     }
 }
Esempio n. 3
0
 public XrGuardedAction(XbCondition guard, XbAction act)
 {
     Guard = guard;
     Act   = act;
     if (Config.Debug)
     {
         Console.WriteLine($"[DEBUG] XrGuardedAction of {Guard} => {Act}");
     }
 }
Esempio n. 4
0
 public XrIterativeAction(string focus, XbCondition guard, XbAction act)
 {
     Focus = focus;
     Guard = guard;
     Act   = act;
     if (Config.Debug)
     {
         Console.WriteLine($"[DEBUG] XrIterativeAction of {Focus} in {Guard} => {Act}");
     }
 }
Esempio n. 5
0
 internal XcConjunction(XbCondition left, XbCondition right)
 {
     X = left;
     Y = right;
 }
Esempio n. 6
0
 private static XbCondition CombineConditions(XbCondition guard, XbCondition newguard)
 => guard == null ? newguard : new XcConjunction(guard, newguard);