Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 24 additions & 24 deletions src/Ramstack.ExpressionParser/Binder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,59 +12,59 @@ public abstract class Binder
/// Gets the expression whose instance members can be referenced in an expression without qualification.
/// </summary>
/// <value>
/// The context expression, or <see langword="null"/> if the binder has no context.
/// The context expression, or <see langword="null" /> if the binder has no context.
/// </value>
/// <remarks>
/// When <see cref="BindToMember"/> or <see cref="BindToMethod"/> returns an instance member
/// When <see cref="BindToMember" /> or <see cref="BindToMethod" /> returns an instance member
/// for an unqualified name, the member is accessed through this expression.
/// </remarks>
public virtual Expression? Context => null;

/// <summary>
/// Resolves the type associated with the specified name.
/// </summary>
/// <param name="name">The <see cref="Identifier"/> representing the name of the requested type.</param>
/// <param name="name">The <see cref="Identifier" /> representing the name of the requested type.</param>
/// <returns>
/// The <see cref="Type"/> instance corresponding to the specified <paramref name="name"/>
/// if resolved successfully; otherwise, <see langword="null"/>.
/// The <see cref="Type" /> instance corresponding to the specified <paramref name="name" />
/// if resolved successfully; otherwise, <see langword="null" />.
/// </returns>
public abstract Type? BindToType(Identifier name);

/// <summary>
/// Attempts to bind to a method based on the specified type, method name, and parameter types.
/// </summary>
/// <param name="type">The <see cref="Type"/> from which to select the method,
/// or <see langword="null"/> for an unqualified method name.</param>
/// <param name="methodName">The <see cref="Identifier"/> representing the name of the method to bind.</param>
/// <param name="parameterTypes">An array of <see cref="Type"/> objects representing
/// <param name="type">The <see cref="Type" /> from which to select the method,
/// or <see langword="null" /> for an unqualified method name.</param>
/// <param name="methodName">The <see cref="Identifier" /> representing the name of the method to bind.</param>
/// <param name="parameterTypes">An array of <see cref="Type" /> objects representing
/// the types of arguments passed to the method.</param>
/// <param name="isStatic">A <see cref="bool"/> indicating whether to match only static methods
/// (<see langword="true"/>) or instance methods (<see langword="false"/>).</param>
/// <param name="isStatic">A <see cref="bool" /> indicating whether to match only static methods
/// (<see langword="true" />) or instance methods (<see langword="false" />).</param>
/// <returns>
/// A <see cref="MethodInfo"/> representing the matching method if found; otherwise, <see langword="null"/>.
/// A <see cref="MethodInfo" /> representing the matching method if found; otherwise, <see langword="null" />.
/// </returns>
/// <remarks>
/// For an unqualified method name, <paramref name="type"/> is <see langword="null"/> and <paramref name="isStatic"/>
/// is <see langword="true"/>. 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 <see cref="Context"/>.
/// For an unqualified method name, <paramref name="type" /> is <see langword="null" /> and <paramref name="isStatic" />
/// is <see langword="true" />. 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 <see cref="Context" />.
/// </remarks>
public abstract MethodInfo? BindToMethod(Type? type, Identifier methodName, Type[] parameterTypes, bool isStatic);

/// <summary>
/// Attempts to bind to a member (field or property) based on the specified type and member name.
/// </summary>
/// <param name="type">The <see cref="Type"/> from which to select the member,
/// or <see langword="null"/> for an unqualified member name.</param>
/// <param name="memberName">The <see cref="Identifier"/> representing the name of the member to bind.</param>
/// <param name="isStatic">A <see cref="bool"/> indicating whether to match only static members
/// (<see langword="true"/>) or instance members (<see langword="false"/>).</param>
/// <param name="type">The <see cref="Type" /> from which to select the member,
/// or <see langword="null" /> for an unqualified member name.</param>
/// <param name="memberName">The <see cref="Identifier" /> representing the name of the member to bind.</param>
/// <param name="isStatic">A <see cref="bool" /> indicating whether to match only static members
/// (<see langword="true" />) or instance members (<see langword="false" />).</param>
/// <returns>
/// A <see cref="MemberInfo"/> representing the matching member if found; otherwise, <see langword="null"/>.
/// A <see cref="MemberInfo" /> representing the matching member if found; otherwise, <see langword="null" />.
/// </returns>
/// <remarks>
/// For an unqualified member name, <paramref name="type"/> is <see langword="null"/> and <paramref name="isStatic"/>
/// is <see langword="true"/>. 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 <see cref="Context"/>.
/// For an unqualified member name, <paramref name="type" /> is <see langword="null" /> and <paramref name="isStatic" />
/// is <see langword="true" />. 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 <see cref="Context" />.
/// </remarks>
public abstract MemberInfo? BindToMember(Type? type, Identifier memberName, bool isStatic);
}
6 changes: 3 additions & 3 deletions src/Ramstack.ExpressionParser/ContextAwareBinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class ContextAwareBinder : DefaultBinder
public override Expression Context => _context;

/// <summary>
/// Initializes a new instance of the <see cref="ContextAwareBinder"/> class.
/// Initializes a new instance of the <see cref="ContextAwareBinder" /> class.
/// </summary>
/// <param name="context">The expression whose members can be referenced without qualification.</param>
public ContextAwareBinder(Expression context)
Expand All @@ -28,7 +28,7 @@ public ContextAwareBinder(Expression context)

/// <inheritdoc />
/// <remarks>
/// For an unqualified member name, the instance members of <see cref="Context"/> take precedence
/// For an unqualified member name, the instance members of <see cref="Context" /> take precedence
/// over the static members of the types imported into scope.
/// </remarks>
public override MemberInfo? BindToMember(Type? type, Identifier memberName, bool isStatic)
Expand All @@ -45,7 +45,7 @@ public ContextAwareBinder(Expression context)

/// <inheritdoc />
/// <remarks>
/// For an unqualified method name, the instance methods of <see cref="Context"/> take precedence
/// For an unqualified method name, the instance methods of <see cref="Context" /> take precedence
/// over the static methods of the types imported into scope.
/// </remarks>
public override MethodInfo? BindToMethod(Type? type, Identifier methodName, Type[] parameterTypes, bool isStatic)
Expand Down
10 changes: 5 additions & 5 deletions src/Ramstack.ExpressionParser/DefaultBinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Ramstack.Parsing;

/// <summary>
/// Represents the default binder, which resolves a predefined set of common .NET types
/// and the types registered with <see cref="RegisterType"/>.
/// and the types registered with <see cref="RegisterType" />.
/// </summary>
/// <remarks>
/// Names of types, members, and methods are matched without regard to case.
Expand Down Expand Up @@ -86,12 +86,12 @@ public class DefaultBinder : Binder
/// <summary>
/// Registers a custom type for use in binding operations, allowing it to be resolved by name.
/// </summary>
/// <param name="type">The <see cref="Type"/> to register for binding.</param>
/// <param name="importAsStatic">A <see cref="bool"/> indicating whether the static members of the type
/// <param name="type">The <see cref="Type" /> to register for binding.</param>
/// <param name="importAsStatic">A <see cref="bool" /> indicating whether the static members of the type
/// can be referenced without the type name, as with a <c>using static</c> directive
/// (default is <see langword="false"/>).</param>
/// (default is <see langword="false" />).</param>
/// <remarks>
/// The type is registered under its simple name, <see cref="MemberInfo.Name"/>, without the namespace.
/// The type is registered under its simple name, <see cref="MemberInfo.Name" />, without the namespace.
/// Registering another type with the same name replaces the earlier registration.
/// </remarks>
public void RegisterType(Type type, bool importAsStatic = false)
Expand Down
18 changes: 9 additions & 9 deletions src/Ramstack.ExpressionParser/ExpressionBuilder.Helpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ private object ResolveSymbol(Expr.Reference expr)
/// <param name="expression">The expression of the instance, or <see langword="null" /> for a static member.</param>
/// <param name="member">The field or property to read.</param>
/// <returns>
/// The <see cref="MemberExpression"/> that reads the member.
/// The <see cref="MemberExpression" /> that reads the member.
/// </returns>
private static MemberExpression CreateMemberAccess(Expression? expression, MemberInfo member)
{
Expand Down Expand Up @@ -96,17 +96,17 @@ private static MemberExpression CreateMemberAccess(Expression? expression, Membe
/// <summary>
/// Converts the branches of a conditional expression to their common type.
/// </summary>
/// <remarks>
/// As in C#, the common type is the type of one of the branches, so it is <see cref="object"/> only
/// when a branch is of that type, for example after an explicit conversion. The null literal takes the type
/// of the other branch if that type accepts <see langword="null" />.
/// </remarks>
/// <param name="expr">The conditional expression.</param>
/// <param name="ifTrue">The expression of the true branch.</param>
/// <param name="ifFalse">The expression of the false branch.</param>
/// <returns>
/// The common type of the branches.
/// </returns>
/// <remarks>
/// As in C#, the common type is the type of one of the branches, so it is <see cref="object" /> only
/// when a branch is of that type, for example after an explicit conversion. The null literal takes the type
/// of the other branch if that type accepts <see langword="null" />.
/// </remarks>
private static Type ApplyConditionalConversions(Expr.Conditional expr, ref Expression ifTrue, ref Expression ifFalse)
{
var isTrueNull = IsNullLiteral(expr.IfTrue);
Expand Down Expand Up @@ -159,7 +159,7 @@ static bool CanBeNull(Type type) =>
/// <summary>
/// Creates a null-coalescing expression whose operands are converted to its result type.
/// </summary>
/// <param name="op">The <see cref="Identifier"/> representing the operator.</param>
/// <param name="op">The <see cref="Identifier" /> representing the operator.</param>
/// <param name="lhs">The expression of the left operand.</param>
/// <param name="rhs">The expression of the right operand.</param>
/// <returns>
Expand Down Expand Up @@ -582,9 +582,9 @@ private static Expression ApplyBinaryExpression(Identifier op, Func<Expression,
/// </summary>
/// <param name="operand">The expression of the operand.</param>
/// <param name="type">The non-nullable value type to convert to.</param>
/// <param name="lifted"><see langword="true" /> to convert to the nullable form of <paramref name="type"/>.</param>
/// <param name="lifted"><see langword="true" /> to convert to the nullable form of <paramref name="type" />.</param>
/// <returns>
/// The converted expression, or <paramref name="operand"/> if it is already of the resulting type.
/// The converted expression, or <paramref name="operand" /> if it is already of the resulting type.
/// </returns>
private static Expression ConvertOperand(Expression operand, Type type, bool lifted)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Ramstack.ExpressionParser/ExpressionBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
namespace Ramstack.Parsing;

/// <summary>
/// Represents a visitor that builds an <see cref="Expression"/> from an <see cref="Expr"/> tree.
/// Represents a visitor that builds an <see cref="Expression" /> from an <see cref="Expr" /> tree.
/// </summary>
/// <param name="binder">The binder that resolves the types, members, and methods referenced in the expression.</param>
public partial class ExpressionBuilder(Binder binder) : ExprVisitor<Expression>
Expand All @@ -19,7 +19,7 @@ public partial class ExpressionBuilder(Binder binder) : ExprVisitor<Expression>
/// <inheritdoc />
/// <remarks>
/// 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 <see cref="ParseErrorException"/>. The exception is also thrown
/// to its operands, are reported by throwing a <see cref="ParseErrorException" />. The exception is also thrown
/// if the thread's stack is too small to visit the expression safely.
/// </remarks>
public override Expression Visit(Expr expr)
Expand Down
4 changes: 2 additions & 2 deletions src/Ramstack.ExpressionParser/ExpressionParser.Parser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ partial class ExpressionParser
/// Gets the expression parser that does not require the expression to extend to the end of the input.
/// </summary>
/// <remarks>
/// Unlike <see cref="Parser"/>, this parser leaves the input that follows the expression unconsumed,
/// Unlike <see cref="Parser" />, 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,
Expand Down Expand Up @@ -296,7 +296,7 @@ static Expr HijackMemberExpression(Expr result, Expr value)
}

/// <summary>
/// Stops parsing with a fatal error if the specified expression tree is deeper than <see cref="MaxDepth"/>.
/// Stops parsing with a fatal error if the specified expression tree is deeper than <see cref="MaxDepth" />.
/// </summary>
/// <param name="expr">The expression tree to check.</param>
/// <returns>
Expand Down
24 changes: 12 additions & 12 deletions src/Ramstack.ExpressionParser/ExpressionParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Ramstack.Parsing;
public static partial class ExpressionParser
{
/// <summary>
/// Parses the specified expression into an <see cref="Expression"/>.
/// Parses the specified expression into an <see cref="Expression" />.
/// </summary>
/// <param name="source">The expression string to parse.</param>
/// <returns>
Expand All @@ -18,7 +18,7 @@ public static ParseResult<Expression> Parse(ReadOnlySpan<char> source) =>
Parse(source, new ExpressionBuilder(new DefaultBinder()));

/// <summary>
/// Parses the specified expression into an <see cref="Expression"/> using the specified <see cref="Binder"/>.
/// Parses the specified expression into an <see cref="Expression" /> using the specified <see cref="Binder" />.
/// </summary>
/// <param name="source">The expression string to parse.</param>
/// <param name="binder">The binder that resolves the types, members, and methods referenced in the expression.</param>
Expand All @@ -29,7 +29,7 @@ public static ParseResult<Expression> Parse(ReadOnlySpan<char> source, Binder bi
Parse(source, new ExpressionBuilder(binder));

/// <summary>
/// Parses the specified expression into an <see cref="Expression"/> using the specified <see cref="ExpressionBuilder"/>.
/// Parses the specified expression into an <see cref="Expression" /> using the specified <see cref="ExpressionBuilder" />.
/// </summary>
/// <param name="source">The expression string to parse.</param>
/// <param name="builder">The expression builder responsible for constructing the expression tree.</param>
Expand Down Expand Up @@ -85,7 +85,7 @@ public static ParseResult<Expression> Parse(ReadOnlySpan<char> source, Expressio
/// The evaluated result.
/// </returns>
/// <remarks>
/// If the expression is invalid, an <see cref="ArgumentException"/> that describes the error is thrown.
/// If the expression is invalid, an <see cref="ArgumentException" /> that describes the error is thrown.
/// </remarks>
public static object? Evaluate(ReadOnlySpan<char> source) =>
Evaluate<object>(source);
Expand All @@ -99,8 +99,8 @@ public static ParseResult<Expression> Parse(ReadOnlySpan<char> source, Expressio
/// The evaluated result.
/// </returns>
/// <remarks>
/// The expression can access the members of the runtime type of <paramref name="context"/>.
/// If the expression is invalid, an <see cref="ArgumentException"/> that describes the error is thrown.
/// The expression can access the members of the runtime type of <paramref name="context" />.
/// If the expression is invalid, an <see cref="ArgumentException" /> that describes the error is thrown.
/// </remarks>
public static object? Evaluate(ReadOnlySpan<char> source, object context)
{
Expand Down Expand Up @@ -133,10 +133,10 @@ public static ParseResult<Expression> Parse(ReadOnlySpan<char> source, Expressio
/// <typeparam name="TResult">The expected result type.</typeparam>
/// <param name="source">The expression string to evaluate.</param>
/// <returns>
/// The evaluated result of type <typeparamref name="TResult"/>.
/// The evaluated result of type <typeparamref name="TResult" />.
/// </returns>
/// <remarks>
/// If the expression is invalid, an <see cref="ArgumentException"/> that describes the error is thrown.
/// If the expression is invalid, an <see cref="ArgumentException" /> that describes the error is thrown.
/// </remarks>
public static TResult? Evaluate<TResult>(ReadOnlySpan<char> source)
{
Expand Down Expand Up @@ -164,12 +164,12 @@ public static ParseResult<Expression> Parse(ReadOnlySpan<char> source, Expressio
/// <param name="source">The expression string to evaluate.</param>
/// <param name="context">The evaluation context.</param>
/// <returns>
/// The evaluated result of type <typeparamref name="TResult"/>.
/// The evaluated result of type <typeparamref name="TResult" />.
/// </returns>
/// <remarks>
/// The expression can access the members of <typeparamref name="TContext"/>, not of the runtime type
/// of <paramref name="context"/>. Members declared only in a derived or implementing type are not available.
/// If the expression is invalid, an <see cref="ArgumentException"/> that describes the error is thrown.
/// The expression can access the members of <typeparamref name="TContext" />, not of the runtime type
/// of <paramref name="context" />. Members declared only in a derived or implementing type are not available.
/// If the expression is invalid, an <see cref="ArgumentException" /> that describes the error is thrown.
/// </remarks>
public static TResult? Evaluate<TContext, TResult>(ReadOnlySpan<char> source, TContext context) where TContext : notnull
{
Expand Down
Loading