diff --git a/src/Ramstack.ExpressionParser/Binder.cs b/src/Ramstack.ExpressionParser/Binder.cs
index eb49e26..44001dc 100644
--- a/src/Ramstack.ExpressionParser/Binder.cs
+++ b/src/Ramstack.ExpressionParser/Binder.cs
@@ -9,8 +9,15 @@ namespace Ramstack.Parsing;
public abstract class Binder
{
///
- /// Gets the expression context associated with this binder instance.
+ /// Gets the expression whose instance members can be referenced in an expression without qualification.
///
+ ///
+ /// The context expression, or if the binder has no context.
+ ///
+ ///
+ /// When or returns an instance member
+ /// for an unqualified name, the member is accessed through this expression.
+ ///
public virtual Expression? Context => null;
///
@@ -26,7 +33,8 @@ public abstract class Binder
///
/// Attempts to bind to a method based on the specified type, method name, and parameter types.
///
- /// The from which to select the method.
+ /// The from which to select the method,
+ /// or for an unqualified method name.
/// The representing the name of the method to bind.
/// An array of objects representing
/// the types of arguments passed to the method.
@@ -35,17 +43,28 @@ public abstract class Binder
///
/// A representing the matching method if found; otherwise, .
///
+ ///
+ /// For an unqualified method name, is and
+ /// is . The binder can then return a static method of a type whose members are available
+ /// without qualification, or an instance method of the type of .
+ ///
public abstract MethodInfo? BindToMethod(Type? type, Identifier methodName, Type[] parameterTypes, bool isStatic);
///
/// Attempts to bind to a member (field or property) based on the specified type and member name.
///
- /// The from which to select the member.
+ /// The from which to select the member,
+ /// or for an unqualified member name.
/// The representing the name of the member to bind.
/// A indicating whether to match only static members
/// () or instance members ().
///
/// A representing the matching member if found; otherwise, .
///
+ ///
+ /// For an unqualified member name, is and
+ /// is . The binder can then return a static member of a type whose members are available
+ /// without qualification, or an instance member of the type of .
+ ///
public abstract MemberInfo? BindToMember(Type? type, Identifier memberName, bool isStatic);
}
diff --git a/src/Ramstack.ExpressionParser/ContextAwareBinder.cs b/src/Ramstack.ExpressionParser/ContextAwareBinder.cs
index 6edc1f6..d0e076f 100644
--- a/src/Ramstack.ExpressionParser/ContextAwareBinder.cs
+++ b/src/Ramstack.ExpressionParser/ContextAwareBinder.cs
@@ -4,8 +4,7 @@
namespace Ramstack.Parsing;
///
-/// Represents a binder that is aware of a specific context expression,
-/// allows resolution of members and methods based on the provided context.
+/// Represents a binder that also resolves unqualified names to the members of a context expression.
///
public class ContextAwareBinder : DefaultBinder
{
@@ -18,7 +17,7 @@ public class ContextAwareBinder : DefaultBinder
///
/// Initializes a new instance of the class.
///
- /// The context expression used for binding operations.
+ /// The expression whose members can be referenced without qualification.
public ContextAwareBinder(Expression context)
{
_context = context ?? throw new ArgumentNullException(nameof(context));
@@ -28,6 +27,10 @@ public ContextAwareBinder(Expression context)
}
///
+ ///
+ /// For an unqualified member name, the instance members of take precedence
+ /// over the static members of the types imported into scope.
+ ///
public override MemberInfo? BindToMember(Type? type, Identifier memberName, bool isStatic)
{
if (type is null && isStatic)
@@ -41,6 +44,10 @@ public ContextAwareBinder(Expression context)
}
///
+ ///
+ /// For an unqualified method name, the instance methods of take precedence
+ /// over the static methods of the types imported into scope.
+ ///
public override MethodInfo? BindToMethod(Type? type, Identifier methodName, Type[] parameterTypes, bool isStatic)
{
if (type is null && isStatic)
diff --git a/src/Ramstack.ExpressionParser/DefaultBinder.cs b/src/Ramstack.ExpressionParser/DefaultBinder.cs
index 3508f54..c0636f7 100644
--- a/src/Ramstack.ExpressionParser/DefaultBinder.cs
+++ b/src/Ramstack.ExpressionParser/DefaultBinder.cs
@@ -7,8 +7,13 @@
namespace Ramstack.Parsing;
///
-/// Represents a default implementation of the class.
+/// Represents the default binder, which resolves a predefined set of common .NET types
+/// and the types registered with .
///
+///
+/// Names of types, members, and methods are matched without regard to case.
+/// Only public members are resolved.
+///
public class DefaultBinder : Binder
{
private static readonly Dictionary Empty = new();
@@ -82,8 +87,13 @@ public class DefaultBinder : Binder
/// Registers a custom type for use in binding operations, allowing it to be resolved by name.
///
/// The to register for binding.
- /// A indicating whether the type's members
- /// should be imported directly into scope as static members (default is ).
+ /// A indicating whether the static members of the type
+ /// can be referenced without the type name, as with a using static directive
+ /// (default is ).
+ ///
+ /// The type is registered under its simple name, , without the namespace.
+ /// Registering another type with the same name replaces the earlier registration.
+ ///
public void RegisterType(Type type, bool importAsStatic = false)
{
if (!PredefinedType.ContainsKey(type.Name))
diff --git a/src/Ramstack.ExpressionParser/ExpressionBuilder.cs b/src/Ramstack.ExpressionParser/ExpressionBuilder.cs
index e76ba54..52f8928 100644
--- a/src/Ramstack.ExpressionParser/ExpressionBuilder.cs
+++ b/src/Ramstack.ExpressionParser/ExpressionBuilder.cs
@@ -8,18 +8,19 @@ namespace Ramstack.Parsing;
///
/// Represents a visitor that builds an from an tree.
///
-/// The binder instance.
+/// The binder that resolves the types, members, and methods referenced in the expression.
public partial class ExpressionBuilder(Binder binder) : ExprVisitor
{
///
- /// Gets the binder instance.
+ /// Gets the binder that resolves the types, members, and methods referenced in the expression.
///
public Binder Binder { get; } = binder;
///
///
- /// Throws a if the thread's stack is too small
- /// to visit the expression safely.
+ /// Errors in the expression, such as a name that cannot be resolved or an operator that cannot be applied
+ /// to its operands, are reported by throwing a . The exception is also thrown
+ /// if the thread's stack is too small to visit the expression safely.
///
public override Expression Visit(Expr expr)
{
diff --git a/src/Ramstack.ExpressionParser/ExpressionParser.Parser.cs b/src/Ramstack.ExpressionParser/ExpressionParser.Parser.cs
index 9d62834..0720bfc 100644
--- a/src/Ramstack.ExpressionParser/ExpressionParser.Parser.cs
+++ b/src/Ramstack.ExpressionParser/ExpressionParser.Parser.cs
@@ -18,9 +18,11 @@ partial class ExpressionParser
private const int MaxDepth = 256;
///
- /// Gets the sub-expression parser, which serves as the base parser for expressions.
+ /// Gets the expression parser that does not require the expression to extend to the end of the input.
///
///
+ /// Unlike , this parser leaves the input that follows the expression unconsumed,
+ /// so it can be used as part of a larger grammar.
/// Parsing stops with a fatal error if the expression tree is deeper than 256 levels.
/// Each operator, member access, call, indexer, and pair of parentheses adds a level,
/// so a chain such as a + b + c gets one level deeper with each operator.
diff --git a/src/Ramstack.ExpressionParser/ExpressionParser.cs b/src/Ramstack.ExpressionParser/ExpressionParser.cs
index 8cbdb40..834df33 100644
--- a/src/Ramstack.ExpressionParser/ExpressionParser.cs
+++ b/src/Ramstack.ExpressionParser/ExpressionParser.cs
@@ -12,7 +12,7 @@ public static partial class ExpressionParser
///
/// The expression string to parse.
///
- /// The result of the parsing operation.
+ /// The result of the parsing operation, which contains either the expression tree or a description of the error.
///
public static ParseResult Parse(ReadOnlySpan source) =>
Parse(source, new ExpressionBuilder(new DefaultBinder()));
@@ -21,9 +21,9 @@ public static ParseResult Parse(ReadOnlySpan source) =>
/// Parses the specified expression into an using the specified .
///
/// The expression string to parse.
- /// The binder instance used for resolving members and methods.
+ /// The binder that resolves the types, members, and methods referenced in the expression.
///
- /// The result of the parsing operation.
+ /// The result of the parsing operation, which contains either the expression tree or a description of the error.
///
public static ParseResult Parse(ReadOnlySpan source, Binder binder) =>
Parse(source, new ExpressionBuilder(binder));
@@ -34,7 +34,7 @@ public static ParseResult Parse(ReadOnlySpan source, Binder bi
/// The expression string to parse.
/// The expression builder responsible for constructing the expression tree.
///
- /// The result of the parsing operation.
+ /// The result of the parsing operation, which contains either the expression tree or a description of the error.
///
public static ParseResult Parse(ReadOnlySpan source, ExpressionBuilder builder)
{
@@ -84,6 +84,9 @@ public static ParseResult Parse(ReadOnlySpan source, Expressio
///
/// The evaluated result.
///
+ ///
+ /// If the expression is invalid, an that describes the error is thrown.
+ ///
public static object? Evaluate(ReadOnlySpan source) =>
Evaluate