forked from jamietre/CsQuery
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIExpectPattern.cs
More file actions
71 lines (62 loc) · 1.95 KB
/
Copy pathIExpectPattern.cs
File metadata and controls
71 lines (62 loc) · 1.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace CsQuery.StringScanner
{
/// <summary>
/// An interface for pattern matching.
///
/// Something implementing this interface will be used as follows:
///
/// First, Initialize is called, passing in the source and the starting index where scanning
/// should begin.
///
/// The Validate function then scans the string, and returns true if a valid match is found, and
/// false if not.
///
/// The Result property should be populated by the function with the matching string, and the
/// EndIndex property should be populated with the last position scanned (one after the last
/// valid character that was returned). If no valid string was matched, EndIndex should equal the
/// original StartIndex.
/// </summary>
public interface IExpectPattern
{
/// <summary>
/// Initializes the pattern
/// </summary>
///
/// <param name="startIndex">
/// The start index.
/// </param>
/// <param name="source">
/// Source for the.
/// </param>
void Initialize(int startIndex, char[] source);
/// <summary>
/// Validate the string and try to match something.
/// </summary>
///
/// <returns>
/// true if a matching string was found, false if not.
/// </returns>
bool Validate();
/// <summary>
/// When a valid string was found, the string.
/// </summary>
///
/// <value>
/// A string.
/// </value>
string Result { get; }
/// <summary>
/// Gets zero-based index of the ending postion. This is one position after the last matching
/// character.
/// </summary>
///
/// <value>
/// The end index.
/// </value>
int EndIndex { get; }
}
}