For example I can give it a List
class List
class (here modified to implement some IEnumerable
interface), and with a little HierarchicalDataTemplate
in a sandbox WPF app (which probably could also use a peer review!), I get this.. which is already awesome:
For example I can give it a List
class (here modified to implement some IEnumerable
interface), and with a little HierarchicalDataTemplate
in a sandbox WPF app (which probably could also use a peer review!), I get this.. which is already awesome:
For example I can give it a List
class (here modified to implement some IEnumerable
interface), and with a little HierarchicalDataTemplate
in a sandbox WPF app (which probably could also use a peer review!), I get this.. which is already awesome:
public interface ISyntaxTree
{
string Name { get; }
IEnumerable<IAttribute> Attributes { get; }
IList<ISyntaxTree> Nodes { get; }
}
public interface ISyntaxTree
{
string Name { get; }
IEnumerable<IAttribute> Attributes { get; }
IList<ISyntaxTree> Nodes { get; }
}
- 75.5k
- 18
- 194
- 467
For example I can give it a List
class (here modified to implement some IEnumerable
interface), and with a little HierarchicalDataTemplate
in a sandbox WPF app (which probably could also use a peer review!), I get this.. which is already awesome:
tree structure representing the "List" classtree structure representing the "List" class
Here's the AttributeParser
class, which is really just an abstract factory:
public class AttributeParser : IAttributeParser
{
public IAttribute Parse(string instruction)
{
var syntax = @"^Attribute\s(?<Member>[a-zA-Z]+\.)?(?<Name>VB_\w+)\s=\s(?<Value>.*)$";
var regex = new Regex(syntax);
if (!regex.IsMatch(instruction))
{
return null;
}
var match = regex.Match(instruction);
var member = match.Groups["Member"].Value;
var name = match.Groups["Name"].Value;
var value = match.Groups["Value"].Value;
if (!string.IsNullOrEmpty(member))
{
return new MemberAttribute(name, value, member);
}
else
{
return new Attribute(name, value);
}
}
}
I think I'm going to need more of those. Is Parser
a good name for it?
For example I can give it a List
class, and with a little HierarchicalDataTemplate
in a sandbox WPF app (which probably could also use a peer review!), I get this.. which is already awesome:
tree structure representing the "List" class
For example I can give it a List
class (here modified to implement some IEnumerable
interface), and with a little HierarchicalDataTemplate
in a sandbox WPF app (which probably could also use a peer review!), I get this.. which is already awesome:
tree structure representing the "List" class
Here's the AttributeParser
class, which is really just an abstract factory:
public class AttributeParser : IAttributeParser
{
public IAttribute Parse(string instruction)
{
var syntax = @"^Attribute\s(?<Member>[a-zA-Z]+\.)?(?<Name>VB_\w+)\s=\s(?<Value>.*)$";
var regex = new Regex(syntax);
if (!regex.IsMatch(instruction))
{
return null;
}
var match = regex.Match(instruction);
var member = match.Groups["Member"].Value;
var name = match.Groups["Name"].Value;
var value = match.Groups["Value"].Value;
if (!string.IsNullOrEmpty(member))
{
return new MemberAttribute(name, value, member);
}
else
{
return new Attribute(name, value);
}
}
}
I think I'm going to need more of those. Is Parser
a good name for it?