private static void DoStart(ref RangeParserContext context) { switch (context.Character) { case '(': context.Reset(State.Minimum, Flags.Parenthesis); break; case '*': case '?': context.Reset(State.MinimumFinal); break; case '~': context.Reset(State.Separator); break; default: if (!context.IsWhitespace) { context.Accept(State.Minimum); } break; } }
private static void DoSeparator(ref RangeParserContext context) { switch (context.Character) { case '*': case '?': context.Reset(State.MaximumFinal); break; default: if (!context.IsWhitespace) { context.Accept(State.Maximum); } break; } }
private static void DoMaximum(ref RangeParserContext context, out ReadOnlySpan <char> value) { switch (context.Character) { case '*': case '?': context.Reset(State.MaximumFinal, out value); break; case ')': context.Reset(State.Final, out value); break; default: context.Accept(State.Maximum); value = ReadOnlySpan <char> .Empty; break; } }