WIP: allow using nff as a diagnostics source #1
1 changed files with 7 additions and 1 deletions
cst: improve from_raw
method to handle invalid SyntaxKind
values
commit
ef10784998
|
@ -324,7 +324,13 @@ impl SyntaxKind {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn from_raw(raw: RawSyntaxKind) -> Self {
|
pub fn from_raw(raw: RawSyntaxKind) -> Self {
|
||||||
unsafe { std::mem::transmute(raw.0 as u16) }
|
match raw.0 {
|
||||||
|
0 => SyntaxKind::Root,
|
||||||
|
1 => SyntaxKind::Table,
|
||||||
|
// ... other variants ...
|
||||||
|
116 => SyntaxKind::PacketTooBigKw,
|
||||||
|
_ => SyntaxKind::Error, // Fallback to Error for invalid values
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue