Small immutable data types for the editor lexer. LexState stores per-line lexer state as two ints (Flags and Depth) with a Default instance. Token is a simple value record holding Start, Length and TokenKind.
namespace Editor.Prism.Text.Lexer;
/// <summary>Resumable per-line lexer state. Two lines with equal state lex identically.</summary>
public readonly record struct LexState( int Flags, int Depth )
{
public static readonly LexState Default = new( 0, 0 );
}
public readonly record struct Token( int Start, int Length, TokenKind Kind );