Skip to content

Commit 3e98051

Browse files
committed
feat: general improvements and minor bugs
1 parent d0b86f4 commit 3e98051

7 files changed

Lines changed: 170 additions & 76 deletions

File tree

src/WebExpress.WebIndex.Test/WQL/UnitTestWqlWordSearchA.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ public void AbstracrSyntaxTree()
222222
/// </summary>
223223
[Theory]
224224
[InlineData("", true, 0, WqlExpressionType.None, WqlExpressionType.Attribute, WqlExpressionType.OpenParenthesis)]
225+
[InlineData("(", false, 1, WqlExpressionType.OpenParenthesis, WqlExpressionType.Attribute, WqlExpressionType.OpenParenthesis)]
225226
[InlineData("text", false, 1, WqlExpressionType.Attribute, WqlExpressionType.Operator)]
226227
[InlineData("text ", false, 1, WqlExpressionType.Attribute, WqlExpressionType.Operator)]
227228
[InlineData("text #", false, 2, WqlExpressionType.Operator, WqlExpressionType.Operator)]
@@ -233,17 +234,16 @@ public void AbstracrSyntaxTree()
233234
[InlineData("text ~ or", false, 2, WqlExpressionType.Operator, WqlExpressionType.Parameter)]
234235
[InlineData("text ~ &", false, 2, WqlExpressionType.Operator, WqlExpressionType.Parameter)]
235236
[InlineData("text ~ ||", false, 2, WqlExpressionType.Operator, WqlExpressionType.Parameter)]
236-
[InlineData("text ~ '", false, 3, WqlExpressionType.Parameter, WqlExpressionType.Parameter)]
237-
[InlineData("text ~ \"", false, 3, WqlExpressionType.Parameter, WqlExpressionType.Parameter)]
238-
[InlineData("text ~ Helena", true, 3, WqlExpressionType.Parameter, WqlExpressionType.LogicalOperator)]
239-
[InlineData("text ~ 'Helena'", true, 3, WqlExpressionType.Parameter, WqlExpressionType.LogicalOperator)]
240-
[InlineData("text ~ \"Helena\"", true, 3, WqlExpressionType.Parameter, WqlExpressionType.LogicalOperator)]
241-
[InlineData("text ~ day(", false, 3, WqlExpressionType.Parameter, WqlExpressionType.LogicalOperator)]
242-
[InlineData("text ~ day()", true, 3, WqlExpressionType.Parameter, WqlExpressionType.LogicalOperator)]
243-
//[InlineData("text ~ day(\"param1\")", true, 3, WqlExpressionType.Parameter, WqlExpressionType.LogicalOperator)]
244-
[InlineData("text ~ Helena and", false, 4, WqlExpressionType.LogicalOperator, WqlExpressionType.Attribute)]
245-
246-
//[InlineData("text in ('Helena', 'Hans')", true, 2, WqlExpressionType.Operator, WqlExpressionType.Parameter, WqlExpressionType.OpenParenthesis)]
237+
[InlineData("text ~ '", false, 3, WqlExpressionType.Quotation, WqlExpressionType.Parameter)]
238+
[InlineData("text ~ \"", false, 3, WqlExpressionType.Quotation, WqlExpressionType.Parameter)]
239+
[InlineData("text ~ Helena", true, 3, WqlExpressionType.Parameter, WqlExpressionType.LogicalOperator, WqlExpressionType.Order, WqlExpressionType.Partitioning)]
240+
[InlineData("text ~ 'Helena'", true, 5, WqlExpressionType.Quotation, WqlExpressionType.LogicalOperator, WqlExpressionType.Order, WqlExpressionType.Partitioning)]
241+
[InlineData("text ~ \"Helena\"", true, 5, WqlExpressionType.Quotation, WqlExpressionType.LogicalOperator, WqlExpressionType.Order, WqlExpressionType.Partitioning)]
242+
[InlineData("text ~ day(", false, 4, WqlExpressionType.OpenParenthesis, WqlExpressionType.Parameter, WqlExpressionType.Quotation, WqlExpressionType.CloseParenthesis)]
243+
[InlineData("text ~ day()", true, 5, WqlExpressionType.CloseParenthesis, WqlExpressionType.LogicalOperator, WqlExpressionType.Order, WqlExpressionType.Partitioning)]
244+
[InlineData("text ~ day(\"", false, 5, WqlExpressionType.Quotation, WqlExpressionType.Parameter, WqlExpressionType.CloseParenthesis)]
245+
[InlineData("text ~ Helena and", false, 4, WqlExpressionType.LogicalOperator, WqlExpressionType.Attribute, WqlExpressionType.OpenParenthesis)]
246+
[InlineData("text in ('Helena', 'Hans')", true, 11, WqlExpressionType.CloseParenthesis, WqlExpressionType.LogicalOperator, WqlExpressionType.Order, WqlExpressionType.Partitioning)]
247247
public void Analyze(string wql, bool valid, int count, WqlExpressionType type, params WqlExpressionType[] expectedNextTokens)
248248
{
249249
// arrange

src/WebExpress.WebIndex/Internationalization/de

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ wql.expected_terminated_string_token=Es wird ein String-Token mit einem abschlie
1111
wql.expected_similarity=Es wird eine Ähnlichkeitsbedingung erwartet.
1212
wql.expected_distance=Es wird eine Distanzbedingung erwartet.
1313
wql.function_unknown=Unbekannte Funktion.
14+
wql.expected_function=Es wird eine Funktion erwartet.
1415
wql.expected_skip_or_take=Es wird eine Skip- oder Take-Bedingung erwartet.
1516
wql.expected_token=Es wird ein Token erwartet.
16-
wql.expected_token_matching=Das Token entspricht nicht dem erwarteten Muster oder Format.
17+
wql.expected_token_matching=Das Token entspricht nicht dem erwarteten Muster oder Format.
18+
wql.expected_close_parenthesis=Es wird eine schließende Klammer erwartet.

src/WebExpress.WebIndex/Internationalization/en

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ wql.expected_terminated_string_token=A string token with a terminating quotation
1111
wql.expected_similarity=A similarity condition is expected.
1212
wql.expected_distance=A distance condition is expected.
1313
wql.function_unknown=Unknown function.
14+
wql.expected_function=A function is expected.
1415
wql.expected_skip_or_take=A skip or take condition is expected.
1516
wql.expected_token=A token is expected.
16-
wql.expected_token_matching=The token does not match the expected pattern or format.
17+
wql.expected_token_matching=The token does not match the expected pattern or format.
18+
wql.expected_close_parenthesis=A closing parenthesis is expected.

src/WebExpress.WebIndex/Wql/IWqlLookaheadToken.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,5 @@ public interface IWqlLookaheadToken
2323
/// current position (lookahead).
2424
/// </summary>
2525
IEnumerable<WqlExpressionType> ExpectedNextTokens { get; }
26-
27-
/// <summary>
28-
/// Indicates whether the input is syntactically valid up to the current
29-
/// position.
30-
/// </summary>
31-
bool IsValid { get; }
3226
}
3327
}

src/WebExpress.WebIndex/Wql/WqlExpressionType.cs

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,25 +32,57 @@ public enum WqlExpressionType
3232
/// </summary>
3333
Parameter,
3434

35+
/// <summary>
36+
/// Represents a function that performs a specific operation.
37+
/// </summary>
38+
Function,
39+
3540
/// <summary>
3641
/// Represents an order in the system, encapsulating details about the items
3742
/// purchased and their quantities.
3843
/// </summary>
3944
Order,
4045

41-
46+
/// <summary>
47+
/// Specifies the direction in which a collection is sorted, such as ascending
48+
/// or descending.
49+
/// </summary>
4250
OrderDirection,
4351

52+
/// <summary>
53+
/// Gets or sets the partitioning strategy used for data distribution.
54+
/// </summary>
4455
Partitioning,
4556

57+
/// <summary>
58+
/// Represents an operator that partitions a sequence into multiple segments based on
59+
/// specified criteria.
60+
/// </summary>
4661
PartitioningOperator,
4762

63+
/// <summary>
64+
/// Represents the opening parenthesis character used in expressions.
65+
/// </summary>
4866
OpenParenthesis,
4967

68+
/// <summary>
69+
/// Represents the closing parenthesis character used in expressions.
70+
/// </summary>
5071
CloseParenthesis,
5172

73+
/// <summary>
74+
/// Represents the quotation mark character used to delimit string literals.
75+
/// </summary>
76+
Quotation,
77+
78+
/// <summary>
79+
/// Represents the separator character used to delimit values.
80+
/// </summary>
5281
Separator,
5382

83+
/// <summary>
84+
/// Represents a constant value used within an expression.
85+
/// </summary>
5486
Literal
5587
}
5688
}

src/WebExpress.WebIndex/Wql/WqlLookaheadToken.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,6 @@ public sealed class WqlLookaheadToken : IWqlLookaheadToken
2424
/// </summary>
2525
public IEnumerable<WqlExpressionType> ExpectedNextTokens { get; init; } = [];
2626

27-
/// <summary>
28-
/// Indicates whether the input is syntactically valid up to the current
29-
/// position.
30-
/// </summary>
31-
public bool IsValid { get; init; }
32-
3327
/// <summary>
3428
/// Initializes a new instance of the class using the specified WqlToken.
3529
/// </summary>

0 commit comments

Comments
 (0)