71 lines
1.3 KiB
C#
71 lines
1.3 KiB
C#
namespace StellaOps.PolicyDsl;
|
|
|
|
/// <summary>
|
|
/// Represents the kind of token in the policy DSL.
|
|
/// </summary>
|
|
public enum TokenKind
|
|
{
|
|
EndOfFile = 0,
|
|
Identifier,
|
|
StringLiteral,
|
|
NumberLiteral,
|
|
BooleanLiteral,
|
|
LeftBrace,
|
|
RightBrace,
|
|
LeftParen,
|
|
RightParen,
|
|
LeftBracket,
|
|
RightBracket,
|
|
Comma,
|
|
Semicolon,
|
|
Colon,
|
|
Arrow, // =>
|
|
Assign, // =
|
|
Define, // :=
|
|
Dot,
|
|
KeywordPolicy,
|
|
KeywordSyntax,
|
|
KeywordMetadata,
|
|
KeywordProfile,
|
|
KeywordRule,
|
|
KeywordMap,
|
|
KeywordSource,
|
|
KeywordEnv,
|
|
KeywordIf,
|
|
KeywordThen,
|
|
KeywordWhen,
|
|
KeywordAnd,
|
|
KeywordOr,
|
|
KeywordNot,
|
|
KeywordPriority,
|
|
KeywordElse,
|
|
KeywordBecause,
|
|
KeywordSettings,
|
|
KeywordIgnore,
|
|
KeywordUntil,
|
|
KeywordEscalate,
|
|
KeywordTo,
|
|
KeywordRequireVex,
|
|
KeywordWarn,
|
|
KeywordMessage,
|
|
KeywordDefer,
|
|
KeywordAnnotate,
|
|
KeywordIn,
|
|
EqualEqual,
|
|
NotEqual,
|
|
LessThan,
|
|
LessThanOrEqual,
|
|
GreaterThan,
|
|
GreaterThanOrEqual,
|
|
Unknown,
|
|
}
|
|
|
|
/// <summary>
|
|
/// Represents a single token in the policy DSL.
|
|
/// </summary>
|
|
public readonly record struct DslToken(
|
|
TokenKind Kind,
|
|
string Text,
|
|
SourceSpan Span,
|
|
object? Value = null);
|