示例#1
0
        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];
示例#2
0
        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)));
        });
示例#3
0
        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));
        });
示例#4
0
 public TextDocument(string text, ILinkedDocument successor)
 {
     Text      = text;
     Successor = successor;
 }
示例#5
0
 public ILinkedDocument Concat(ILinkedDocument other)
 {
     return(new TextDocument(this.Text, Successor.Concat(other)));
 }
示例#6
0
 public NestDocument(int level, ILinkedDocument successor)
 {
     this.Level     = level;
     this.Successor = successor;
 }
示例#7
0
 public ILinkedDocument Concat(ILinkedDocument other)
 {
     return(new NestDocument(this.Level, this.Successor.Concat(other)));
 }
示例#8
0
 public ILinkedDocument Concat(ILinkedDocument other)
 {
     return(new NestDocument(this.level, this.successors.Add(other)));
 }
示例#9
0
 public ILinkedDocument Concat(ILinkedDocument other)
 {
     return(new TextDocument(this.text, this.successors.Add(other)));
 }
示例#10
0
 public ILinkedDocument Concat(ILinkedDocument other)
 {
     return(other);
 }