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; }
private bool PruneAll(AST.Options options) { return options.HasFlag(AST.Options.TrimAllTextNodes); }
public bool Prune(AST.Options options) { if (options.HasFlag(AST.Options.DontTrackContext)) Context = null; return PruneAll(options)||PruneEmpty(options); }
public bool PruneEmpty(AST.Options options) { if (!options.HasFlag(AST.Options.TrimEmptyTextNodes)) return false; if (Value.Trim().Length == 0) return true; return false; }
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; }