SboxSuperuser/Core/Effects/EffectToken.cs

A small readonly record struct, EffectToken, used by the effect script parser. Holds a token kind, its text, and the start offset and length in the source, plus an End helper and an Is check for operator or keyword text.

namespace SboxSuperuser.Core.Effects;

/// <summary>One piece of script text: what it is, its exact text and where it sits in the source.</summary>
internal readonly record struct EffectToken( EffectTokenKind Kind, string Text, int Start, int Length )
{
	internal int End => Start + Length;
	internal bool Is( string text ) => Kind is EffectTokenKind.Operator or EffectTokenKind.Keyword && Text == text;
}