コード例 #1
0
ファイル: IO.cs プロジェクト: bibtex/bibsleigh
 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);
     }
 }
コード例 #2
0
ファイル: XBibConditions.cs プロジェクト: bibtex/bibsleigh
 internal XcNegation(XbCondition cond)
 {
     Inner = cond;
     if (Config.Debug)
     {
         Console.WriteLine($"[DEBUG] XcNegation of {cond} is created");
     }
 }
コード例 #3
0
 public XrGuardedAction(XbCondition guard, XbAction act)
 {
     Guard = guard;
     Act   = act;
     if (Config.Debug)
     {
         Console.WriteLine($"[DEBUG] XrGuardedAction of {Guard} => {Act}");
     }
 }
コード例 #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}");
     }
 }
コード例 #5
0
ファイル: XBibConditions.cs プロジェクト: bibtex/bibsleigh
 internal XcConjunction(XbCondition left, XbCondition right)
 {
     X = left;
     Y = right;
 }
コード例 #6
0
ファイル: IO.cs プロジェクト: bibtex/bibsleigh
 private static XbCondition CombineConditions(XbCondition guard, XbCondition newguard)
 => guard == null ? newguard : new XcConjunction(guard, newguard);