1mod dump;
5mod generated {
6 pub(crate) mod kinds;
7}
8pub mod tree;
9
10use std::rc::Rc;
11
12pub use dump::psi_dump;
13pub use generated::kinds::SyntaxKind;
14pub use text_size::{TextRange, TextSize};
15pub use tree::{ElementId, Tree, TreeBuilder};
16
17impl SyntaxKind {
18 pub fn from_raw(raw: u16) -> SyntaxKind {
19 generated::kinds::ALL[raw as usize]
20 }
21
22 pub fn is_trivia(self) -> bool {
23 matches!(
24 self,
25 SyntaxKind::WHITE_SPACE
26 | SyntaxKind::EOL_COMMENT
27 | SyntaxKind::BLOCK_COMMENT
28 | SyntaxKind::SHEBANG_COMMENT
29 | SyntaxKind::DOC_COMMENT
30 )
31 }
32}
33
34#[derive(Debug, Clone)]
36pub struct Parse {
37 pub tree: Rc<Tree>,
38 pub error_messages: Vec<String>,
39}
40
41impl Parse {
42 pub fn has_errors(&self) -> bool {
43 !self.error_messages.is_empty()
44 }
45}