public override void VisitFunctionCallSyntax(FunctionCallSyntax syntax) => this.Build(() => base.VisitFunctionCallSyntax(syntax), children => { Debug.Assert(children.Length >= 3); ILinkedDocument name = children[0]; ILinkedDocument openParen = children[1]; ILinkedDocument arguments = Spread(children.Skip(2).SkipLast(1)); ILinkedDocument closeParen = children[^ 1];
public override void VisitForVariableBlockSyntax(ForVariableBlockSyntax syntax) => this.Build(() => base.VisitForVariableBlockSyntax(syntax), children => { Debug.Assert(children.Length == 5); ILinkedDocument openParen = children[0]; ILinkedDocument itemVariable = children[1]; ILinkedDocument comma = children[2]; ILinkedDocument indexVariable = children[3]; ILinkedDocument closeParen = children[4]; return(Spread(Concat(openParen, itemVariable, comma), Concat(indexVariable, closeParen))); });
public override void VisitForSyntax(ForSyntax syntax) => this.Build(() => base.VisitForSyntax(syntax), children => { Debug.Assert(children.Length == 8); ILinkedDocument openBracket = children[0]; ILinkedDocument forKeyword = children[1]; ILinkedDocument variableBlock = children[2]; ILinkedDocument inKeyword = children[3]; ILinkedDocument arrayExpression = children[4]; ILinkedDocument colon = children[5]; ILinkedDocument loopBody = children[6]; ILinkedDocument closeBracket = children[7]; return(Concat(openBracket, Spread(forKeyword, variableBlock, inKeyword, arrayExpression), Spread(colon, loopBody), closeBracket)); });
public TextDocument(string text, ILinkedDocument successor) { Text = text; Successor = successor; }
public ILinkedDocument Concat(ILinkedDocument other) { return(new TextDocument(this.Text, Successor.Concat(other))); }
public NestDocument(int level, ILinkedDocument successor) { this.Level = level; this.Successor = successor; }
public ILinkedDocument Concat(ILinkedDocument other) { return(new NestDocument(this.Level, this.Successor.Concat(other))); }
public ILinkedDocument Concat(ILinkedDocument other) { return(new NestDocument(this.level, this.successors.Add(other))); }
public ILinkedDocument Concat(ILinkedDocument other) { return(new TextDocument(this.text, this.successors.Add(other))); }
public ILinkedDocument Concat(ILinkedDocument other) { return(other); }