예제 #1
0
 internal static List<StatementSyntax> PrepareForLoop(AST.EachBlock.ForLoopFlags flags, int loopLevel)
 {
     var result = new List<StatementSyntax>();
       if (flags.HasFlag(AST.EachBlock.ForLoopFlags.Last) || flags.HasFlag(AST.EachBlock.ForLoopFlags.Index))
     result.Add(DeclareIntVariable($"index{loopLevel}"));
       if (flags.HasFlag(AST.EachBlock.ForLoopFlags.Last))
     result.Add(DeclareBoolVariableInitialyFalse($"last{loopLevel}"));
       if (flags.HasFlag(AST.EachBlock.ForLoopFlags.First))
     result.Add(DeclareBoolVariableInitialyTrue($"first{loopLevel}"));
       return result;
 }
예제 #2
0
 private bool PruneAll(AST.Options options)
 {
     return options.HasFlag(AST.Options.TrimAllTextNodes);
 }
예제 #3
0
 public bool Prune(AST.Options options)
 {
     if (options.HasFlag(AST.Options.DontTrackContext)) Context = null;
     return PruneAll(options)||PruneEmpty(options);
 }
예제 #4
0
 public bool PruneEmpty(AST.Options options)
 {
     if (!options.HasFlag(AST.Options.TrimEmptyTextNodes)) return false;
     if (Value.Trim().Length == 0) return true;
     return false;
 }
예제 #5
0
 public bool Prune(AST.Options options)
 {
     if (options.HasFlag(AST.Options.DontTrackContext)) Context=null;
     if (options.HasFlag(AST.Options.FlatExpression)) _children.Clear();
     foreach (var expressionNode in _children)
     {
         expressionNode.Prune(options);
     }
     return false;
 }