#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(u16)]
pub enum SyntaxKind {
PackageKw,
ImportKw,
AsKw,
InternalKw,
TypeKw,
ConstKw,
StructKw,
EnumKw,
EnumsetKw,
UnionKw,
BooleanKw,
IntegerKw,
FloatKw,
StringKw,
BytesKw,
TrueKw,
FalseKw,
StepKw,
MatchKw,
ReservedKw,
ErrorKw,
InterfaceKw,
ServiceKw,
SignalKw,
EventKw,
CommandKw,
QueryKw,
FixedKw,
RequireKw,
EnsureKw,
SystemKw,
ComponentKw,
DistributionKw,
DeploymentKw,
MachineKw,
OffersKw,
RequiresKw,
ForKw,
ReservedWord,
Ident,
IntNumber,
FloatNumber,
String,
Regex,
Duration,
Colon,
Eq,
LBracket,
RBracket,
LBrace,
RBrace,
LParen,
RParen,
DotDot,
Dot,
Slash,
Comma,
Question,
Semicolon,
At,
Pipe,
Percent,
Minus,
Lt,
Le,
Gt,
Ge,
EqEq,
Neq,
AmpAmp,
PipePipe,
Bang,
Plus,
Star,
Whitespace,
LineComment,
BlockComment,
DocComment,
Error,
SourceFile,
PackageDecl,
Import,
TypeDef,
ConstDef,
StructDef,
FieldDef,
ReservedEntry,
EnumDef,
EnumValue,
EnumSetDef,
EnumSetBit,
UnionDef,
UnionArm,
TupleType,
TupleField,
ArrayType,
MapType,
OptionalType,
PathType,
PrimitiveType,
UnitExpr,
Constraint,
Bound,
Name,
QualifiedName,
Literal,
InitValue,
InterfaceDef,
SignalDef,
EventDef,
CommandDef,
QueryDef,
FixedDef,
Param,
ParamList,
ReturnType,
StreamType,
FallibleType,
Timing,
TimingRange,
AttrBlock,
Attribute,
AttrValue,
BinaryExpr,
PrefixExpr,
MemberExpr,
PathExpr,
ParenExpr,
LiteralExpr,
ServiceDef,
DottedName,
SystemDef,
ComponentDef,
ComponentLine,
DistributionDef,
DeploymentDef,
MachineDef,
MemberLine,
Reference,
ErrorNode,
}
impl SyntaxKind {
pub fn is_trivia(self) -> bool {
matches!(
self,
SyntaxKind::Whitespace
| SyntaxKind::LineComment
| SyntaxKind::BlockComment
| SyntaxKind::DocComment
)
}
}
impl From<SyntaxKind> for rowan::SyntaxKind {
fn from(kind: SyntaxKind) -> Self {
Self(kind as u16)
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub enum RidlLanguage {}
impl rowan::Language for RidlLanguage {
type Kind = SyntaxKind;
fn kind_from_raw(raw: rowan::SyntaxKind) -> SyntaxKind {
assert!(
raw.0 <= SyntaxKind::ErrorNode as u16,
"raw kind {} is out of range for SyntaxKind",
raw.0,
);
unsafe { std::mem::transmute::<u16, SyntaxKind>(raw.0) }
}
fn kind_to_raw(kind: SyntaxKind) -> rowan::SyntaxKind {
kind.into()
}
}
pub type SyntaxNode = rowan::SyntaxNode<RidlLanguage>;
pub type SyntaxToken = rowan::SyntaxToken<RidlLanguage>;