public override void Walk(PythonWalker walker) { if (walker.Walk(this)) { Value.Walk(walker); FormatSpecifier?.Walk(walker); } walker.PostWalk(this); }
public async override Task WalkAsync(PythonWalkerAsync walker, CancellationToken cancellationToken = default) { if (await walker.WalkAsync(this, cancellationToken)) { await Value.WalkAsync(walker, cancellationToken); await FormatSpecifier?.WalkAsync(walker, cancellationToken); } await walker.PostWalkAsync(this, cancellationToken); }
internal override void AppendCodeString(StringBuilder res, PythonAst ast, CodeFormattingOptions format) { res.Append('{'); Value.AppendCodeString(res, ast, format); if (Conversion.HasValue) { res.Append('!'); res.Append(Conversion.Value); } if (FormatSpecifier != null) { res.Append(':'); FormatSpecifier.AppendCodeString(res, ast, format); } res.Append('}'); }
public virtual void PostWalk(FormatSpecifier node) { }
// FormatSpecifier public virtual bool Walk(FormatSpecifier node) { return(true); }
// FormatSpecifier public override bool Walk(FormatSpecifier node) { return(Location >= node.StartIndex && Location <= node.EndIndex); }