56 lines
1.0 KiB
C#
56 lines
1.0 KiB
C#
using System;
|
|
|
|
//abc
|
|
static void Match_ABC(ReadOnlySpan<char> input)
|
|
{
|
|
int ptr = 0;
|
|
int region_start = ptr;
|
|
int region_end = region_start;
|
|
|
|
const string pattern = @"abc";
|
|
if(input[0..3].SequenceEqual(pattern))
|
|
{
|
|
ptr += 3;
|
|
region_end = ptr;
|
|
}
|
|
}
|
|
|
|
//a[abc]d
|
|
static void Match_A_charset_ABC_C(ReadOnlySpan<char> input)
|
|
{
|
|
int ptr = 0;
|
|
int region_start = ptr;
|
|
int region_end = region_start;
|
|
|
|
if(input[0] == 'a' && (input[1] == 'a' || input[1] == 'b' || input[1] == 'c') && input[2] == 'd')
|
|
{
|
|
ptr += 3;
|
|
region_end = ptr;
|
|
}
|
|
}
|
|
|
|
//[abc]
|
|
static void Match_charset_ABC(ReadOnlySpan<char> input)
|
|
{
|
|
int ptr = 0;
|
|
int region_start = ptr;
|
|
int region_end = region_start;
|
|
|
|
if(input[0] == 'a' || input[0] == 'b' || input[0] == 'c')
|
|
{
|
|
ptr += 1;
|
|
region_end = ptr;
|
|
}
|
|
}
|
|
|
|
//.
|
|
static void Match_Dot(ReadOnlySpan<char> input)
|
|
{
|
|
int ptr = 0;
|
|
int region_start = ptr;
|
|
int region_end = region_start;
|
|
|
|
ptr += 1;
|
|
region_end = ptr;
|
|
}
|