Skip to main content
Code Review

Return to Question

replaced http://codereview.stackexchange.com/ with https://codereview.stackexchange.com/
Source Link

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:

Tweeted twitter.com/#!/StackCodeReview/status/484154690960371712
added ISyntaxTree interface
Source Link
Mathieu Guindon
  • 75.5k
  • 18
  • 194
  • 467
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; }
}
added code for AttributeParser, changed WPF app screenshot with icons now aligned with the expand/collapsed arrows in the treeview.
Source Link
Mathieu Guindon
  • 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?

deleted 8 characters in body
Source Link
Jamal
  • 35.2k
  • 13
  • 134
  • 238
Loading
Source Link
Mathieu Guindon
  • 75.5k
  • 18
  • 194
  • 467
Loading
lang-cs

AltStyle によって変換されたページ (->オリジナル) /