public static ArraySyntax CreateArray(IEnumerable <SyntaxBase> items) { var children = new List <SyntaxBase>(); children.Add(SyntaxHelpers.NewlineToken); foreach (var item in items) { children.Add(CreateArrayItem(item)); children.Add(SyntaxHelpers.NewlineToken); } return(new ArraySyntax( SyntaxHelpers.CreateToken(TokenType.LeftSquare, "["), children, SyntaxHelpers.CreateToken(TokenType.RightSquare, "]"))); }
public static ObjectSyntax CreateObject(IEnumerable <ObjectPropertySyntax> properties) { var children = new List <SyntaxBase>(); children.Add(SyntaxHelpers.NewlineToken); foreach (var property in properties) { children.Add(property); children.Add(SyntaxHelpers.NewlineToken); } return(new ObjectSyntax( SyntaxHelpers.CreateToken(TokenType.LeftBrace, "{"), children, SyntaxHelpers.CreateToken(TokenType.RightBrace, "}"))); }