4 using System.Collections;
5 using System.Collections.Generic;
7 namespace SiliconStudio.Shaders.Ast.Hlsl
9 using System.Text.RegularExpressions;
16 #region Constructors and Destructors
42 #region Public Properties
58 public string BaseName
62 var match = MatchSemanticName.Match(Name.Text);
63 return match.Groups[1].Value;
72 public static KeyValuePair<string, int>
Parse(
string text)
74 var match = MatchSemanticName.Match(text);
76 return new KeyValuePair<string, int>(text, 0);
78 string baseName = match.Groups[1].Value;
80 if (!
string.IsNullOrEmpty(match.Groups[2].Value))
82 value = int.Parse(match.Groups[2].Value);
85 return new KeyValuePair<string, int>(baseName, value);
90 #region Public Methods
102 if (ReferenceEquals(null, other))
107 if (ReferenceEquals(
this, other))
112 return base.Equals(other) && Equals(other.
Name, Name);
118 if (ReferenceEquals(null, obj))
123 if (ReferenceEquals(
this, obj))
134 ChildrenList.Clear();
135 ChildrenList.Add(Name);
144 return (base.GetHashCode() * 397) ^ (Name != null ? Name.GetHashCode() : 0);
149 public override string DisplayName
153 return string.Format(
": {0}", Name);
171 return Equals(left, right);
184 return !Equals(left, right);
187 private readonly
static Regex MatchSemanticName =
new Regex(
@"([A-Za-z_]+)(\d*)");
override IEnumerable< Node > Childrens()
Gets the child nodes. An enumeration of child nodes
override bool Equals(object obj)
Identifier Name
Gets or sets the name.
Semantic(string name)
Initializes a new instance of the Semantic class.
override int GetHashCode()
static KeyValuePair< string, int > Parse(string text)
Parses the specified semantic.
Semantic()
Initializes a new instance of the Semantic class.
bool Equals(Semantic other)
Determines whether the specified Semantic is equal to this instance.