diff --git a/ICSharpCode.NRefactory/CSharp/Ast/AstNode.cs b/ICSharpCode.NRefactory/CSharp/Ast/AstNode.cs index d33ae9f188..a5361ef4f9 100644 --- a/ICSharpCode.NRefactory/CSharp/Ast/AstNode.cs +++ b/ICSharpCode.NRefactory/CSharp/Ast/AstNode.cs @@ -578,6 +578,19 @@ namespace ICSharpCode.NRefactory.CSharp public abstract S AcceptVisitor (IAstVisitor visitor, T data); #region Pattern Matching + /// + /// Performs a pattern matching operation. + /// this is the pattern, is the AST that is being matched. + /// + /// + /// If successful, a match object containing the matched groups. + /// If the match failed, returns null. + /// + /// + /// Patterns are ASTs that contain special pattern nodes (from the PatternMatching namespace). + /// However, it is also possible to match two ASTs without any pattern nodes - doing so will produce an empty match object + /// if the two ASTs are structurally identical; or will return null if the ASTs are not identical. + /// public Match Match(AstNode other) { Match match = new Match(); diff --git a/ICSharpCode.NRefactory/CSharp/Ast/PatternMatching/Backreference.cs b/ICSharpCode.NRefactory/CSharp/Ast/PatternMatching/Backreference.cs index afa73f46ea..c5573f01aa 100644 --- a/ICSharpCode.NRefactory/CSharp/Ast/PatternMatching/Backreference.cs +++ b/ICSharpCode.NRefactory/CSharp/Ast/PatternMatching/Backreference.cs @@ -6,6 +6,9 @@ using System.Linq; namespace ICSharpCode.NRefactory.CSharp.PatternMatching { + /// + /// Matches the last entry in the specified named group. + /// public class Backreference : Pattern { readonly string referencedGroupName; diff --git a/ICSharpCode.NRefactory/CSharp/Ast/PatternMatching/Match.cs b/ICSharpCode.NRefactory/CSharp/Ast/PatternMatching/Match.cs index fe9b1bd9cd..94a4d48329 100644 --- a/ICSharpCode.NRefactory/CSharp/Ast/PatternMatching/Match.cs +++ b/ICSharpCode.NRefactory/CSharp/Ast/PatternMatching/Match.cs @@ -7,7 +7,10 @@ using System.Linq; namespace ICSharpCode.NRefactory.CSharp.PatternMatching { - public class Match + /// + /// Represents the result of a pattern matching operation. + /// + public sealed class Match { List> results = new List>(); diff --git a/ICSharpCode.NRefactory/CSharp/Ast/PatternMatching/Pattern.cs b/ICSharpCode.NRefactory/CSharp/Ast/PatternMatching/Pattern.cs index f4f2470d9b..794806a86a 100644 --- a/ICSharpCode.NRefactory/CSharp/Ast/PatternMatching/Pattern.cs +++ b/ICSharpCode.NRefactory/CSharp/Ast/PatternMatching/Pattern.cs @@ -5,6 +5,9 @@ using System; namespace ICSharpCode.NRefactory.CSharp.PatternMatching { + /// + /// Base class for all patterns. + /// public abstract class Pattern : AstNode { public override NodeType NodeType {