Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
IronyBrowsableNode.cs
Go to the documentation of this file.
1 // Copyright (c) 2014 Silicon Studio Corp. (http://siliconstudio.co.jp)
2 // This file is distributed under GPL v3. See LICENSE.md for details.
3 using System;
4 using System.Collections;
5 using System.Linq;
6 
7 using Irony.Parsing;
8 
9 namespace SiliconStudio.Shaders.Ast
10 {
11  /// <summary>
12  /// Internal class to provides <see cref="Node"/> class browsable by Irony.
13  /// </summary>
14  internal class IronyBrowsableNode : IBrowsableAstNode
15  {
16  /// <summary>
17  /// Initializes a new instance of the <see cref="IronyBrowsableNode"/> class.
18  /// </summary>
19  /// <param name="node">The node.</param>
20  public IronyBrowsableNode(Node node)
21  {
22  Node = node;
23  }
24 
25  /// <inheritdoc/>
26  public Irony.Parsing.SourceLocation Location
27  {
28  get
29  {
31  {
32  SourceFilename = Node.Span.Location.FileSource,
33  Position = Node.Span.Location.Position,
34  Line = Node.Span.Location.Line,
35  Column = Node.Span.Location.Column
36  };
37  }
38  }
39 
40  /// <summary>
41  /// Gets or sets the node.
42  /// </summary>
43  /// <value>
44  /// The node.
45  /// </value>
46  public Node Node { get; set; }
47 
48  /// <inheritdoc/>
49  public IEnumerable GetChildNodes()
50  {
51  return from children in Node.Childrens() where children != null select new IronyBrowsableNode(children);
52  }
53 
54  /// <inheritdoc/>
55  public override string ToString()
56  {
57  return Node.ToString();
58  }
59  }
60 }